patchbank_score — SPC anomaly_patch op

• Data kinds: image2d × table → table

• Call: import fullseye as fs; fs.ledger.patchbank_score(image, model, k=1, smooth=4.0) (to call the implementation directly, import anomaly_patch; anomaly_patch.patchbank_score(image, model, k=1, smooth=4.0); from the registry, opsspc.get("patchbank_score"))

• GPU: none (CPU reference implementation only)

Usage

Score one image by the distance of each patch to its k nearest good patches in the bank (table).

model comes from patchbank_fit; image must have the training images' shape. The distance (Euclidean, in standardised feature space; the mean over the k nearest) is computed exactly by brute force, interpolated to the image size and smoothed by a Gaussian of smooth px. Returns map (H, W), grid (raw distances), image_score (maximum of the smoothed map), k and smooth.

Raises ValueError for a model that is not a patchbank_fit result, a different image shape, k larger than the bank, a negative / non-finite smooth, or an image on another pixel scale than the good images (integer vs float dtype, or values outside the training range widened by one training span on each side).

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• poc_ai_built_inspection_scored — py -3.11 examples/poc_ai_built_inspection_scored.py

• poc_patch_anomaly — py -3.11 examples/poc_patch_anomaly.py

Ops the type connects to (they accept table as input)

msa_anova_table · msa_gauge_rr · msa_bias_linearity · msa_attribute_agreement · gum_standard_uncertainty · gum_propagate · gum_expanded · gum_monte_carlo

Same category (anomaly_patch)

patch_features · patchdist_fit · patchdist_score · patchbank_fit


*Provenance: anomaly_patch.py — SPC operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.