Computer vision based visual defect inspection has wide applications in industrial manufacturing. The American Society for Quality estimates that for many organizations this cost of quality is as high as 15-20% of annual sales revenue, some going as high as 40% of total operations, or billions of dollars annually for larger manufacturers. However, there are several major challenges using AI for visual inspections in production-scale applications:
1. Cold-start problem: oftentimes only nominal (non-defective) examples are available for training, and anomalous examples, by definition, are very rare. We need the model to determine defects without having seen them, which is essentially an out-of-distribution detection problem .
2. Heterogeneous, sparse and sometimes unknown defect categories: anomalous patterns can range from macro-crack, thin scratch, to large areas of corrosion. Even if we have enough examples per class, it’s difficult to scale (especially on edge hardware) on simultaneous inference of many different tasks.
PatchCore – SOTA Visual Anomaly Detection Method
PatchCore, is currently state-of-the-art anomaly detection method which identifies anomalous images, or anomalous pixel regions as heatmaps in anomalous images. It achieves image-level anomaly detection AUROC score of up to 99.6%, more than halving the error compared to the next best competitor on the challenging, widely used MVTec AD benchmark data. The MVTec AD benchmark gives 15 different anomaly detection tasks, with the final performance as an average across all the tasks. For each of the 15 tasks PatchCore achieves over 90% AUROC with just five images of normal data.
PatchCore also offers competitive inference times while achieving solid performance for both detection performance and even spatial localization of the defects, which is critical for edge implementation on embedded systems.
[Roth et al. 2022 “Towards Total Recall in Industrial Anomaly Detection”]
How PatchCore Works
PatchCore is based on the idea that an image can be classified as anomalous as soon as a single patch is anomalous. It generates a maximally representative memory bank of nominal patch features from different locations. However the memory bank can become very large very quickly, and so subsampling is needed. One of the keys to PatchCore’s performance is classic statistical coreset subsampling technique rather than random subsampling – to trim the memory bank while retaining overall feature space coverage.
Test images are then compared to the feature sets in the trimmed memory bank. If the feature is significantly different from the ones in the memory bank, it’s likely to be a defect.This subset helps reduce the search cost associated with nearest neighbor search.