What Memory Composition Does Not Tell Us About 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
Memory-based anomaly detectors store nominal training patches and score test patches against this memory. A patch selected for coverage therefore becomes a nor- mal reference without a separate check that geometric rarity makes it safe to trust. We probe this coupling with sparse training contamination. Under fixed representa- tions and memory budgets, we compare random, medoid, local, and global coverage selectors. We then use CLEANCON, an out-of-bag cross-image support gate that changes candidate-image eligibility while fixing the representation, absolute mem- ory size, builder, and inference rule. Global coverage strongly over-represents sparse contamination. CLEANCON reduces final-memory contamination to approx- imately zero and increases category-macro P-AP in all 12 matched comparisons. Yet along a retention sweep, the lowest-contamination memory does not attain the highest P-AP; performance continues to improve while contamination rises. Mem- ory contamination therefore does not order the resulting memories by P-AP
Figures & tables
| Setting | Vanilla | CleanCon | Vanilla P-AP | CleanCon P-AP | P-AP |
|---|---|---|---|---|---|
| MVTec–WRN50 | |||||
| MVTec–DINOv2 | |||||
| VisA–WRN50 | |||||
| VisA–DINOv2 |
| Setting | R50 | R60 | R70 | R80 | R90 |
|---|---|---|---|---|---|
| MVTec–WRN50 | |||||
| MVTec–DINOv2 | |||||
| VisA–WRN50 | |||||
| VisA–DINOv2 |
| Dataset | Method | Mixed-train contamination | I-AUROC | P-AUROC | P-AP | AUPRO |
|---|---|---|---|---|---|---|
| MVTec | InReaCh | 92.32 | 97.01 | – | – | |
| SoftPatch | 98.40 | 98.17 | – | – | ||
| FUN-AD | 98.45 | 98.43 | – | – | ||
| CleanCon –WRN50 | 97.539 | – | 61.016 | 93.539 | ||
| CleanCon –DINOv2 | 99.147 | – | 72.255 | 95.770 | ||
| VisA | InReaCh | 83.66 | 97.67 | – | – |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | |||||
|---|---|---|---|---|---|
| MVTec–WRN50 | |||||
| VisA–WRN50 | |||||
| MVTec–DINOv2 | |||||
| VisA–DINOv2 |
| Setting | Selected | |||||
|---|---|---|---|---|---|---|
| MVTec–WRN50 | 2,996,448 | 12,586 | 29,958 | 2,065 | 16.41 | 16.41% |
| VisA–WRN50 | 7,146,944 | 7,210 | 71,464 | 2,247 | 31.17 | 31.17% |
| MVTec–DINOv2 | 11,985,792 | 51,036 | 119,832 | 12,160 | 23.83 | 23.83% |
| VisA–DINOv2 | 28,587,776 | 25,356 | 285,856 | 11,048 | 43.57 | 43.57% |
| Selector | MV–WRN | VisA–WRN | MV–DINO | VisA–DINO |
|---|---|---|---|---|
| Patch random | ||||
| Image-balanced random | ||||
| SimHash | 1.67 | 1.73 | 0.92 | 0.98 |
| Density top- | 0.00 | 0.00 | 0.11 | 0.01 |
| Sampled -means medoid | 1.34 | 1.44 | 1.08 | 1.05 |
| Voronoi landmark mass | 0.41 | 0.33 | 0.30 | 0.29 |
| Setting | ||||
|---|---|---|---|---|
| MVTec–WRN50 | 32.02% | 95 | 2,065 | 4.60% |
| VisA–WRN50 | 24.98% | 142 | 2,247 | 6.32% |
| MVTec–DINOv2 | 20.36% | 70 | 12,160 | 0.58% |
| VisA–DINOv2 | 26.92% | 92 | 11,048 | 0.83% |
| Setting | I-AUROC | P-AUROC | P-AP | AUPRO |
|---|---|---|---|---|
| MVTec–WRN50 | (3/3) | (3/3) | (3/3) | (3/3) |
| MVTec–DINOv2 | (3/3) | (3/3) | (3/3) | (3/3) |
| VisA–WRN50 | (3/3) | (2/3) | (3/3) | (3/3) |
| VisA–DINOv2 | (2/3) | (2/3) | (3/3) | (2/3) |
| Candidate rule | Selection unit | Experimental scope | Result |
|---|---|---|---|
| OOB-NN patch ranking | patch | six-category auxiliary experiment | lower local ranking and P-AP than projection-residual patch ranking |
| Projection-residual patch ranking | patch | six-category auxiliary experiment | P-AP over OOB-NN, relative to whole-image gating |
| Oracle normal-region selection | patch | ground-truth mask setting | removes anomalous regions and retains only normal regions as candidates |
| Normal-source expansion | image + patch | 15 MVTec categories, three No-Overlap folds | P-AP and AUPRO relative to whole-image gating |
| Adaptive image retention | image | Exact-Final, seed 0 | P-AP at and at relative to whole-image gating |
| Mixed-train contamination | Builder | I-AUROC | P-AP | AUPRO | |
|---|---|---|---|---|---|
| Global FF | 99.641 | 72.848 | 95.976 | ||
| risk-aware | 99.596 | 72.814 | 95.974 | ||
| Global FF | 99.507 | 70.415 | 94.323 | ||
| risk-aware | 99.519 | 70.573 | 94.389 |
| Dataset | Backbone / ratio | SP-style | CleanCon | P-AP | ||||
|---|---|---|---|---|---|---|---|---|
| I-AUROC | P-AP | AUPRO | I-AUROC | P-AP | AUPRO | |||
| MVTec | WRN50 / 5% | 98.241 | 60.029 | 93.465 | 97.539 | 61.016 | 93.539 | +0.987 |
| MVTec | WRN50 / 10% | 98.025 | 60.013 | 92.971 | 97.762 | 60.691 | 93.827 | +0.679 |
| MVTec | DINOv2 / 5% | 98.880 | 70.570 | 95.440 | 99.147 | 72.255 | 95.770 | +1.686 |
| MVTec | DINOv2 / 10% | 98.856 | 68.890 | 94.814 | 99.316 | 72.052 | 96.063 | +3.162 |
| VisA | WRN50 / 5% | 92.810 | 41.495 | 93.735 | 92.596 | 40.061 | 93.693 | -1.434 |