Visual Anomaly Detection for Manufacturing: From SOTA Model to Clarifai Solutions

Visual Anomaly Detection: Opportunities and Challenges 

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.


Clarifai’s Anomaly Detection and Visual Inspection Solutions


Clarifai is pleased to announce pre-GA product offering of PatchCore-based visual anomaly detection model, as part of our visual inspection solution package for manufacturing which also consists of various purpose-built visual detection and segmentation models, custom workflows and reference application templates.


Users only need a few hundred images of normal examples for training, and ~10 anomalous examples for each category for calibration & testing only, especially with more homogeneous background and more focused region-of-interest.


Benefit of Clarifai:

  • Industry leader of computer vision and AI technology

  • Extensible and flexible workflows : A single model is often not enough - Clarifai’s easy-to-use, drag-n-drop workflow editor allows non ML experts to combine detection, classification, and segmentation models for simultaneous inference.

  • Highly scalable deployment: High performance, fully managed inference serving to rapidly deploy models into production at scale with zero DevOps needed. Battle-hardened endpoints to handle massive autoscaling while meeting most stringent throughput and latency requirements in large scale manufacturing industry.

  • Run on edge or on-premises: Manufacturers can run models at the network edge with Clarifai’s edge AI platform - Platform-Lite optimized for edge inference, or on-premise with the full end-to-end platform including labeling, training, search and inference.

Explore Clarifai Community!

Explore 1000s of pre-trained models from Clarifai and other leading AI builders. Build, share and reuse models and workflows with other community members.

Start browsing today