F1 score

The F1 score is the harmonic mean of precision and recall, a single number between 0 and 1 that is high only when a model both finds most of the true objects and makes few false predictions. In Supervisely, the evaluation report lists F1 next to precision and recall for each class.

MetricsAlso called F-score, F-measure

Formula

F1 = 2 × precision × recall ÷ (precision + recall)F1 = 2TP ÷ (2TP + FP + FN)
TP, FP and FN are true positives, false positives and false negatives. True negatives do not appear, so F1 ignores how many empty regions a model correctly left alone.

Why a harmonic mean

Take a model with precision 0.9 and recall 0.6. The arithmetic mean would be 0.75. F1 gives 2 × 0.9 × 0.6 ÷ 1.5 = 0.72, and the gap widens as the two drift apart: at precision 1.0 and recall 0.1, F1 is about 0.18. A model cannot buy a good F1 by maximizing one side and neglecting the other.

Weighting recall or precision: F-beta

Fβ = (1 + β²) × precision × recall ÷ (β² × precision + recall)
β > 1 weighs recall more (F2 is common when a miss is expensive); β < 1 weighs precision more.

Traps

  • F1 depends on the confidence threshold. Quote the threshold with the number, or compare models with a threshold-free metric such as mean average precision.
  • Macro F1 averages classes equally, micro F1 pools all counts. On imbalanced data the two can tell opposite stories.
  • In detection, a prediction counts as a true positive only above an IoU threshold, so F1 at IoU 0.5 and at 0.75 are different numbers.

For two sets of pixels, F1 equals the Dice coefficient: both are 2TP ÷ (2TP + FP + FN).

F1 in Supervisely

The model evaluation report for detection and instance segmentation lists F1 next to precision and recall, with per-class metrics and the best confidence threshold for the model, so the number a team quotes matches the setting they deploy.

Frequently asked questions.

How do you calculate the F1 score?

F1 = 2 × precision × recall ÷ (precision + recall). Because it is a harmonic mean, it is high only when both precision and recall are high.

Where can I see the F1 score of my model?

In Supervisely the evaluation report for detection and instance segmentation lists F1 next to precision and recall, with per-class metrics and the best confidence threshold for the model.

Is an F1 score of 0.8 good?

Often, yes, but it depends on the task and the class balance. Compare it with a baseline and with other models on the same validation set, and look at precision and recall separately to see which one limits it.