Anomaly detection identifies patterns in data that deviate from what's expected: defective products on a manufacturing line, unusual structures in medical scans, or damaged infrastructure in inspection photos. The core challenge is that anomalies are rare and unpredictable, so collecting labeled examples of every possible defect type is not practical.
Most approaches train only on "normal" data and flag anything that deviates. Reconstruction-based methods (autoencoders, GANs) learn to reproduce normal images and measure the reconstruction error. High error signals an anomaly. Feature-based methods extract embeddings from a pretrained backbone (like ResNet or WideResNet) and model the distribution of normal features using Gaussian mixture models, k-NN distances, or memory banks. PatchCore stores a coreset of normal patch features and flags test patches that fall far from any stored example. Student-teacher methods (STPM, EfficientAD) train a student network to mimic a teacher's outputs on normal data; disagreements at test time indicate anomalies.
Industrial inspection is the largest use case, covering scratches, cracks, contamination, and assembly errors. Medical imaging uses similar techniques for finding tumors and unusual tissue patterns.


