# R14 · Unknown-taxon rejection

## 2026-11-30: small controlled withholding diagnostic

**Question.** When no reference of a query's genus is present, does a nearest-neighbor similarity threshold avoid offering a confident genus? The goal is a useful abstention, not forced identification.

**Data and method.** Reuse the 18 hand-selected UDE cutouts in the R7 manifest, three genera across six source slide identifiers. Extract normalized frozen ImageNet ResNet-18 features exactly as in the R7 retrieval experiment. For each test slide, remove that slide from the gallery. For each query, run two scenarios: (1) all other slide references are available, and (2) *every* reference of the query genus is withheld. In both scenarios, take the most similar remaining reference. A similarity below the selected threshold means abstain; otherwise return that reference's genus.

To choose the threshold without using the test slide, perform inner leave-one-slide-out comparisons on the remaining five slides; each inner gallery contains four slides. Maximize balanced accuracy for distinguishing genus-present versus genus-withheld cases, breaking ties toward the higher threshold. Apply that threshold to both scenarios for each of the three queries on the outer test slide, using a five-slide gallery. The script records six thresholds, the comparisons, gallery neighbors and source identifiers. This assesses a score-based gate, not the taxonomic correctness of each accepted known query; report both separately.

**Results.** Across the 18 outer test queries, the gate accepted 12 of 18 genus-present cases; 11 of those accepted suggestions had the reference genus, and one had the wrong genus. It abstained on six genus-present cases. When all references of each query's genus were removed, it abstained on 12 of 18 cases and still returned a wrong available genus on six. Fold thresholds ranged from 0.778 to 0.824. The same 18 queries occur in both conditions, so the 36 scenarios are paired rather than 36 independent specimens. The inner and outer gallery sizes differ (four vs five slides), which can affect nearest-neighbor score calibration.

**Interpretation and limitations.** [All paired comparisons](/results/r14/) and [machine-readable output](/results/r14/unknown-genus-results.json) are available for review. This tiny, balanced, selected dataset lacks debris, fragments, crossings, and Academy material. The three genus names occur in inner calibration as well as outer tests; withholding a genus from an individual gallery is not testing a genuinely unseen taxonomic group. Reused galleries and potentially related samples mean these are not independent-population estimates, and genus labels were taken from the public dataset without re-adjudication. It is not valid to deploy these thresholds or interpret 12/18 as an expected rejection rate. But the six forced wrong suggestions show why a similarity threshold needs explicit unknown-case testing.

**Next.** Obtain a larger reference set and hold out entire genera from threshold tuning, alongside slide- and sample-grouped evaluation. Add independent expert-reviewed debris, partials, look-alikes and crossings. Compare score calibration, nearest-neighbor margin, image quality and explicit rank-level abstention at preset false-naming budgets. Record review time and report uncertainty by independent biological sample. Keep R14 open for that evaluation.

**Reproduce.** `/tmp/diatom-research-venv/bin/python research/r14_unknown.py` after making the previously used ResNet-18 weights available at `/tmp/resnet18-f37072fd.pth`. Inputs are `results/r7/reference-manifest.json` and its referenced images. Python dependencies are numpy, Pillow, torch and torchvision. Result pages use display resizing only; model preprocessing is implemented in the script.

## Cached-archive unknown-genus stress test · 2026-12-01

The attempted expanded UDE download did not finish. A previously cached **incomplete** archive prefix contains 61 complete PNG entries with valid ZIP CRCs, all from a single source-slide identifier excluded from the earlier 18-image gallery. These are the first complete images in archive order, not a random sample. Join their filenames to the published UDE metadata; they represent 11 recorded genera. Ten of those genera are absent from the original three-genus gallery; the query set also includes two images from one gallery genus. The complete recovered images, member hashes and metadata are in `results/r14/prefix/`. Dataset credit and terms are documented in R7.

Keep the original 18 gallery images and frozen ResNet-18. Set one fixed threshold to the median of the six thresholds from the earlier R14 slide-held-out calibration (0.786577); this threshold does not use labels from the cached-prefix slide. Run nearest-reference retrieval and abstain below the threshold. This is a post-hoc development stress test with a different gallery size than the calibration galleries, not a locked independent benchmark. [Inspect all 61 comparisons](/results/r14/prefix/) and [download results](/results/r14/prefix/abstention-results.json).

Of 59 images whose genus is absent from the gallery, the gate abstained on 42 and accepted 17, necessarily suggesting a different genus. Of two images whose genus was represented, one was rejected and one accepted an incorrect genus. Those figures are conditional on this one nonrandom slide prefix, unverified public metadata, three candidate genera and the selected threshold. They are not expected false-naming rates for Academy slides, and the 61 cutouts are not independent biological samples. Gallery size changed between earlier threshold tuning and this test, which affects nearest-neighbor scores. A broader multi-sample open-set test with expert-checked local images remains necessary. The observed false accepts reinforce that a single similarity threshold is not a sufficient basis for autonomous taxonomic identification.

Reproduce the cache extraction with `python3 research/r14_local_archive_probe.py` using the recorded temporary ZIP prefix and metadata, and the inference with `/tmp/diatom-research-venv/bin/python research/r14_prefix_abstention.py` and the existing ResNet checkpoint. The extraction script checks every complete member's ZIP CRC and records SHA-256; it never treats the incomplete tail as an image.

## Rotation pooling and abstention · 2026-12-01

Compare the original representation above with a rotation-pooled representation: embed each cutout at 0°, 90°, 180° and 270°, normalize each feature, average the four, and normalize again. Apply the same representation to gallery and query. For each representation separately, repeat the earlier nested six-slide threshold selection using only the original 18 reference images, and use the median of the six thresholds on the 61 cached-slide queries. This reproduces the earlier original threshold and accept/reject decisions exactly. Pooling uses a different calibrated threshold (0.8425 versus 0.7866) because its similarity scale differs. [Inspect every paired decision](/results/r14/prefix/rotation-abstention.html); [download scores and thresholds](/results/r14/prefix/rotation-abstention.json).

Each method accepted 17 of 59 queries whose genus was absent, but not the same 17: pooling rejected six previously accepted unknowns and accepted six previously rejected unknowns. It changed the nearest individual reference for 26 of all 61 queries. Both methods accepted one of two known-genus images, and that accepted suggestion was wrong. One source slide, a nonrandom archive prefix, three gallery genera, two known-genus queries and small calibration data are far too limited to establish comparative unknown rejection rates. The queried slide and these comparisons are development data; choosing a method based on them would require a fresh sample-separated evaluation. A rotation-invariant representation is not a substitute for an independently calibrated unknown class and expert review.

Reproduce with `/tmp/diatom-research-venv/bin/python research/r14_rotation_abstention.py`; it needs the R7 gallery, R14 prefix, prior thresholds and temporary ResNet weights.
