The network says “nucleus” for every nucleus pixel. Which pixels belong to which nucleus?
A semantic mask is not a set of objects: touching cells come out as one blob.
A network has no fixed number of outputs, so it predicts a map that makes separation easy, and a classical step makes the objects.
Four such maps: a boundary class, a distance map, star-convex polygons, flow fields; the first two in detail here, star-convex polygons and flows on the next day.
Detection (boxes) as another output, and panoptic segmentation.
Slides titled The math give the formulas and proofs; the ideas are complete without them.
The U-Net unit of the neural networks day: a probability “nucleus” per pixel, thresholded to a mask. Its “touching nuclei merge” preset: two touching nuclei become one connected blob.
Semantic segmentation: a class per pixel (“nucleus”, “background”).
Instance segmentation: an object identity per pixel (“nucleus 7”).
Panoptic segmentation: both at once. Every pixel gets a class; countable things (nuclei, cells) also get an identity, uncountable stuff (background, stroma) does not.
Counting, measuring, tracking: all need instances.
Why post-processing is unavoidable
A convolutional network does the same thing at every position (translation equivariance) and produces a fixed set of output maps.
The number of objects in an image varies from 0 to 1000.
So the network cannot output “object 1, object 2, …” directly. It outputs a map that makes separation easy, and a classical step turns the map into objects: labelling, watershed, suppression, following arrows.
The question for every method: which map, and which classical step?
Route 1: a boundary class
Train with three classes: background, cell interior, cell boundary (a thin ring around every cell, also between touching cells).
Label the connected interiors (the labelling day), then grow each one back over its boundary pixels.
Touching cells are separated by the boundary class between them.
Fails when the boundary is missed in one place: a one-pixel bridge connects two interiors and they merge. Thin structures are hard to predict, especially exactly where two cells touch.
The boundary route as pseudocode
labels = connected pieces of the interior pixels # labelling day
repeat until nothing changes:
for every boundary pixel without a label:
if a neighbour has a label: take it
background pixels keep 0
One interior pixel where a boundary should be joins two pieces: a merge.
The growing only gives the boundary ring back to its cell; it cannot separate anything.
Route 2: a predicted distance map
Train the network to predict, for every cell pixel, its distance to the cell’s border (scaled to 1 at the centre of each cell).
Then exactly the watershed day’s pipeline: threshold for the mask, h-maxima as markers, flood -D inside the mask.
Better than the distance transform of a mask: the network has seen the image, so it can put a deep neck between two cells even where the mask has none.
Fails on elongated cells: the distance has a long flat ridge, and small errors make several peaks on it: one cell is split.
The math: the four targets
Cell O, pixel p \in O:
Boundary class: p is boundary if one of its 4 neighbours is not in O; loss: cross-entropy over the 3 classes.
Whatever the route: look at the predicted map, not only at the final labels. Errors in the map turn into object errors (merges, splits, missed dim cells) that the evaluation day’s matching counts.
Detection: objects as a list
The other big family predicts a list of objects instead of a map: a box and a score per object, optionally a small mask inside each box (“detect, then segment inside the box”).
A box is 4 numbers; good for counting, tracking and cropping; poor for long diagonal objects.
The detector proposes many overlapping boxes, removed by non-maximum suppression: the next unit.
Star-convex polygons are the same idea with a polygon instead of a box.
Panoptic segmentation
A semantic head (stuff and thing classes for every pixel) and an instance head (identities of the things), merged by a rule: on “thing” pixels the instance label wins.
Tissue example: nuclei are things (counted, measured one by one); stroma, lumen and background are stuff (area only).
The math: panoptic quality
Match predicted and true segments one to one at IoU > 0.5 (the evaluation day’s matching: above 0.5 the matching is unique). With TP matched pairs, FP unmatched predictions, FN unmatched truths:
Example: 3 matches with IoU 0.9, 0.8, 0.7, one FP and two FN: SQ = 0.8, RQ = 3/4.5 = 0.67, PQ = 0.53. Computed per class and averaged over classes.
Recall: counting the errors
From the evaluation day: match predicted to true objects one to one at IoU \ge \tau (here \tau = 0.5), count TP, FP, FN objects; F1 = 2\,TP/(2\,TP + FP + FN); matching accuracy= TP/(TP + FP + FN); a merge is a predicted object covering two true ones, a split a true object covered by two predictions.
The demo shows these numbers for every route and every error setting.
Summary
A semantic mask is not a set of objects; instance segmentation needs a map plus a classical step.
Boundary class + labelling: one missed boundary pixel merges two cells.