AI · 10 minutes

Metric bench

A biologist rarely asks "which pixels are cell?". The questions are "how many cells?", "how big?", "where did each one go?". Break a segmentation in five ways and see which metric notices.

Start here for readers new to image analysis

Segmentation
Deciding for every pixel of an image whether it belongs to a cell or to the background. Instance segmentation goes one step further and says which cell: every cell gets its own label.
Ground truth, prediction
Ground truth is the reference, usually outlines drawn by a person. The prediction is what the model produced. A metric is a number that says how well the two agree.
IoU
Intersection over union: the area two shapes share, divided by the area they cover together. Identical shapes score 1, shapes that do not touch score 0.
Hit, false alarm, miss
A predicted cell that matches a true cell is a hit. A predicted cell with no match is a false alarm. A true cell that nothing matched is a miss.

1. Break the prediction

Colours: predicted instances, one colour per predicted cell. White lines: ground-truth outlines.

pixel Dice
instance F1 at IoU 0.5
panoptic quality
cells found / true cells

2. What the numbers measure

MetricDefinitionBlind to
Pixel Dice (and IoU)Overlap of all foreground pixels: 2 |A ∩ B| / (|A| + |B|)Which pixel belongs to which cell. Merges and splits cost nothing. Small cells barely count.
Instance F1 at IoU 0.5A predicted cell is a hit if it overlaps one true cell with IoU above 0.5. F1 combines hits, false alarms and misses.How good the outline of a hit is. An IoU of 0.51 and 0.99 count the same.
Panoptic qualitySum of the IoU of all hits, divided by hits + ½ false alarms + ½ missesLittle. It mixes detection and outline quality into one number, which also makes it harder to interpret.
CountPredicted objects against true objectsEverything else. A merge and a split cancel out.

3. Choose the metric from the question

Report more than one number, state the matching threshold, and average per image or per patient before averaging over the dataset. A single mean over all cells lets one dense image dominate.

4. Check yourself

Notes and caveats

The cells are circles on a 240 × 160 pixel grid, and errors are applied uniformly, which real models never do. Matching uses the common rule that an IoU above 0.5 makes a match unique. Community benchmarks often average F1 or precision over several thresholds from 0.5 to 0.95. For a thorough treatment, see the "Metrics Reloaded" recommendations (Maier-Hein, Reinke and colleagues).