# A Survey on Surface Defect Inspection Based on Generative Models in Manufacturing
## 1 Introduction
Upper row: examples of defects on rigid surfaces ([[https://pan.baidu.com/s/11_RJTP7](https://pan.baidu.com/s/11_RJTP7) aTwr57 ahcweITpA]([https://pan.baidu.com/s/11_RJTP7](https://pan.baidu.com/s/11_RJTP7) aTwr57 ahcweITpA), accessed on 25 July 2024). Bottom row: examples of defects on flexible surfaces ([[https://ibug.doc.ic.ac.uk/resources/fabrics/](https://ibug.doc.ic.ac.uk/resources/fabrics/)]([https://ibug.doc.ic.ac.uk/resources/fabrics/](https://ibug.doc.ic.ac.uk/resources/fabrics/)), accessed on 25 July 2024). Essentially, this mode still follows the solutions of feature engineering and thus fails to solve the problem of poor generalization. The latter stage is the end-to-end inspection methods, such as [24], which can perform inspection tasks on different kinds of surfaces, regardless of rigid or flexible ones. The methods proposed during this period are indeed effective, however, their successes are based on an implicit assumption: the training samples are enough. Unlike common objects, the collection of defect samples is very different in industry. If training data is limited, the CNNs may not converge and achieve excellent results. To alleviate the requirements for defect samples, the previous methods as in [25] reduced the size of a baseline CNN, which can also decrease the representation power of the model. The methods proposed in [26; 27] adopted the pre-trained models for fine-tuning strong CNN models. Although this scheme can reduce the original sample requirement of the model, it cannot work well when there is a large gap between the target data distribution and source data distribution. Therefore, in the deep learning period, inspection methods pay more attention to solving the problem of lacking enough samples instead of how to design a model or an algorithm absorbedly, which is the fundamental difference from the traditional ML-based methods. Table 1 provides a concise summary of the reviewed research on surface defect detection based on deep learning. For the data-limited defect inspection, the most intuitive solution is to generate new defect samples. Traditional data augmentation tricks, such as image rotations and flips, can simply expand the number of samples but cannot provide new knowledge, which is unable to assist a CNN in finishing feature learning under insufficient samples. In recent years, the sample generation paradigm has attracted much attention and provided a new solution for this problem. It can synthesize new samples by generative models, such as the Variational Auto-Encoders (VAEs), Generative Adversarial Networks (GANs), and Diffusion Models (DMs). The literature [28; 29; 30; 31] summarized the generative models and their applications in other fields. In 2022, [PERSON] et al. [32] reviewed the defect detection methods based on GAN. [PERSON] et al. [33] investigated and analyzed the image generation of surface defects in 2023. The generative models are also in the domain of the DL. The above-mentioned literature [18; 19; 20; 21; 22] involved several defect inspection methods based on generative models, in which the papers were mainly published before 2022, but they did not focus on such methods. Therefore, this paper conducts a review of the generative models-based methods for the application of surface defect inspection that have been proposed in 2022-2024. In this paper, we categorized the popular generative models, i.e., the AE, GAN, and DM, and discussed their principles, properties, as well as advantages and disadvantages for industrial applications. Subsequently, we systematically summarized the related methods based on the three generative models. This paper also provides information about the common evaluation measures and public defect datasets. Finally, we discussed the key challenges and explored future work on the application of generative models in defect inspection.