# R5 YOLO predictions across focal planes

Status: initial experiment completed for review. The [result page](../results/r5/) shows initial and retrospectively selected planes. The experiment is reproducible using `research/r5_planes.py` and the temporary model environment described in R3.

The same YOLOv8 diatom detector and 0.05 threshold were used on every plane of four practice fields. Initial-plane provisional click coverage was 1, 1, 6 and 5. The plane with the greatest number of clicks inside boxes achieved 1, 1, 7 and 5. The best plane was chosen using those same clicks, and boxes can cover multiple marks. This is an optimistic development diagnostic, not an estimate of recall or a practical selection policy. No taxonomic classifications or cross-plane merging were performed.

The model is trained for boxes, and one box can include several crossing objects. A next experiment should match detections across adjacent planes with an explicit one-to-one policy, retain distinct overlapping instances and show duplicate errors and new candidate detections to a reviewer. Compare against an independently chosen plane and expert reference labels.

## First cross-plane proposal linking · 2026-11-30

Starting from the saved predictions, greedily associate boxes across ascending Z planes by highest last-box IoU ≥ 0.50. Allow up to three plane indices between observations and at most one observation per track per plane. Each unmatched observation starts a new track; each track is represented by its highest-confidence box. This is a simple deterministic development rule, not proof of object identity. Representative Z and all observations are preserved in [linked-proposals.json](/results/r5/linked-proposals.json); [inspect the four fields](/results/r5/linked-proposals.html).

The previously designated initial planes produced 9 boxes with 8 one-to-one provisional point-to-box assignments across four fields. Pooling every plane produces 54 boxes and 20 assignments, but repeated detections can be assigned to different nearby marks. Linking reduces the pool to 19 representative boxes with 16 assignments. The extra boxes can include debris, merged diatoms, duplicates and other false proposals. These point assignments are not recall or precision: marks are nonexpert and incomplete, a large box can span several candidates, and no one-to-one correspondence between marks and actual individuals has been established.

The Z gap and IoU cutoffs were chosen for an exploratory demonstration, with no held-out tuning; greedy matching can swap or merge nearby objects and split a single object after a long focus gap. The source images are overlaid on the initial plane for spatial comparison, while each representative may originate on another plane. No Z registration was applied; L12 highlights registration uncertainty. With expert-adjudicated crossing groups, compare explicit graph assignment, orientation or mask cues, multiple gap limits and an unlinked baseline at a shared false-positive budget. Measure true duplicates, merged detections and complete groups, and keep prediction planes accessible to the reviewer.

Reproduce with `/tmp/diatom-research-venv/bin/python research/r5_link_planes.py`, which reads the existing R5 prediction JSON and original scans. `PYTHONPATH=research python3 -m unittest research/test_r5_link_planes.py` checks same-plane separation and the maximum-gap rule; it does not establish biological correctness.

The [field-review pilot](/results/pilot/field-01/) can now optionally display the 13 linked hypotheses from the crowded practice field, with masks and source-plane navigation. They are alternatives for review and can duplicate the original single-plane proposals; they are not automatically counted or established as individual specimens. `diatom_pilot/stack_proposals.py` builds this static extension from these existing R5 outputs, rather than running stack detection on new fields.
