DDPM-MoCo: Advancing Industrial Surface Defect Generation and Detection with Generative and Contrastive Learning

Yangfan He, Xinyan Wang, Tianyu ShiarXiv 2024 · DOI

Abstract

Industrial surface defect detection is often hindered by the scarcity of real-world defect samples and the prohibitive cost of manual labeling. This paper introduces DDPM-MoCo, a novel framework that integrates Denoising Diffusion Probabilistic Models (DDPM) with Momentum Contrast (MoCo). By generating high-fidelity synthetic data and employing an enhanced batch contrastive loss, the framework significantly improves detection accuracy on metal surfaces, achieving a substantial increase in Mean Average Precision (mAP) for both ResNet and Vision Transformer architectures.

Introduction

In modern manufacturing, while high quality is the goal, the resulting rarity of defects creates a "data desert" for deep learning models. Traditional models require thousands of labeled examples to accurately identify anomalies like dents, scratches, or corrosion. Existing data augmentation techniques, such as simple geometric transformations or basic synthetic overlays, often fail to replicate the complex textures and specular reflections characteristic of industrial metal surfaces. DDPM-MoCo addresses these challenges by providing a pipeline for high-quality data synthesis and self-supervised feature learning.

Methodology

The DDPM-MoCo framework operates in two primary stages: data generation and feature representation learning.

Data Generation via DDPM

The framework utilizes Denoising Diffusion Probabilistic Models to synthesize realistic defect images. Unlike Generative Adversarial Networks (GANs), which can suffer from training instability, DDPMs employ a stable two-step process: a forward process that incrementally adds Gaussian noise to an image, and a backward process where a U-Net model learns to reverse this noise to reconstruct the original image. This allows for the generation of diverse, high-fidelity variations of industrial defects.

Overview of the DDPM-MoCo framework for defect generation and feature learning.

Feature Learning with Enhanced MoCo

To leverage unlabeled data, the system employs Momentum Contrast (MoCo). The core innovation is the Enhanced Batch Contrastive Representation Loss. Standard contrastive loss typically compares a single query to a single positive key. The proposed enhanced loss considers all positive key samples globally within a mini-batch, enabling the model to capture structural characteristics of defects rather than overfitting to local pixel noise.

Experimental Setup and Datasets

The study focused on precision aluminum plates. The initial dataset consisted of only 200 images (50 per category: normal, dented, scratched, and corroded). Through DDPM expansion, this was scaled to a massive dataset of 20,000 images (5,000 per category), representing a 100x increase in training data. This expansion provides the necessary volume for training deep backbones like ResNet50 and ViT-B/16.

Results and Discussion

The DDPM-generated images achieved high statistical similarity to real-world data, with Fréchet Inception Distance (FID) scores as low as 1.94 for the "scratch" category.

Detection Performance

The integration of the improved loss function and augmented dataset led to significant gains in Mean Average Precision (mAP):

  • ResNet50: mAP increased from 72.23% (original loss) to 86.82% (improved loss).
  • ViT-B/16: mAP increased from 74.41% to 86.04%.
Precision-Recall curves and Average Precision (AP) for different defect classes.

As shown in the Precision-Recall curves, the model performs exceptionally well across various classes. The most dramatic improvement was observed in the "Scratches" category, where the enhanced loss helped the model overcome the difficulty of identifying thin, low-contrast lines on reflective surfaces.

Conclusion

DDPM-MoCo demonstrates that combining generative AI with advanced contrastive learning can effectively overcome the data scarcity bottleneck in industrial AI. Future work will focus on extending this framework to diverse materials such as plastics and textiles, and optimizing the computational efficiency of diffusion models for real-time factory deployment.

Summary updated

BibTeX
@misc{he2024ddpm,
  author = {Yangfan He and Xinyan Wang and Tianyu Shi},
  title = {{DDPM-MoCo: Advancing Industrial Surface Defect Generation and Detection with Generative and Contrastive Learning}},
  year = {2024},
  eprint = {2407.03332},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.03332},
}
Figure