# R29 · DIAMORPH input stability and preprocessing parity

## Six-crop diagnostic · 2026-12-01

The [R28](/research/R28.md) preview uses a species classifier trained on DIATLAS. On its same six already inspected, unlabeled Academy proposal crops, compare predictions for the original image with 90°, 180° and 270° rotations, and with a central gray stripe covering approximately one-quarter of the crop's long dimension. The stripe uses the image median and is a **synthetic edit**, not a physically realistic overlap or a verified partial valve. For quarter turns, swap the source X/Y calibrations before the same scale-normalizing preprocessor. Each result is a forced top-ranked class from the model, not a verified species identification.

At least one rotation changed the top **class code** for 5/6 crops and the top **genus** for 4/6 compared with each unrotated crop. The gray stripe changed the top class code for 4/6. For one crop the original top score was 0.461 and the striped image's different top class scored 0.854; another moved from 0.210 to 0.754 without changing its top class. Scores are closed-set model outputs, not calibrated correctness probabilities. A more confident prediction can follow loss of image content. [Inspect each crop and perturbation](/results/pilot/diamorph-robustness/) and [download all top outputs](/results/pilot/diamorph-robustness/robustness.json).

These six model-selected, overlapping or partial-looking crops have no expert truth. Changes do not establish which prediction is right or estimate the accuracy, stability or prevalence of failures on Academy material. The stripe can hide different physical structures, and no genuine occlusion is simulated. The preprocessing itself rotates/transposes crops, so transformations here test the **whole preview pipeline** rather than the underlying network in isolation. This is not an ablation of training augmentation or an evaluation of the 95% genus and 60% species goals.

## Author preprocessing check

Downloaded and inspected the author's [square-pad script](https://raw.githubusercontent.com/ai4os-hub/diamorph-classification/main/scripts/square-pad.py) at locally recorded SHA-256 `a8e26937eddbf006a255dcc8f2f0e72b9d74a5708156c815d28283758a952a49`. For each original R28 crop, run that script's function using the Academy X calibration as its single scalar, and compare its grayscale PNG pixel-by-pixel with our preview's grayscale output using independent X/Y calibrations. All six 512 × 512 images are pixel-identical. This is **parity on these six crops only**; the upstream function's scalar scale and our two-axis scaling can differ on other pixel geometries or sizes. Full parity of the remote service and model runtime was not tested. [Parity records](/results/pilot/diamorph-robustness/parity.json).

## Taxon code count

All 549 checkpoint class codes are distinct. In the DIATLAS code table, they map to 549 distinct species names and 549 distinct most-specific names when infra-species is preferred. The release text says 548 species classes, so the mismatch is **not explained by duplicate species names in this table**. It is not yet known why the release's stated count differs; avoid silently dropping a class or claiming the two lists match. Name variants, synonyms and Academy taxonomic conventions still need expert reconciliation.

**Next.** On an independent, sample-separated and expert-labeled set, compare fixed orientation preprocessing, augmentation or pooling, and partial-visibility handling; measure genus and species correctness, abstention, complete overlap groups and review effort. Use held-out validation for all method and threshold choices. Check whether taxonomic cues are present and whether a species is resolvable under the optics. Reproduce with `YOLO_CONFIG_DIR=/tmp/diatom-yolo-config MPLCONFIGDIR=/tmp/mpl-diatom /tmp/diatom-research-venv/bin/python diatom_pilot/diamorph_robustness.py`. For parity use `diatom_pilot/diamorph_parity.py --author-script /tmp/diamorph-source-square-pad.py`; it executes that external script after checking the recorded hash, so inspect and trust the source before running it.
