# Surface Defect Detection of Preform Based on Improved YOLOv5
###### Abstract
[18] proposed an image restoration algorithm based on surface pattern repetition features to effectively identify the woven structure, wrinkles, bubbles, etc., of carbon fiber prepreg. [PERSON] et al. [19] proposed a fabric defect detection method based on completed local quarter patterns, which extracts local texture features from fabric images to achieve fabric surface defect detection. [PERSON] et al. [20] proposed a method for detecting bubbles and wrinkles in carbon fiber flat woven prepreg based on image texture feature compression, which further defines defect types based on texture features through k-means clustering. [PERSON] et al. [21] proposed the Swin-transformer module to replace the main module in the original YOLOv5 algorithm, realizing the detection of fabric defects. [PERSON] et al. [22] used Bayesian optimization algorithms to optimize the deep convolution neural network for defects on fabrics, greatly improving the accuracy of defect recognition. [PERSON] et al. [23] introduced a ResNet structure into the network model for defect detection in prepreg placement based on a laser profiler, reducing network complexity, solving overfitting problems, and achieving better defect recognition results. In surface defect detection, in addition to the requirements for recognition accuracy, attention should also be paid to small samples and real-time issues. For the small sample problem, the current solutions are mainly to increase samples and reduce the lazy dependence of the algorithm on samples. Among them, the method of increasing samples generally uses data enhancement and defect generation algorithms to increase the number of samples, thereby increasing the dataset of samples [24]. Such methods only increase the number of samples in a limited manner and are non-real samples, with limited improvement effects. In addition, there are three main aspects of research to reduce the dependence of algorithms on the number of samples. The first is network pre-training or transfer learning, which is currently widely used. The common feature data and weight information in the pre-training model can help small sample training achieve better results. Currently, it has been applied in multiple fields such as liquid crystal panel defects, PCB board defects, metal parts surface defect detection, and has achieved good results [24; 25; 26]. The second is the optimization of network structure. A reasonable network structure can also greatly reduce the demand for samples, achieving good results [27; 28]. The third is an unsupervised or a semi-supervised model [29; 30]. In an unsupervised model, only normal samples are used for training, so there is no need for defective samples. Semi-supervised methods can solve network training problems with small samples using unlabeled samples. In addition, the method based on meta learning is also a solution to small sample problems, which has been applied in many fields [31; 32]. In solving real-time issues, lightweight network design can perform network model pruning and model weight quantization to accelerate model inference and improve detection speed. Based on the YOLOv5 model, many researchers have chosen to apply methods such as Ghost Bottleneck, improved feature fusion module, improved data enhancement, and edge attention fusion network to the fields of wood surface defects, bamboo surface defects, and rubber sealing ring surface defects; and have achieved good results [33; 34; 35]. Further, in order to ensure detection accuracy and even further improve detection accuracy on the basis of lightweight, most of the above researchers have introduced attention mechanisms or combined improved loss functions to improve detection performance, which has become the basic idea of lightweight design [36; 37]. At present, there are no relevant reports in the literature on the detection of surface defects in preforms, and there is a lack of corresponding research.