# A Survey on Surface Defect Inspection Based on Generative Models in Manufacturing
## 3 Defect Inspection Based on Generative Models
### Defect Inspection Based on GANs
[74] proposed the Anomalous Latent Variable Generating Adversarial Networks (ALGAN) that only used normal data for training and introduced latent variables in anomalous states to generate pseudo data. [PERSON] et al. [75] used a GAN to generate pseudo-defect images and mixed them into real images in a pre-trained CNN for defect classification. For defect classification tasks, [PERSON] et al. [76] introduced the DefectGAN, which equipped fully convolutional networks and Markov discriminators to reduce the risk of pattern collapse and used a novel sampling strategy to balance memory consumption and training quality. [PERSON] et al. [77] adopted the WGAN to generate new defect samples and integrated attention mechanisms into a CNN model to recognize defects on a hot-rolled strip steel surface. [PERSON] et al. [78] constructed a mapping network for the latent space, which made it possible to compose defect images of various sizes and optimized the proposed method in terms of convergence and computational cost. [PERSON] et al. [79] replaced the activation functions DCGAN with ELUs (EDCGAN) for sample generation and adopted the MobileNet for steel surface defect classification. [PERSON] et al. [80] modified the traditional GAN with two dual discriminators and introduced a regularization technique into GAN for generating high-quality and diverse surface defect images. [PERSON] et al. [81] presented a semi-supervised detection method of the metal product surface, which incorporated the Visual Transformer (ViT) into GAN and extracted multi-scale mask features for capturing rich semantic information. [PERSON] et al. [82] proposed a multi-stage detection framework by transforming the defect detection task of fabrics into an unsupervised task based on DCGAN, which only required a few number of normal samples and achieved competitive results. [PERSON] et al. [83] introduced the ADRGAN (attentive dual residual GAN) which uses the channel-wise and spatial-wise attention mechanisms to track and recover raindrop-like pseudo-defects. The method is able to locate and remove these pseudo-defects more accurately while retaining the real defect features, thus improving the accuracy and efficiency of defect detection. [PERSON] et al. [84] constructed the adaptive GAN (AGAN) that generates defects similar in style to the background of the defect-free samples and designed the self-attentive encoder and spatial-aware decoder modules for obtaining the final prediction results. [PERSON] et al. [85] proposed an unsupervised learning method for recognizing steel surface defects with fewer labeled samples, which generated defect images using a diverse generative adversarial network (DGAN) and learned the representation using flexible contrast to improve the semantic information of samples. [PERSON] et al. [86] proposed the Defect Location Sensitive GAN (DLS-GAN) for data augmentation, which used two encoder-decoders to help synthesize defects on the object and improve the synthesis quality. [PERSON] et al. [87] modified the auxiliary classifier GAN (ACGAN) by applying the Wasserstein distance and spectral normalized strategy, which obtained high-quality generation and reduced the cost of detection. [PERSON] et al. [88] proposed the perceptually constrained single image GAN (PCSGAN) to solve the problem posed by small numbers of defect images, which can train generators and discriminators at each scale. [PERSON] et al. [89] developed a defect-background separated GAN to enhance the accuracy of battery exterior defect inspection, which contributes to constructing a balanced dataset by increasing the overall quantity of the defect segmentation dataset, addressing the shortage of defect instances. [PERSON] et al. [90] proposed a DCGAN-based method for the automatic generation of image synthesis of apparel stitching defects. The other type of GAN architecture is based on image-to-image translation, which generates samples conditioned on input images, such as CycleGAN [91], StyleGAN [92], and SinGAN [93], etc.