# R18 · Automatic proposals for neighboring annotated valves

## Three-pair diagnostic · 2026-12-01

Use the same three closest annotated pairs chosen in [L18](/research/L18.md) from two test-named COCO variants of [Khanom's public dataset](https://doi.org/10.5281/zenodo.21295927). Their reference polygons do **not** share pixels in the original annotations; two nearly touch and one is more separated. They are not evidence about truly overlapping Academy valves. Images may share a biological sample, and the diatom detector's training-data overlap with this source is unknown. The source archive's license terms and cross-variant split caveats are documented in R16.

Run the existing diatom-trained YOLO detector on each resized image at confidence 0.05. Match the two annotated target bounding boxes to **distinct** predicted boxes, choosing the assignment that maximizes the number with box IoU ≥ 0.5, then total IoU. A single box can earn at most one target. For each matched box, prompt MobileSAM and compare its mask to that reference polygon. Assignment uses reference annotations for scoring, not for model input or automatic candidate selection. Other proposals may correspond to unannotated diatoms, debris or other structures; the source labels are not guaranteed exhaustive, so unmatched predictions are not automatically false positives. [Inspect all three pairs](/results/r18/) and [download full boxes, match indices and scores](/results/r18/auto-pairs.json).

The detector matched 1/2 targets in the first image, 0/2 in the second, and 1/2 in the third; no pair had both targets matched at this threshold. Its matched-box MobileSAM masks had IoUs 0.922 and 0.929 against the two corresponding source polygons. It produced 2, 0 and 7 boxes across the images. The other two targets in L18 could be outlined when supplied with reference-derived points and negative points, but those are conditional experiments with extra information, not automatic predictions. This contrast motivates improved **instance proposal and separation**, rather than treating the mask decoder alone as the whole system.

These three selected pairs do not yield reliable detection recall, false-positive rates or an estimate for Academy material. They are deliberately the closest annotated pairs available in the audited variants; one contains additional structures, target identities and boxes depend on the dataset, and 0.5 IoU is an exploratory threshold. The resize and mask polygon conventions also affect scores. Complete overlap-group accuracy cannot be measured because the annotated pairs do not overlap. Nor is a conditional mask score for detected targets an end-to-end score.

**Next.** Add expert-adjudicated local crossing groups and partial valves, record every count-eligible target and uncertain unlabelled object, and compare detector variants at a common false-positive/review budget. Report per-group recovery and both misses and duplicates. Compare candidate-generated and analyst-supplied point/box prompts, including the extra action cost and masks accidentally excluding the target. Require two distinct instances when two are verified, even if their true image masks overlap.

**Reproduce.** Run `research/r18_select_neighbors.py` and the authorized `research/r18_fetch_neighbors.py` after the R16 annotation audit, then `YOLO_CONFIG_DIR=/tmp/diatom-yolo-config MPLCONFIGDIR=/tmp/mpl-diatom /tmp/diatom-research-venv/bin/python research/r18_auto_pairs.py`. The script uses the R3 detector and MobileSAM checkpoints described in R3/R6, and records all predictions and source pair IDs.

## Tiled detector comparison · 2026-12-01

Run the same detector on six overlapping 384 × 384 tiles per 768 × 576 image, resized to 640 pixels for inference, and combine translated boxes with confidence-ordered IoU suppression at 0.5. The full-field baseline used one 768-pixel input. Confidence threshold remains 0.05. Apply the same maximum-cardinality distinct-box assignment at reference box IoU ≥ 0.5, with MobileSAM prompted from assigned boxes only. [View comparisons](/results/r18/tiled-pairs.html) and [download tile boxes and assignments](/results/r18/tiled-pairs.json).

Tiled versus full-field matched target counts are 0/2 versus 1/2, 0/2 versus 0/2, and 2/2 versus 1/2. The tiled detector returned 2, 0 and 19 retained boxes; full-field returned 2, 0 and 7. On the one pair where both tile boxes matched, the two prompted masks have reference IoUs 0.929 and 0.811. Reference-based assignment is used only for evaluation and is not an automatic method for choosing the correct boxes. One setting loses a match while another gains a complete pair and increases candidate count substantially. Unmatched boxes are not automatically false positives because other objects are not exhaustively labeled. Image crops in the figure may omit boxes outside the region.

This is a different field of view and effective scale, on the same three selected, potentially related images, with no true-overlap pair or expert-reviewed Academy labels. It does not establish which setting generalizes or compare at an equal false-positive/review budget. Preserve full-field and tiled proposals as alternatives to test on fresh annotated data; explicitly measure duplicate and candidate burden. Reproduce with `YOLO_CONFIG_DIR=/tmp/diatom-yolo-config MPLCONFIGDIR=/tmp/mpl-diatom /tmp/diatom-research-venv/bin/python research/r18_tiled_pairs.py` after the R18 images and checkpoints are available.
