What Remains Normal? Clean Images Miss Useful Near-Defect Normal Patches for Anomaly Detection
Organizations: Institute of Biopharmaceutical and Health Engineering, Tsinghua Shenzhen International Graduate School, Tsinghua University, Shenzhen, China · RatelSoft · Guangdong Provincial Laboratory of Traditional Chinese Medicine, Hengqin, Guangdong, China
Abstract
Normal-only industrial anomaly detectors use patches from clean training images as normal references or reconstruction targets. This assumes that clean patches are sufficient for the normal regions encountered at test time. We test that assumption directly. On MVTec AD, admitting ground-truth-normal patches from real defect images to a DINOv2 memory candidate pool raises pixel average precision (P-AP) from 73.34 to 76.95 while keeping the encoder, test-time score, and number of stored references fixed. Patches within two patch cells of the annotated defect recover 94.70% of this gain. We then ask whether useful patches of this kind can be exposed using clean training images alone. BoundarySupport inserts a procedural synthetic defect to alter surrounding context, excludes every token intersecting the nominal insertion or a detected RGB change, and learns only from pixel-preserved neighboring patches. Across three paired seeds, the same principle improves P-AP in all six memory and reconstruction settings across MVTec, VisA, and Real-IAD. Matched controls identify the altered-context feature itself as the useful normal evidence: with synthetic input or selected positions fixed, altered-context features outperform their clean-view counterparts as both reconstruction targets and memory references. On MVTec memory, the final score change is also spatially selective, with larger reductions on normal patches next to defects than on mid-distance or far-normal patches in all 15 categories. Code is publicly available at https://github.com/jw-chae/boundary_support.
Figures & tables
| Branch | Dataset | I-AUROC | P-AUROC | P-AP | P-F1 | AUPRO |
|---|---|---|---|---|---|---|
| Memory | MVTec | |||||
| Memory | VisA | |||||
| Memory | Real-IAD | |||||
| Recon. | MVTec | |||||
| Recon. | VisA | |||||
| Recon. | Real-IAD |
| Branch | Dataset | Clean-view target/reference | Altered-context target/reference | Altered clean | Wins |
|---|---|---|---|---|---|
| Reconstruction | MVTec | 61.82 | 73.89 | +12.07 | 15/15 |
| Reconstruction | VisA | 44.34 | 52.79 | +8.45 | 11/12 |
| Memory | MVTec | 73.36 | 75.60 | +2.23 | 15/15 |
| Memory | VisA | 52.28 | 54.11 | +1.84 | 11/12 |
| Spatial cohort | Mean |
|---|---|
| Defect patches | |
| Near-defect normal ( ) | |
| Mid-distance normal ( ) | |
| Far normal ( ) | |
| Clean-image normal |
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Categories | Memory ratio | Memory seeds | Reconstruction seeds |
|---|---|---|---|---|
| MVTec AD | 15 | 5% | 0,1,2 | 0,1,2 |
| VisA | 12 | 5% | 0,1,2 | 0,1,2 |
| Real-IAD | 30 | 1% | 0,1,2 | 0,1,2 |
| Candidate pool | I-AUROC | P-AUROC | P-AP | AUPRO | Rel. bank size |
|---|---|---|---|---|---|
| Clean candidates (matched eval.) | 99.76 | 98.80 | 73.34 | 96.18 | 1.00 |
| Clean + GT-normal, expanded | 99.71 | 98.94 | 76.96 | 96.64 | 1.05 |
| Clean + GT-normal, fixed budget | 99.71 | 98.94 | 76.95 | 96.64 | 1.00 |
| Category | Clean (matched eval.) | Expanded GT-normal | Fixed-budget GT-normal | Near-defect GT-normal |
|---|---|---|---|---|
| bottle | 89.02 | 90.29 | 90.30 | 90.21 |
| cable | 76.70 | 77.36 | 77.32 | 77.34 |
| capsule | 64.40 | 63.87 | 63.88 | 63.47 |
| carpet | 80.07 | 84.04 | 84.05 | 83.99 |
| grid | 63.74 | 66.38 | 66.45 | 66.26 |
| hazelnut | 81.64 | 84.70 | 84.62 | 84.67 |
| Category | Clean | Fixed-budget GT-normal | Near | Mid | Far |
|---|---|---|---|---|---|
| leather | 61.97 | 77.55 | 78.26 | 68.22 | 62.52 |
| tile | 76.69 | 89.76 | 90.02 | 78.83 | 77.36 |
| Category | Clean | Fixed-budget GT-normal | Inpainted-defect GT-normal |
|---|---|---|---|
| leather | 61.97 | 77.55 | 73.69 |
| tile | 76.69 | 89.76 | 82.80 |
| Source evaluation defects | Clean | Cross-defect GT-normal | P-AP |
|---|---|---|---|
| leather: cut color/fold/glue/poke | 64.65 | 72.35 | +7.69 |
| tile: crack other types | 90.65 | 91.44 | +0.79 |
| tile: glue-strip other types | 73.98 | 75.44 | +1.46 |
| Category | Candidate near | Selected near | Enrichment | Selected anchors |
|---|---|---|---|---|
| leather | 0.23% | 2.68% | 11.73 | 258 / 9,604 |
| tile | 0.70% | 3.44% | 4.95 | 310 / 9,016 |
| Category | Memory | Good normal q95 | Defect-image normal q95 | q99 | Defect mean |
|---|---|---|---|---|---|
| leather | Clean | 0.40 | 0.48 | 0.61 | 0.65 |
| leather | Fixed-budget GT-normal | 0.40 | 0.44 | 0.53 | 0.60 |
| tile | Clean | 0.45 | 0.55 | 0.66 | 0.62 |
| tile | Fixed-budget GT-normal | 0.45 | 0.51 | 0.60 | 0.61 |
| Branch | Dataset | Variant | I-AUROC | I-AP | I-F1 | P-AUROC | P-AP | P-F1 | AUPRO |
|---|---|---|---|---|---|---|---|---|---|
| Memory | MVTec | Baseline | 99.76 | 99.91 | 99.38 | 98.80 | 73.34 | 71.04 | 96.18 |
| Memory | MVTec | BoundarySupport | 99.73 | 99.90 | 99.31 | 98.86 | 75.60 | 72.33 | 96.39 |
| Memory | VisA | Baseline | 99.17 | 99.28 | 97.50 | 99.08 | 52.23 | 54.71 | 97.06 |
| Memory | VisA | BoundarySupport | 99.19 | 99.30 | 97.54 | 99.07 | 54.05 | 55.75 | 97.03 |
| Memory | Real-IAD | Baseline | 94.89 | 94.33 | 89.00 | 99.17 | 52.02 | 53.11 | 97.60 |
| Memory | Real-IAD | BoundarySupport | 94.79 | 94.11 | 88.76 | 99.16 | 53.78 | 54.42 | 97.54 |
| Branch | Dataset | Baseline | BoundarySupport | Paired | Positive pairs |
|---|---|---|---|---|---|
| Memory | MVTec | 45/45 | |||
| Memory | VisA | 36/36 | |||
| Memory | Real-IAD | 90/90 | |||
| Recon. | MVTec | 45/45 | |||
| Recon. | VisA | 29/36 | |||
| Recon. | Real-IAD | 84/90 |
| Dataset | Clean-view target | Altered-context target | Altered clean | Category wins |
|---|---|---|---|---|
| MVTec | 61.82 | 73.89 | +12.07 | 15/15 |
| VisA | 44.34 | 52.79 | +8.45 | 11/12 |
| Dataset | Clean-view feature | Altered-context feature | P-AP | Category wins |
|---|---|---|---|---|
| MVTec | 73.36 | 75.60 | +2.23 | 15/15 |
| VisA | 52.28 | 54.11 | +1.84 | 11/12 |
| Spatial cohort | Mean |
|---|---|
| Defect patches | -0.61 |
| Near-defect normal | -0.37 |
| Mid-distance normal | +0.11 |
| Far normal | +0.19 |
| Clean-image normal | +0.21 |
| Dataset | Supervised object | I-AUROC | I-AP | I-F1 | P-AUROC | P-AP | P-F1 | AUPRO | P-AP wins |
|---|---|---|---|---|---|---|---|---|---|
| MVTec | Pixel-preserved surrounding patch | -0.07 | -0.05 | -0.18 | +0.18 | +4.94 | +3.10 | +0.51 | 15/15 |
| MVTec | Corresponding clean-view patch | -0.02 | 0.00 | +0.04 | -0.01 | -0.26 | -0.15 | -0.01 | 7/15 |
| MVTec | Patch outside nominal mask | -0.23 | -0.20 | -0.71 | -0.03 | +0.70 | +0.99 | -0.09 | 8/15 |
| MVTec | Synthetic core | -2.11 | -1.44 | -0.75 | -20.86 | -52.28 | -45.18 | -49.13 | 0/15 |
| VisA | Pixel-preserved surrounding patch | +0.06 | +0.08 | -0.11 | -0.17 | +2.09 | +0.92 | +0.05 | 9/12 |
| VisA | Corresponding clean-view patch | -0.27 | -0.32 | -0.65 | -0.07 | -0.30 | -0.16 | -0.28 | 4/12 |
| Setting | I-AUROC | I-AP | I-F1 | P-AUROC | P-AP | P-F1 | AUPRO |
|---|---|---|---|---|---|---|---|
| Three interventions, , | +0.01 | +0.01 | -0.21 | +0.23 | +6.99 | +4.18 | +0.80 |
| Scar only | +0.01 | +0.01 | -0.04 | +0.26 | +8.29 | +4.58 | +0.80 |
| Poisson paste only | +0.12 | +0.07 | +0.40 | +0.18 | +4.45 | +2.93 | +1.09 |
| Local warp + paste only | +0.04 | +0.02 | +0.05 | +0.15 | +4.60 | +2.85 | +0.70 |
| +0.05 | +0.03 | -0.04 | +0.25 | +7.55 | +4.31 | +0.99 | |
| 0.00 | -0.01 | -0.04 | +0.23 | +6.91 | +4.11 | +1.21 |
| Category | I-AUROC | I-AP | I-F1 | P-AUROC | P-AP | P-F1 | AUPRO |
|---|---|---|---|---|---|---|---|
| bottle | 100.00 100.00 | 100.00 100.00 | 100.00 100.00 | 99.20 99.26 | 89.02 90.79 | 82.61 83.12 | 97.33 97.54 |
| cable | 99.81 99.78 | 99.86 99.85 | 98.14 98.14 | 98.66 98.66 | 76.70 77.68 | 72.22 72.54 | 95.66 95.71 |
| capsule | 98.75 98.75 | 99.67 99.67 | 98.48 98.48 | 98.98 98.99 | 64.40 65.03 | 61.17 61.53 | 96.66 96.70 |
| carpet | 100.00 100.00 | 100.00 100.00 | 100.00 100.00 | 99.58 99.61 | 80.07 81.90 | 76.78 77.68 | 98.61 98.70 |
| grid | 100.00 100.00 | 100.00 100.00 | 100.00 100.00 | 99.63 99.67 | 63.74 67.48 | 61.84 64.04 | 98.78 98.91 |
| hazelnut | 100.00 100.00 | 100.00 100.00 | 100.00 100.00 | 99.57 99.59 | 81.64 82.75 | 77.43 78.43 | 98.56 98.65 |
| Category | Baseline P-AP | Uniform P-AP |
|---|---|---|
| candle | 46.04 | +0.33 |
| capsules | 68.93 | +1.14 |
| cashew | 69.10 | +2.75 |
| chewinggum | 73.90 | +6.19 |
| fryum | 46.32 | +0.42 |
| macaroni1 | 27.64 | +2.47 |
| Category | I-AUROC | I-AP | I-F1 | P-AUROC | P-AP | P-F1 | AUPRO |
|---|---|---|---|---|---|---|---|
| audiojack | 96.51 96.62 | 94.91 95.00 | 87.75 87.44 | 99.83 99.84 | 60.97 68.74 | 61.49 64.60 | 99.44 99.46 |
| bottle_cap | 96.27 96.29 | 96.54 96.61 | 90.62 90.91 | 99.64 99.60 | 35.04 36.86 | 38.59 40.24 | 98.80 98.68 |
| button_battery | 91.70 91.29 | 93.99 93.77 | 87.81 87.84 | 99.62 99.62 | 70.06 70.51 | 66.73 67.07 | 98.73 98.75 |
| end_cap | 91.12 90.72 | 90.85 90.58 | 88.39 88.01 | 99.38 99.34 | 14.10 14.77 | 26.00 26.64 | 98.01 97.86 |
| eraser | 95.25 95.14 | 94.39 94.32 | 86.46 86.05 | 99.79 99.79 | 49.00 50.48 | 51.47 52.09 | 99.30 99.31 |
| fire_hood | 96.09 95.72 | 92.27 91.51 | 87.28 86.55 | 99.66 99.63 | 51.23 52.77 | 51.29 51.81 | 98.88 98.81 |
| Category | I-AUROC | I-AP | I-F1 | P-AUROC | P-AP | P-F1 | AUPRO |
|---|---|---|---|---|---|---|---|
| bottle | 100.00 100.00 | 100.00 100.00 | 100.00 100.00 | 99.14 99.19 | 88.88 91.02 | 83.43 84.20 | 97.16 97.59 |
| cable | 99.94 100.00 | 99.97 100.00 | 99.46 100.00 | 98.25 98.28 | 76.09 77.57 | 73.70 74.75 | 93.67 93.30 |
| capsule | 98.96 98.44 | 99.77 99.65 | 99.08 99.08 | 98.68 98.59 | 60.32 61.60 | 58.54 59.16 | 97.74 97.30 |
| carpet | 99.96 99.84 | 99.99 99.95 | 99.44 99.44 | 99.34 99.42 | 68.56 74.44 | 71.60 75.10 | 97.36 97.96 |
| grid | 99.92 99.92 | 99.97 99.97 | 99.13 99.13 | 99.44 99.55 | 57.34 65.98 | 59.84 64.83 | 97.52 97.89 |
| hazelnut | 100.00 100.00 | 100.00 100.00 | 100.00 100.00 | 99.46 99.57 | 82.44 85.67 | 77.52 80.50 | 96.63 97.50 |
| Category | I-AUROC | I-AP | I-F1 | P-AUROC | P-AP | P-F1 | AUPRO |
|---|---|---|---|---|---|---|---|
| candle | 98.14 98.11 | 98.20 98.13 | 93.53 93.60 | 99.43 99.41 | 43.30 43.60 | 48.85 50.79 | 95.50 95.00 |
| capsules | 98.28 98.83 | 98.83 99.19 | 97.03 97.51 | 99.60 99.61 | 64.05 67.34 | 63.54 64.32 | 97.60 98.29 |
| cashew | 98.48 98.48 | 99.36 99.35 | 97.49 96.48 | 97.91 96.36 | 64.18 61.39 | 62.17 61.15 | 94.81 93.57 |
| chewinggum | 99.86 99.86 | 99.93 99.93 | 99.00 98.52 | 99.28 99.20 | 64.59 75.91 | 66.86 70.49 | 90.79 89.38 |
| fryum | 99.42 99.36 | 99.71 99.69 | 97.54 97.51 | 96.57 96.15 | 48.57 47.31 | 52.05 50.61 | 93.26 93.58 |
| macaroni1 | 98.45 98.62 | 98.38 98.54 | 94.74 95.57 | 99.69 99.71 | 33.49 37.50 | 39.81 41.72 | 97.09 97.37 |
| Category | I-AUROC | I-AP | I-F1 | P-AUROC | P-AP | P-F1 | AUPRO |
|---|---|---|---|---|---|---|---|
| audiojack | 94.22 93.78 | 91.73 91.35 | 82.38 80.92 | 99.81 99.82 | 62.21 66.55 | 61.46 64.26 | 98.16 98.31 |
| bottle_cap | 95.78 95.49 | 95.75 95.34 | 88.93 87.78 | 99.56 99.57 | 34.92 38.60 | 38.69 41.58 | 97.14 96.95 |
| button_battery | 90.96 89.80 | 92.74 92.19 | 87.23 86.29 | 99.50 99.54 | 54.89 62.53 | 65.91 67.10 | 96.58 96.36 |
| end_cap | 87.06 84.72 | 87.12 84.88 | 85.65 84.36 | 99.29 99.28 | 17.66 17.46 | 26.22 26.72 | 96.86 97.17 |
| eraser | 93.78 93.72 | 93.00 92.74 | 85.28 84.72 | 99.78 99.82 | 51.88 58.67 | 53.61 58.13 | 98.05 98.23 |
| fire_hood | 95.96 94.89 | 92.61 89.27 | 87.32 84.59 | 99.77 99.78 | 57.42 63.05 | 58.13 59.93 | 98.09 97.88 |
| Dataset | normal q95 | normal q99 | defect mean | P-AP |
|---|---|---|---|---|
| MVTec | -1.91 | -4.91 | -4.01 | +4.94 |
| VisA | -0.28 | -0.88 | -1.29 | +2.09 |
| Real-IAD | -0.32 | -1.13 | -2.49 | +4.20 |
| Dataset | Abs. q95 | Abs. q99 | Excess q95 | Excess q99 | Defect mean | P-AP |
|---|---|---|---|---|---|---|
| MVTec | -0.35 | -1.02 | -0.51 | -1.14 | -0.51 | +2.26 |
| VisA | +0.30 | -0.43 | -0.33 | -0.92 | -0.52 | +1.82 |
| Real-IAD | +0.55 | +0.09 | -0.11 | -0.48 | -0.21 | +1.76 |
| Case | Observed change |
|---|---|
| Reconstruction / VisA / cashew | P-AP -2.79; P-AUROC -1.56; q99 -0.74; defect mean -1.79. |
| Reconstruction / VisA / pcb3 | P-AP -2.42; AUPRO -0.78. |
| Reconstruction / VisA / fryum | P-AP -1.26; AUPRO +0.32. |
| Reconstruction / Real-IAD / rolled strip base | P-AP -2.92 while P-AUROC and AUPRO increase slightly. |
| Reconstruction / Real-IAD / end cap | P-AP -0.20; I-AUROC -2.33. |
| Memory / Real-IAD / u block | P-AP +3.32 while absolute q95 and q99 increase. |
| Dataset | Baseline hours | BoundarySupport hours | Ratio |
|---|---|---|---|
| MVTec | 5.81 | 15.17 | 2.61 |
| VisA | 4.99 | 12.71 | 2.55 |
| Real-IAD | 12.60 | 31.21 | 2.48 |