# R16 · Public polygon-mask segmentation check

## Source and split audit · 2026-12-01

**License recheck, 2026-12-02:** The [Zenodo record](https://zenodo.org/records/21295927) currently displays Creative Commons Attribution 4.0 International under Rights. The earlier statement below describes the original check; this later observation does not verify the rights of every image or model independently.

[Khanom, *Images of diatoms for CNN model training*](https://doi.org/10.5281/zenodo.21295927), version 1, supplies images and COCO polygon annotations for *Gomphonema maritimoantarticum* and *Pinnularia australomicrostauron*. The 423,185,634-byte public archive was inspected by byte-range reads; six selected images and annotation files were retrieved locally with ZIP CRC checks, rather than downloading the whole archive. The [archive listing](/results/r16/archive-contents.json) records members and CRCs. The repository page describes the record as open but displayed no explicit license text when checked; confirm the terms before any redistribution or broader reuse.

Across **all** provided annotation variants, 11 Gomphonema image filenames occur in more than one named train/validation/test directory. The variants may represent different experimental subsets, so this observation does not by itself establish that any one intended training protocol leaks. It does mean that combining files naively is unsafe. The [annotation audit](/results/r16/annotation-audit.json) preserves the filename-level check; it does not detect duplicates under different names or related biological samples.

## Prompted mask construction check

Fix seed 20261201, choose three annotated images from the largest available test-named JSON for each genus, excluding filenames appearing under other named splits in the same genus. The [precommitted six-image selection](/results/r16/selection.json) contains one selected reference polygon per image. Filename isolation does not guarantee sample independence; some selected filenames indicate related acquisitions. These images have very different optics, contrast and taxa from the Academy scans and form a small development check, not an independent estimate of local performance.

Resize each 1600 × 1200 source image to 768 × 576 and rasterize the source COCO polygon at that size. Supply MobileSAM with either a single positive point at the deepest interior pixel of the known polygon or its tight axis-aligned bounding box. Both are **oracle prompts derived from the reference**, not automatic localization or ordinary analyst prompts. Compare each resulting mask with the resized reference by pixel IoU; the COCO `area` field is not used. [View all six comparisons](/results/r16/) and [download scores](/results/r16/prompted-masks.json).

The six point-prompt IoUs are 0.938, 0.878, 0.751, 0.802, 0.927 and 0.917 (median 0.898). Box-prompt IoUs are 0.935, 0.872, 0.843, 0.943, 0.916 and 0.907 (median 0.912). These six selected reference polygons are not independent samples, have one annotation per selected image, and do not establish generalization to obscured or overlapping Academy valves. Some images contain other material or diatoms with no selected annotation. Differences may reflect prompt placement, annotation convention, resizing or source-image appearance; they do not establish a box-prompt advantage or model ranking. They show that MobileSAM can produce visually plausible, close-fitting masks on these particular well-defined targets **when told where the target is**.

**Next.** Evaluate a larger, independently grouped, rights-cleared set, including genuine multi-instance crossings and partial valves. Compare point, analyst-drawn box and detector-proposed box on the same specimens; record human effort and detection misses. Rasterize polygon versus original pixels carefully, define visible versus inferred regions, and compare to expert-adjudicated local masks. Check original-resolution and resized predictions and report target-level IoU only for fully annotated targets alongside instance-level complete-group recovery, false positives and missing objects.

**Reproduce.** The range-reader scripts are `research/r16_archive_inspect.py`, `research/r16_inspect_annotations.py`, and `research/r16_fetch_selected.py`; the latter two place fetched material in `/tmp/diatom-mask-coco` and `/tmp/diatom-mask-images`. Run `YOLO_CONFIG_DIR=/tmp/diatom-yolo-config MPLCONFIGDIR=/tmp/mpl-diatom /tmp/diatom-research-venv/bin/python research/r16_prompted_masks.py` with `/tmp/mobile_sam.pt`. The source-image SHA-256 values and model checkpoint hash are in the results. A source JSON variant can overlap another variant; do not use these test-named images for training if evaluating on them.

## Detector-proposed box followed by MobileSAM · 2026-12-01

On the same six selected public images, apply the frozen public diatom YOLO box detector used in R3 at confidence ≥ 0.05, then compare its boxes with the axis-aligned bounding box of the target reference polygon. A prediction is considered matched at box IoU ≥ 0.5; for this evaluation, choose the highest-IoU candidate for the single annotated target in each image, and use that candidate as the MobileSAM box prompt. The target annotation is used for **matching and scoring after detection**, not supplied to the detector, but choosing the target's matched candidate depends on the reference and is not a deployable candidate-selection policy. Other proposals may correspond to unannotated material and are not automatically false positives. [Inspect all six results](/results/r16/automatic-pipeline.html) and [download boxes and scores](/results/r16/automatic-pipeline.json).

The detector produced 10 boxes across the six images, with at least one box matching the selected reference in all six. The matched-box masks had IoUs of 0.935, 0.855, 0.840, 0.890, 0.916 and 0.907 against the public polygons (median 0.899). This is a small selected check, not a reliable recall, precision or end-to-end performance estimate. The selected photos show relatively well-defined target valves and differ from Academy optical conditions. The images may be biologically related and the detector's training-data overlap with this public source is unverified. The six target annotations do not exhaustively label other structures, and the figure crops can omit some full-image detections. The matching rule does not test the ability to distinguish overlapping targets or identify taxa.

This motivates a matched, expert-reviewed local comparison of detector-proposed, analyst-supplied and oracle boxes on the *same* targets, counting detection misses and false proposals as well as mask quality. Capture source slide group, prediction Z, model provenance and annotation independence. Reproduce with `YOLO_CONFIG_DIR=/tmp/diatom-yolo-config MPLCONFIGDIR=/tmp/mpl-diatom /tmp/diatom-research-venv/bin/python research/r16_auto_pipeline.py`; dependencies and checkpoints are documented in R3 and R16.
