# L23 · Local-feature retrieval for partly hidden queries

## Same-slide development stress test · 2026-12-01

**Question.** Could matching local features from a partial query to portions of a whole reference work better than a single whole-image embedding? Reuse the 42 artificially half-hidden UDE queries and fixed five-reference, same-slide gallery from L22. This is a nonrandom, closed-set development set from one source-slide identifier; labels and sample independence are not independently adjudicated.

Use the same frozen ImageNet ResNet-18, not DINOv3 and not a diatom-trained model. Its last convolutional layer produces a 7 × 7 feature map. Rank the corresponding 32 × 32 input-grid cells by gray-level standard deviation and keep 12 positions in each image. For each selected query vector, find the highest cosine similarity among selected reference vectors, then average those maxima. Rank the five references by that score. This is a crude texture heuristic: a cell can be background, debris, an artificial edge or another object, and deep features have large receptive fields that extend well beyond the corresponding input cell. Several query vectors may match the same reference vector. No target labels or masks select patches at inference. A reverse-direction control is stored for R24.

For half A, the previously computed global-embedding method had 17/42 top-neighbor genus matches and the query-to-reference patch score had 21/42. For half B the counts were 19/42 and 16/42 respectively. [Inspect the query halves and suggestions](/results/l23/) and [download the rankings](/results/l23/patch-retrieval.json). The different outcomes do not establish a consistent improvement. No threshold, unknown-taxon rejection or detection stage was tested. With only five known genera, each method must always return a reference, even when evidence is missing.

**Limits.** The two halves are paired synthetic gray edits, not actual partial frustules. The cutout rectangles are not target masks and hidden pixels can include background or multiple specimens. The gallery and queries all come from one public source slide and can share preparation or nuisance patterns. Cases were already used for other development and rule choices. These numbers are not Academy classification accuracy or an independent comparison. Confirm diagnostic structures with an expert, include an abstention option and evaluate on untouched sample-separated real partials and crossings before pursuing a learned local-feature method. Reproduce with `/tmp/diatom-research-venv/bin/python research/l23_patch_retrieval.py` after L22, its UDE cutouts and `/tmp/resnet18-f37072fd.pth` are available.
