# A Survey on Surface Defect Inspection Based on Generative Models in Manufacturing
## 3 Defect Inspection Based on Generative Models
### Defect Inspection Based on Multi-Models  
A new trend builds generative models based on multiple models, e.g., the combination of a GAN and a VAE. [PERSON] et al. [108] introduced the channel attention mechanism into AE generator network and Combine with the Wasserstein GAN (WGAN) for image restoration, which can achieve good results in removing the oil droplets from the image and restoring the texture information of the oil droplet region. [PERSON] et al. [109] introduced the Mask2 Defect that utilizes priori knowledge to data augmentation and has the ability to use generated samples to fine-tune the inspection model. The Mask2 Defect consists of three generative models: the IPK-Encoder (industrial prior knowledge encoder) that obtains teacher masks for semi-supervised training, the M2 DCNet (mask-to-defect construction network) that renders the defect details based on teacher masks, and the F2 RDT-GAN (fake-to-real domain transformation GAN) that transforms the rendered samples to real defect domain for guaranteeing realistic background textures. [PERSON] et al. [110] proposed a weakly-supervised learning method for fabric defect detection, which replaces the generator of GAN with an AE architecture to generate samples. Then, the single-shot multi-box detector network is adopted for multi-scale defect detection. [PERSON] et al. [11] introduced an  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Method** & **Year** & **Brief Description** & **GM** & **Objective** & **Task** & **LM** \\ \hline
[104] & 2023 &
\begin{tabular}{c} Employ the defect-free samples to train model \\ with time-step adaptive modules \\ Use DDPM for data enhancement and DenseNet \\ for defect classification \\ Train a DDPM model using limited defective \\ images and use an erasing-inpainting operation \\ to improve generation quality \\ Use stable diffusion improvement to augment \\ the dataset \\ \end{tabular} & SN-DDPM & YDFID-1 & SEG & USL \\
[105] & 2023 & \
\begin{tabular}{c} Use DDPM for data enhancement and DenseNet \\ for defect classification \\ Train a DDPM model using limited defective \\ images and use an erasing-inpainting operation \\ to improve generation quality \\ Use stable diffusion improvement to augment \\ the dataset \\ \end{tabular} & DDPM &
\begin{tabular}{c} Composite \\ panel surface \\ \end{tabular} & CLS & WSL \\
[106] & 2024 &
\begin{tabular}{c} Notions: GM = generative model, CLS = classification, SEG = segmentation, LM = learning mode, USL = unsupervised learning, WSL = weakly-supervised learning. \\ \end{tabular} & DET & WSL \\ \hline \hline \end{tabular}
\end{table}
Table 5: Summary of studies based on DMs for surface defect inspection.  
anomaly detection architecture that combines a GAN and a residual AE, which improves the accuracy of detecting and localizing surface anomalies by focusing on specific regions of the image. [PERSON] et al. [112] combined an attention feature fusion module and a residual banalization module through an encoder-decoder-encoder network structure to perform defect detection and segmentation based on defect-free samples. [PERSON] et al. [113] combined the deep conditional VAE (DCCVAE) and auxiliary conditional Wasserstein GAN with gradient penalty (ACWGAN-GP) to gradually expand and generate various coating defect images for solving the overfitting problem due to unbalanced data and finally adopted a CNN for defect classification based on generated samples.  
Table 6 presents a summary of selected papers that combine multiple generative models for surface defect inspection. The commonly used combination is to integrate a VAE and a GAN, which can combine their advantages and achieve outperformance.