ISSTAD: Incremental Self-Supervised Learning Based on Transformer for Anomaly Detection and Localization

Wenping Jin, Fei Guo, Zhu LiarXiv 2023 · DOI

In the world of industrial manufacturing, spotting a tiny crack in a metal nut or a smudge on a pill can be the difference between a successful shipment and a costly recall. While deep learning has revolutionized this field, most tools rely on Convolutional Neural Networks (CNNs). A new paper titled ISSTAD suggests it’s time for a change of architecture, moving toward Transformers to achieve a more nuanced understanding of what constitutes a "defect."

TL;DR

ISSTAD introduces a two-stage incremental learning strategy using a Transformer-based Masked Autoencoder (MAE). By first learning the "essence of normal" and then training specifically to repair and classify pixel-level corruptions, the model achieves a state-of-the-art 97.6% AUC on the MVTec AD benchmark for anomaly detection and localization.

What Problem Does This Paper Address?

Anomaly detection (AD) is the "needle in a haystack" problem of computer vision. In industrial settings, you usually have plenty of images of "normal" products but very few examples of actual defects. Consequently, models must be trained in a self-supervised way—learning what is normal so they can flag anything that deviates.

Most current methods use CNNs. While effective, CNNs have a limited "receptive field," meaning they focus on local textures but can struggle with global context. Conversely, existing Transformer-based methods often work at the "patch level," which can be too coarse to pinpoint tiny, pixel-level scratches. The authors of ISSTAD set out to bridge this gap, creating a Transformer-based system that understands both the big picture and the individual pixel.

Methods

The core of ISSTAD is a Vision Transformer (ViT) backbone used within a two-stage incremental learning framework.

  1. Stage 1: Learning the Distribution. The authors start with a Masked Autoencoder (MAE). They take normal images, hide 75% of the patches, and task the model with reconstructing the missing parts. This forces the encoder to learn the underlying structural patterns of "normal" objects.
  2. Stage 2: Pixel-Level Refinement. This is where the "Incremental" part comes in. The encoder's parameters are frozen to preserve the knowledge of "normal." The model is then fed images with "pseudo-anomalies"—normal images corrupted with random noise, color shifts, or rotations.
  3. The Reconstruction Head (RCH) learns to "repair" these corrupted pixels back to their original state.
  4. The Pixel Classifier Head (PCH) learns to categorize every single pixel as either "normal" or "corrupted."

The Inference "Secret Sauce": During testing, the model generates two matrices: a reconstruction error matrix (how much did the repair fail?) and an anomaly probability matrix (how sure is the classifier that this pixel is weird?). By calculating the Hadamard product (element-wise multiplication) of these two, the model filters out noise and highlights true defects with high precision.

Datasets

The researchers evaluated ISSTAD on the MVTec AD dataset, the gold standard for industrial anomaly detection. It contains over 5,000 high-resolution images across 15 categories, ranging from "textures" (like leather and wood) to "objects" (like transistors and bottles). The dataset is challenging because training is done only on defect-free images.

Key Insights and Ideas

  • The Power of Freezing: A major "aha" moment in the paper is the decision to freeze the encoder in Stage 2. By doing this, the model maintains its strong "global" understanding of the object while the decoder focuses entirely on the "local" difficulty of repairing and identifying anomalies.
  • Reconstruction vs. Classification: The authors argue that neither method is perfect alone. Reconstruction error can be high on complex but normal textures (false positives), while classification might miss subtle structural shifts. Multiplying them acts as a logical "AND" gate, significantly cleaning up the final anomaly map.
  • Transformers > CNNs for Continuity: The results suggest Transformers are better at learning "continuous features" between pixels. This makes them more sensitive to the "discontinuities" caused by cracks or holes compared to the fixed-grid nature of CNNs.

Key Results

ISSTAD sets a new bar for performance:

  • Detection: It achieved a mean 97.6% AUC across all 15 MVTec categories, outperforming established CNN-based methods like CutPaste (96.1%) and P-SVDD (92.1%).
  • Localization: For pinpointing where the defect is, it reached 96.1% AUC, showing particular strength in categories like "Grid" and "Leather" where defects are often tiny or blend into the background.
  • Ablation Success: The study showed that skipping Stage 1 (the MAE pre-training) caused a massive performance drop, proving that a deep understanding of "normal" is a prerequisite for spotting the "abnormal."

Limitations and Future Work

While the results are impressive, the paper leaves a few stones unturned:

  • Computational Overhead: Transformers are generally more computationally expensive than CNNs. The paper doesn't deeply discuss the inference latency, which is a critical factor for high-speed assembly lines.
  • Pseudo-Anomaly Fidelity: The model’s performance in Stage 2 depends on how well the "corruptions" (noise, color shifts) mimic real-world defects. Future work could involve more sophisticated "synthetic defect" generation to better simulate complex failures like delamination or internal structural cracks.

In summary, ISSTAD demonstrates that by combining the global context of Transformers with a clever two-step training process, we can build inspection systems that are significantly more "perceptive" than their predecessors.

Summary updated

BibTeX
@misc{jin2023isstad,
  author = {Wenping Jin and Fei Guo and Zhu Li},
  title = {{ISSTAD: Incremental Self-Supervised Learning Based on Transformer for Anomaly Detection and Localization}},
  year = {2023},
  eprint = {2303.17354},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.17354},
}
Figure