Quiz: flow fields to objects (Cellpose)

Short questions to test your understanding. Try each on paper first, then open the answer.


Q1. The network predicts three numbers per pixel. What do the first two mean, and what does the colour of a pixel in the “flows” picture show?

Think of an arrow at every pixel.

The first two are the components of an arrow (left–right and up–down) that points along a path inside the cell towards the cell’s centre; the third is the cell probability. In the picture the hue shows the arrow’s direction and the brightness its length, so every cell appears as a small colour wheel around its centre.


Q2. Why are the training arrows computed from heat spread inside the cell, and not as straight lines from each pixel to the centre?

Draw a C-shaped cell and the straight line from one tip to the centre.

In a non-convex cell, the straight line to the centre can leave the cell (in a C it crosses the hole), so a pixel following it would end up outside or in a neighbour. Heat spreads only through the cell, so the uphill direction bends around corners and every path stays inside the cell.


Q3. What is a sink, and how does the decoding turn sinks into masks?

Where do the particles stop?

A sink is a point where the arrows around it all point inwards, so particles that reach it stay there. Every cell pixel moves along the arrows for a fixed number of steps; the end points are counted, the peaks of this count are the seeds, and all pixels whose particles ended at the same seed form one mask.


Q4. A noisy prediction makes two arrows inside one cell point at each other. What object error follows?

Where do the pixels on either side end?

A spurious sink: pixels near it get stuck going back and forth there, while the others reach the true centre. Pixels with different sinks form different objects, so the cell is split. (The flow check may then drop the extra piece, or both pieces.)


Q5. What does the flow check compare, and why does it need no ground truth?

Every mask has its own heat target.

For each mask it computes the arrows the mask should have (the heat target of the mask alone) and compares them with the arrows the network predicted on the same pixels: the mean squared difference. A real cell’s predicted arrows look like its own target; a mask made from debris or from a piece of a split cell does not. Both sets of arrows come from the image and the mask, so no annotation is needed.


Q6. The cell network was trained on cells about 30 pixels across. Your cells are 60 pixels across, but you leave the diameter at 30. What does the network see, and what errors do you expect? And if you type 120?

The image is rescaled by training diameter / given diameter.

With 30 the image is not rescaled, so the network sees cells twice as large as in training: within the range it tolerates, at most a few splits. With 120 the image is shrunk by 4, so the cells are 15 pixels across, half the training size, and many pixels of a cell fall onto few network pixels: merges and missed cells. On the nuclei sample, the F1 drops from 0.92 at the right diameter to 0.14 at about 3.5 times it.


Q7. Why does the default number of Euler steps grow with the cell diameter?

How far must a particle at the edge of a disc travel?

Each step moves a particle about one pixel. A particle at the edge of a disc of diameter d must travel about d/2 pixels (more in a bent cell) to reach the sink. If the steps run out first, the particles stop on the way: masks shrink or break into pieces. So the steps are scaled with the diameter (200 for 30-pixel cells).


Q8. (math) Show that along a path of \dot{\mathbf x} = \nabla h/\|\nabla h\| the heat h only increases. Why does that mean the path ends at the source?

Chain rule for h(\mathbf x(t)).

\frac{d}{dt}h(\mathbf x(t)) = \nabla h \cdot \dot{\mathbf x} = \|\nabla h\| > 0 wherever \nabla h \neq 0. So h increases strictly along the path, and the path can only come to rest where \nabla h = 0. The exact target has a single maximum in the cell, at the source, and no other critical points, so every path ends at the source.