# A Survey on Surface Defect Inspection Based on Generative Models in Manufacturing
## 5 Discussion and Conclusions
### Challenges and Opportunities
The goal of training a GAN is to reach Nash equilibrium, but it is difficult to achieve because the adversarial nature of a GAN cannot guarantee convergence, and thus training usually occurs in oscillations with gradually increasing amplitudes [125]. Moreover, GANs may suffer from mode collapse, which causes the generator to only learn simple features and fail to learn complex features, and thus GANs only produce duplicate or similar images [29]. For the DMs, the sampling time as well as the training time are too long, and their model structures are too complex and heavy. Moreover, generative models are also deep neural networks, which require a certain number of samples for model training. The aim of generative models is to generate images as realistically as possible. Therefore, generative models need to train on real samples, which in some cases cannot be achieved when the number of initial defect samples is extremely small. A method that allows training models on a small number of samples urgently needs to be developed. * How to improve generation quality. The performance of inspection models is highly dependent on the quality of generation samples. The quality not only refers to the clarity of the generated image but also to the diversity of generated defect features. It is necessary to design a learning mechanism to guide generative models to focus on defect areas and ignore background areas. Moreover, many product surfaces can produce defects of small size. For example, a defect target only occupies 32 \(\times\) 32 pixels area in a 512 \(\times\) 512 pixels defect image. Generative models are essentially deep neural networks in which each convolutional layer is equivalent to a filter. It is very challenging for generative models to learn and generate such a small target that only has a few details. Feature fusion techniques can bring more details to feature representation, which boosts the recognition of small defect targets [24]. However, this method is not always effective. A better method for discovering target details needs to be studied for the further improvement of the accuracy of detecting small defect targets. The background texture can also interfere with the generation quality. Many semi-finished products without surface treatment, e.g., hot-rolled steel plates, also need surface defect inspection to ensure production quality. Sometimes background textures may confuse a detector's cognition and be identified as defects, while subtle defects may be identified as background textures. In addition, many industrial production environments are extremely harsh, resulting in oil contamination or dust appearing on the surface of the product. These objects are generally not included in defect datasets and can therefore be misclassified as existing defect classes in the dataset, causing generative models to perform incorrect feature learning. * Real-time inspection. The primary objective of industrial inspection is undoubtedly the pursuit of high precision. The design of defect inspection methods should also satisfy the requirements of industrial real-time performance. However, the reality is current methods, especially based on deep learning, are involved in the trade-off of inspection accuracy and speed. Although computer hardware has developed rapidly and model lightweight technology has made some progress, accuracy and real-time performance still cannot be balanced for industrial inspection.