Reconstruction from edge image combined with color and gradient difference for industrial surface anomaly detection

Tongkun Liu, Bing Li, Zhuo Zhao, Xiao Du, Bingke Jiang, Leqi Geng · DOI

TL;DR

Researchers have developed EdgRec, a novel unsupervised method for industrial defect detection that reconstructs full-color RGB images from grayscale edge maps. By forcing a neural network to "fill in the blanks" of a skeletal edge image, the model learns to perfectly restore normal textures while failing to reconstruct anomalies, making defects easy to spot using a custom, light-invariant evaluation function.

What Problem Does This Paper Address?

In industrial manufacturing, finding defects (scratches, dents, or discolorations) is a needle-in-a-haystack problem. Unsupervised reconstruction-based methods are popular because they only need "normal" samples for training. The logic is simple: train a model to reconstruct normal images; when it encounters a defect, it won't know how to fix it, and the difference between the input and the output reveals the anomaly.

However, these models face a "generalization paradox." If a model is too powerful, it might accidentally learn to reconstruct the defects too, making them invisible. If it's too weak, it fails to reconstruct complex normal textures (like the weave of a fabric), leading to "false alarms." The challenge is finding a way to preserve high-frequency structural details without allowing the model to simply copy-paste anomalies from the input to the output.

Methods

The authors introduce EdgRec, which shifts the task from "image-to-image" reconstruction to "edge-to-RGB" restoration.

  1. Edge Extraction: During training, the original image is corrupted with "pseudo-anomalies" (textures from the DTD dataset or CutPaste augmentations). The model then extracts a grayscale edge map using morphological erosion and dilation.
  2. The Architecture: They use a U-Net-style denoising autoencoder. Unlike many anomaly detection models that avoid skip connections (because they can lead to "identity mapping" where the model just passes the input through), EdgRec uses them. Because the input (edges) is so fundamentally different from the target (RGB), the skip connections help restore fine details without letting the model "cheat" by copying defects.
  3. Hand-Crafted Scoring: Instead of using a black-box neural network to compare the original and reconstructed images, the authors designed an interpretable evaluation function. It combines:
  4. Color Difference: Calculated in the CIELAB color space. Crucially, they ignore the 'L' (Lightness) channel and focus on 'a' and 'b' (chromaticity), making the system robust to changes in factory lighting.
  5. Structural Difference: Using Multi-scale Gradient Magnitude Similarity (MSGMS) to catch shifts in texture and shape.

Datasets

The model was evaluated on two major benchmarks:

  • MVTec AD: The industry standard for 2D anomaly detection, containing 15 categories of industrial products (e.g., leather, tile, cable, transistors).
  • MVTec 3D-AD: A newer dataset that includes 3D scans. Interestingly, the authors tested EdgRec using only the RGB images from this dataset to see how far 2D methods could go.

Key Insights and Ideas

  • Edges as a Bottleneck: By stripping away color and low-frequency information, the network is forced to "memorize" what normal colors and textures look like for a specific object. It can't rely on the input to tell it what color a "normal" cable should be.
  • Lighting Invariance: One of the biggest headaches in computer vision is flickering or uneven factory lights. By focusing on the 'a' and 'b' channels of the CIELAB space, the authors created a "color-only" detector that doesn't get confused by shadows or brightness shifts.
  • Denoising as a Defense: The inclusion of pseudo-anomalies and noise during training prevents the model from developing an identity mapping, ensuring it learns the underlying distribution of "normal" rather than just learning to trace.

Key Results

EdgRec achieves state-of-the-art or competitive results across the board:

  • MVTec AD: Achieved 97.8% AUROC for image-level detection and 97.7% for pixel-level localization.
  • Efficiency: It outperforms other popular methods like RIAD and InTra while being more efficient, as it only requires a single reconstruction network.
  • 3D Dataset: Even without using 3D point cloud data, EdgRec achieved an average AUROC of 83.2% on MVTec 3D-AD, outperforming several methods that had access to more complex features.

Limitations and Future Work

While EdgRec is powerful, the authors note that it currently only operates on 2D information. On the MVTec 3D-AD dataset, some anomalies are purely geometric (like a subtle dent on a uniform surface) and are nearly invisible in 2D RGB images.

Future work involves integrating 3D point cloud processing to create a truly multimodal detection system. Additionally, the authors suggest that exploring more diverse "pseudo-anomaly" generation techniques could further sharpen the model's ability to distinguish between complex normal textures and subtle defects.

Summary updated

BibTeX
@misc{liu2022reconstruction,
  author = {Tongkun Liu and Bing Li and Zhuo Zhao and Xiao Du and Bingke Jiang and Leqi Geng},
  title = {{Reconstruction from edge image combined with color and gradient difference for industrial surface anomaly detection}},
  year = {2022},
  eprint = {2210.14485},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.14485},
}
Figure