Semi-Supervised Defect Detection via Conditional Diffusion and CLIP-Guided Noise Filtering

Shuai Li, Shihan Chen, Wanru Geng, Zhaohua Xu, Xiaolu Liu, Can Dong, Zhen Tian, Changlin Chen

TL;DR

This paper introduces DSYM, a novel semi-supervised defect detection framework that significantly improves data efficiency in industrial quality inspection. By combining conditional diffusion for generating synthetic defect data and CLIP for filtering noisy pseudo-labels, DSYM achieves high accuracy with substantially less labeled data than traditional supervised methods.

What Problem Does This Paper Address?

Industrial quality inspection, especially in critical sectors like automotive and aerospace, relies heavily on accurate defect detection. Traditional methods are often manual, inefficient, costly, and struggle with robustness. While deep learning has advanced defect detection, it typically requires vast amounts of labeled data, which is expensive and time-consuming to acquire in real-world industrial settings. This scarcity of labeled data, coupled with the challenge of noisy labels generated during semi-supervised learning, hinders the widespread adoption of highly accurate automated defect detection systems.

Methods

The DSYM framework employs a two-stage, collaborative training strategy:

  1. Supervised Pre-training: Initially, a student model (based on YOLOv9 with a Mamba integration for enhanced feature extraction) is trained on a small set of labeled data. This stage also leverages a conditional diffusion model to generate synthetic, multi-scale pseudo-defect samples. These generated samples, along with the real labeled data, are used to build a foundational detection capability.
  2. Semi-supervised Collaborative Training: In the second stage, a large amount of unlabeled data is introduced. A teacher-student network architecture is used, where the teacher model (an EMA version of the student) generates pseudo-labels for the unlabeled data. Crucially, a CLIP cross-modal feature-based noise filtering mechanism is employed to identify and discard low-confidence or incorrect pseudo-labels, thereby mitigating label contamination. The student model is then trained using both the original labeled data and the refined pseudo-labels.

The Mamba integration in the detection head is highlighted for its ability to process long sequence dependencies, which is beneficial for capturing complex spatial patterns in industrial defects. The CLIP filtering mechanism leverages the alignment between image and text embeddings to assess the quality of pseudo-labels.

Datasets

The primary dataset used for evaluation is the NEU-DET dataset, a publicly available dataset for steel surface defect detection. The paper details how this dataset was partitioned into supervised training sets, unsupervised training sets, and validation sets, with the supervised training set comprising only 20% of the total data to simulate real-world scarcity.

Key Insights and Ideas

  • Diffusion Models for Data Augmentation: Using conditional diffusion models to generate realistic, multi-scale synthetic defect samples is a powerful way to augment limited labeled data, especially for rare defect types.
  • CLIP for Robust Pseudo-Labeling: CLIP's ability to understand image-text relationships provides an effective, cross-modal approach to filter out noisy pseudo-labels, a critical step for successful semi-supervised learning in defect detection.
  • Mamba for Enhanced Feature Extraction: Integrating Mamba into the detection head shows promise in capturing complex spatial patterns of defects, contributing to improved detection accuracy.
  • Two-Stage Collaborative Training: The staged approach, moving from supervised pre-training with synthetic data to semi-supervised refinement with noise filtering, allows for efficient knowledge transfer and robust learning.

Key Results

The DSYM framework demonstrates significant improvements in data efficiency:

  • Achieved 78.4% [email protected] on the NEU-DET dataset using the same amount of labeled data as traditional supervised methods.
  • Achieved 75.1% [email protected] using only 40% of the labeled data required by the original supervised model.
  • The incorporation of the Mamba encoder alone resulted in a 1% increase in mAP.
  • The full DSYM framework showed a 3.6% improvement in mAP compared to a baseline YOLOv9 model with a Mamba encoder.
  • The model performs well across various defect types, with particularly high performance on patches (97.8% [email protected]) and scratches (86.2% [email protected]).

Limitations and Future Work

The authors acknowledge several limitations:

  • Subjectivity of CLIP Filtering: The CLIP model's judgment criteria for filtering "obviously not defects" can be subjective, potentially leading to suboptimal filtering for blurry or difficult-to-distinguish images.
  • Teacher Model Update Strategy: The EMA strategy for updating the teacher model might require further optimization to achieve a better balance between teacher stability and student adaptability.

Future research directions suggested include:

  • Exploring More Effective Noise Filtering: Investigating alternative visual models or feature extraction methods beyond CLIP to improve the accuracy of noise filtering and reduce false label generation.
  • Advanced Teacher-Student Mechanisms: Developing more dynamic adjustment mechanisms for EMA's weight parameters to better adapt to diverse training stages.

Summary updated

Abstract

In the realm of industrial quality inspection, defect detection stands as a critical component, particularly in high-precision, safety-critical sectors such as automotive components aerospace, and medical devices. Traditional methods, reliant on manual inspection or early image processing algorithms, suffer from inefficiencies, high costs, and limited robustness. This paper introduces a semi-supervised defect detection framework based on conditional diffusion (DSYM), leveraging a two-stage collaborative training mechanism and a staged joint optimization strategy. The framework utilizes labeled data for initial training and subsequently incorporates unlabeled data through the generation of pseudo-labels. A conditional diffusion model synthesizes multi-scale pseudo-defect samples, while a CLIP cross-modal feature-based noise filtering mechanism mitigates label contamination. Experimental results on the NEU-DET dataset demonstrate a 78.4% [email protected] with the same amount of labeled data as traditional supervised methods, and 75.1% [email protected] with only 40% of the labeled data required by the original supervised model, showcasing significant advantages in data efficiency. This research provides a high-precision, low-labeling-dependent solution for defect detection in industrial quality inspection scenarios. The work of this article has been open-sourced at https://github.com/cLin-c/Semisupervised-DSYM.
BibTeX
@misc{li2025semi,
  author = {Shuai Li and Shihan Chen and Wanru Geng and Zhaohua Xu and Xiaolu Liu and Can Dong and Zhen Tian and Changlin Chen},
  title = {{Semi-Supervised Defect Detection via Conditional Diffusion and CLIP-Guided Noise Filtering}},
  year = {2025},
  eprint = {2507.05588},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.05588},
}
Figure