Quiz: evaluation against ground truth
Before this unit: Local thresholds & hysteresis (previous unit); Day 1: Images, filters and frequencies.
See also: Day 3: Bit depth and noise; Day 2: Edges, blobs and ridges.
Short questions to test your understanding. Try each on paper first, then open the answer. TP, FP, FN and TN count the pixels of a predicted mask compared with the ground truth.
Q1. A mask has TP = 80, FP = 20, FN = 40. Compute precision, recall and Dice.
TN is not needed.
Precision 80/100 = 0.80, recall 80/120 = 0.67, Dice 160/(160 + 60) = 0.73.
Q2. Why can a useless segmentation have 99 % accuracy?
Think of an image with very few object pixels.
If objects are 1 % of the pixels, calling everything background gets 99 % of the pixels right (all TN) while finding nothing. Accuracy is dominated by the true negatives.
Q3. Dice is 0.9. What is the Jaccard index?
J = D/(2 - D).
0.9/1.1 = 0.82. Jaccard is always smaller than Dice (except at 0 and 1), but ranks masks in the same order.
Q4. Where on the ROC plot are the points for “everything is object” and “nothing is object”?
Compute TPR and FPR in both cases.
Everything object: TPR = 1, FPR = 1, the top-right corner. Nothing object: TPR = 0, FPR = 0, the bottom-left corner. Every threshold lies on the curve between them.
Q5. A method’s ROC curve is the diagonal from (0, 0) to (1, 1). What is its AUC, and what does that say about the grey levels?
AUC = the probability that an object pixel is brighter than a background pixel.
AUC = 0.5: an object pixel is brighter than a background pixel only half the time, as by chance. The grey level carries no information about the class.
Q6. Two methods have the same ROC curve, but you test them on images where objects are 0.5 % of the pixels. Why should you also look at the precision–recall curve?
How many false positives does an FPR of 0.02 mean here?
FPR is a fraction of the huge background: 2 % of 99.5 % of the pixels is four times the whole object. The ROC point still looks good, but precision is poor. The PR curve shows how many false positives come with each true one.
Q7. A segmentation merges every pair of touching cells into one blob, otherwise perfectly. Is its Dice high or low? Is it a good segmentation for counting cells?
Which pixels are wrong?
Dice is close to 1: almost every pixel has the right label (only the thin boundary between touching cells is wrong). For counting it is bad: every touching pair counts as one cell. Pixel measures do not see objects; object-level evaluation (day 38) does.
Q8. (math) Show that Dice is the harmonic mean of precision and recall.
1/p = (TP + FP)/TP and 1/r = (TP + FN)/TP.
\frac{2}{1/p + 1/r} = \frac{2\,TP}{(TP + FP) + (TP + FN)} = \frac{2\,TP}{2\,TP + FP + FN}, which is Dice.