# R36 · Within-genus public adaptation pilot

## Validation complete; needs review · 2026-12-01

**Question.** Can a small set of labeled microscopy crops improve the ability to distinguish visually similar species within a genus? The initial frozen four-species proposal selected one species in each of four different genera. That design could not distinguish genus recognition from species discrimination. After retrieving 56 of its 96 images and before running a model, the download was intentionally stopped; the first frozen selection and partial files remain under `results/pilot/ude-adaptation/`, with no completed download report or model results.

The revised fixed design chooses **Achnanthidium minutissimum**, **Achnanthidium jackii**, **Navicula gregaria** and **Navicula lanceolata** from UDE metadata. It excludes every filename-derived source slide in the earlier selection and prior R7/R14 examples. It randomly selects 12 eligible source-slide identifiers with fixed seed 20261202; two cutouts per species per selected group yield 64 training, 16 validation and 16 test images. Selection was written before the images or model outputs were examined. [See the fixed selection](/results/pilot/ude-adaptation-within-genus/selection.json). Download uses bounded ZIP ranges and verifies ZIP CRCs; a final SHA-256 report must be complete and show no exact image duplicates across splits before modeling.

**Scope and risks.** Filename-derived slide groups are not proven independent biological samples; labels are dataset metadata, not Academy expert adjudication; repeated images from one slide are correlated. Requiring each slide to contain all four species and selecting crops with a limited size is a deliberately balanced, nonrandom subset. It omits unknown taxa, partial/overlapping field detection and the Academy's image domain. This is a development pilot, not evidence for the 95% genus or 60% species goals. The two held-out test slide groups were preserved until the training/validation procedure was fixed; the subsequent one-time test is reported below.

**Planned fixed validation.** Fit four simple class centroids using training crops only, one set from generic ResNet-18 embeddings and one from DIAMORPH specialist embeddings; compare them with the original 549-code DIAMORPH classifier on the same validation crops. The centroids force a choice among four classes and do not support unknown rejection. No model is trained or evaluated until all 96 files pass integrity checks. These small validation results may help decide whether further sample-separated adaptation is worth investigating, but cannot demonstrate generalization.

Reproduce the fixed selection with `diatom_pilot/select_ude_adaptation.py --design within-genus` after preserving the existing selection and restoring the UDE metadata, then retrieve it using `diatom_pilot/fetch_ude_adaptation.py --selection results/pilot/ude-adaptation-within-genus/selection.json` with network access. The dataset is [UDE DIATOMS in the Wild 2024](https://doi.org/10.5281/zenodo.10410655), CC0; model provenance is in R7 and R28. All 96 images passed archive CRC and SHA-256 checks; no exact image duplicates crossed splits. The source groups still need independent biological provenance verification.

## Validation results

The frozen selection was completed before model inference. Training used 64 images from eight filename-derived slide groups. The following scores use 16 images from two other groups, with four examples of each of the four species. All counts compare exact strings against UDE metadata. At the time of validation, the final 16 images from two additional slide groups had not been used for feature extraction, fitting, model selection, or scoring. They were subsequently evaluated once under the frozen protocol below.

| Method | Genus correct | Species correct | Prediction vocabulary |
| --- | ---: | ---: | --- |
| Generic ResNet-18 feature centroids | 15/16 | 15/16 | Four study species |
| DIAMORPH feature centroids | 16/16 | 13/16 | Four study species |
| Unadapted DIAMORPH, restricted scores | 9/16 | 9/16 | Four study species |
| Unadapted DIAMORPH | 3/16 | 2/16 | All 549 model codes |

Centroids average normalized features by labeled training species; they do not fine-tune model weights. The restricted baseline makes the closed-set vocabulary comparison fairer, but the unrestricted classifier can choose hundreds of other names, so its task differs. The small sample and two correlated validation groups make these numbers highly uncertain; the selected groups each contain every study species and are not representative of Academy slides. Confusion with out-of-set taxa and performance on overlapping, partial, or automatically detected specimens remain unmeasured. The names and labels need expert scrutiny, and source-slide differences have not established independent biological samples.

The [visual results](/results/pilot/ude-adaptation-within-genus/) include example crops and model outputs. [Validation predictions](/results/pilot/ude-adaptation-within-genus/centroid-pilot/validation.json) and [fitted prototypes](/results/pilot/ude-adaptation-within-genus/centroid-pilot/prototypes.npz) are available for inspection. Before opening the test split, record a decision rule and a fixed evaluation protocol based only on the development data; then assess the untouched slide groups once and pursue genuinely independent expert-reviewed Academy specimens. Run `/tmp/diatom-research-venv/bin/python diatom_pilot/ude_centroid_pilot.py` with the documented model files to reproduce the development comparison.

## Frozen held-out public test · 2026-12-01

The generic ResNet-18 centroid was selected before test inference because it had the highest exact species count in the fixed validation comparison. The [frozen protocol](/results/pilot/ude-adaptation-within-genus/heldout-protocol.json) records the selection, model and image-manifest hashes, and the closed-set evaluation rule. The two held-out slide groups were then scored once: **16/16 genus and 10/16 species exact matches**, versus 15/16 species on the two validation groups. [View all 16 crops and predictions](/results/pilot/ude-adaptation-within-genus/heldout.html) or inspect [the recorded predictions](/results/pilot/ude-adaptation-within-genus/heldout-generic.json).

The small validation/test difference is a warning about generalization, not a reliable estimate of a change in performance: each set has only two filename-derived slide groups, groups need not represent independent samples, the four taxa were deliberately balanced, and the model was forced to choose one known taxon. This test has now been consumed; do not select further adaptations against it. No localization, overlaps, partials, unknown taxa, or Academy specimens were evaluated. The next evaluation needs a fresh sample-separated public cohort or expert-reviewed Academy fields.
