Pushing the Limits of Fewshot Anomaly Detection in Industry Vision: Graphcore

Guoyang Xie, Jinbao Wang, Jiaqi Liu, Yaochu Jin, Feng Zheng

TL;DR

GraphCore pushes the boundaries of few-shot anomaly detection (FSAD) in industrial settings by introducing a Graph Neural Network (GNN) architecture that extracts rotation-invariant features. By treating image patches as nodes in a graph, the model achieves state-of-the-art accuracy with as few as one to eight training samples while significantly reducing the memory footprint and increasing inference speed.

The Challenge of Few-Shot Anomaly Detection

In modern manufacturing, production lines frequently undergo "changeovers" to switch from making one product to another. Traditional anomaly detection (AD) models require massive amounts of "normal" data to learn what a perfect product looks like. During a changeover, collecting this data is slow and expensive, leading to a "cold start" problem where the system is inaccurate just when it's needed most.

Comparison of anomaly detection paradigms

Current state-of-the-art methods, such as PatchCore, rely on "memory banks" of visual features extracted by Convolutional Neural Networks (CNNs). However, CNNs are notoriously sensitive to rotation. If a training image shows a screw at 0° and the test image shows it at 90°, the CNN sees them as different, leading to false positives. To compensate, these models often store massive, redundant memory banks, which slows down the system and severely degrades performance in few-shot (very low data) scenarios.

The GraphCore Method

To solve the rotation problem, the authors propose a novel approach centered around graph representations:

  1. Augmentation+PatchCore (Aug.(R)): As a baseline improvement, simply adding rotated versions of the few available training images to the memory bank significantly boosts performance.
  2. GraphCore: The primary contribution is replacing standard CNN feature extraction with a Vision Isometric Invariant GNN (VIIG).
  3. Graph Representation: An image is divided into patches. Each patch is treated as a node in a graph, and edges are drawn between a patch and its $K$ nearest neighbors in the feature space.
  4. Vision Isometric Invariant Features (VIIF): The GNN uses a max-relative graph convolution to aggregate features. Because the GNN treats these features as unordered nodes in a local neighborhood, it naturally learns features that are invariant to "isometries" (rotations, translations, and flips).
Extracting Vision Isometric Invariant Features

By leveraging rotation-invariant features, the model doesn't need to store multiple versions of the same structure at different angles. This allows for a much smaller, "cleaner" memory bank, directly addressing the redundancy issue.

Key Insights

  • Rotation is the "Aha!" Moment: The primary reason few-shot AD fails in industry is that industrial parts are rigid. Their "diversity" usually comes from the angle they were placed on the conveyor belt, not from shape deformation. Solving for rotation invariance effectively "multiplies" the value of a single training image.
  • GNNs over CNNs: While CNNs are the default for vision, GNNs are better suited for structural, non-serialized features. By treating an image as a graph of patches, the model captures the relationship between parts of an object without being tied to a specific grid orientation.
  • Redundancy is the Enemy: Standard methods fill memory banks with redundant features. GraphCore’s invariant features allow for a 25% to 40% reduction in memory bank size compared to PatchCore, while simultaneously improving accuracy.

Datasets and Results

The model was evaluated on three major industrial benchmarks: MVTec AD (the gold standard for industrial AD), MPDD (a challenging dataset with varying angles and backgrounds), and MVTec LOCO AD (designed for logical anomalies).

GraphCore significantly outperformed previous state-of-the-art methods across the board, especially in the most difficult "1-shot" (one training image) scenario:

  • MVTec AD: Increased average AUC by 5.8% (1-shot) and 1.6% (8-shot).
  • MPDD: Saw massive gains, increasing average AUC by 25.5% (1-shot) and 14.1% (8-shot).
  • Efficiency: In 1-shot tests, GraphCore reduced the memory bank size to 1.2M (vs. 1.6M for PatchCore) and improved inference speed to 0.0299s per image.

Qualitatively, the model produces much cleaner anomaly heatmaps, with far fewer false positives on the edges of rotated objects.

Limitations and Future Work

While GraphCore excels at "structural" anomalies (cracks, scratches, missing pieces), industrial datasets are increasingly focusing on "logical" anomalies (e.g., a box containing five screws instead of six). Although GraphCore was tested on MVTec LOCO, pushing the limits of logical anomaly detection in few-shot settings remains a frontier for future research. Additionally, the current method relies on a pre-trained backbone; exploring self-supervised graph pre-training specifically for industrial parts could further enhance results.

Summary updated

BibTeX
@inproceedings{xie2023pushing,
  author = {Guoyang Xie and Jinbao Wang and Jiaqi Liu and Yaochu Jin and Feng Zheng},
  title = {{Pushing the Limits of Fewshot Anomaly Detection in Industry Vision: Graphcore}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=xzmqxHdZAwO},
}
Figure