Quiz: crowded spots and evaluation

Short questions to test your understanding. Try each on paper first, then open the answer. Spots are Gaussians of width σ; the “gate” is the largest distance at which a detection may be matched to a true spot.


Q1. Two equal spots of σ = 2 px are 5 px apart. Do they give two maxima in the raw image? After a matched filter?

2\sigma raw, 2\sqrt2\,\sigma after the matched filter.

Raw: 2\sigma = 4 < 5: two maxima (with a shallow dip). After the matched filter the width is 2\sqrt2 = 2.83, and 2 \times 2.83 = 5.66 > 5: one maximum. The detector sees one candidate.


Q2. Why is there a trade-off between false spots and merged spots in the choice of the filter width?

Recall unit 2: how does the number of noise maxima depend on σ_f?

A wider filter smooths the noise more: fewer noise maxima (their number scales with 1/\sigma_f^2), so fewer false spots at a given threshold. But it also widens the spots, \sigma_\text{eff}^2 = \sigma^2 + \sigma_f^2, so neighbours merge at larger distances. The matched filter (σ_f = σ) is the usual compromise.


Q3. Fitting two spots instead of one always gives a smaller residual. Why is that not enough reason to keep two?

What can a second spot fit when there is only one?

A model with more parameters can always fit the data at least as well: with one real spot, the second spot fits a bit of noise and lowers the residual a little. Keep two spots only if the improvement exceeds a penalty for the extra parameters (e.g. 3c\sigma_n^2 with c = 2 or ln(#pixels)); otherwise single spots get phantom partners.


Q4. What are TP, FP and FN when evaluating a spot detector, and why must the matching be one-to-one?

Two detections near one true spot.

TP: a detection matched to a true spot within the gate; FP: a detection not matched; FN: a true spot not matched. One-to-one: otherwise two detections on one spot would both count as TP (and one detection between two spots would count twice), inflating precision and recall.


Q5. Give an example where greedy matching (closest pair first) gives fewer matches than the optimal matching.

Two truths, two detections on a line.

Truths at 0 and 2.5, detections at 1 and −2, gate 2.5. Greedy takes 1–0 (distance 1) first; then the detection at −2 is 4.5 from the truth at 2.5: one match. Optimal: 1–2.5 (1.5) and −2–0 (2.0): two matches.


Q6. You report F1 = 0.95 with a gate of 5 px for spots of σ = 1.5 px. What is suspicious?

What can be matched at 5 px?

A gate of 5 px (more than 3σ) accepts detections that are far off, and in dense images it can match a detection to a neighbouring spot. The F1 then hides poor localisation. Use a gate of about σ to 2σ, report the RMSE of the matched pairs too, and show F1 against the gate: a good detector has a flat F1 well below 5 px.


Q7. A detector is systematically 0.5 px off to the right (a bug in the pixel-centre convention). Which numbers in the evaluation show it, and which do not?

Detection vs localisation.

With a gate of 2 px, F1 hardly changes: the detections are still within the gate. The RMSE grows (0.5 px in quadrature with the random error), and the mean offset (the average of detection − truth) shows it directly as about (+0.5, 0). Always report the mean offset as well as the RMSE.


Q8. (math) Show that the sum of two equal Gaussians of width σ at \pm d/2 has a single maximum at the centre if and only if d \le 2\sigma.

Compute the second derivative at the centre.

f(x) = g(x - d/2) + g(x + d/2), g(x) = e^{-x^2/2\sigma^2}, g''(x) = (x^2/\sigma^4 - 1/\sigma^2)g(x). Then f''(0) = 2g''(d/2) = \frac{2}{\sigma^2}\big(\frac{d^2}{4\sigma^2} - 1\big)g(d/2), negative (a maximum at the centre) iff d < 2\sigma. For d < 2\sigma one can also check that f' < 0 for all x > 0, so the centre is the only maximum; for d > 2\sigma the centre is a local minimum between two maxima.