# Surface Defect Detection of Preform Based on Improved YOLOv5
###### Abstract  
This paper proposes a lightweight detection model based on machine vision, YOLOv5-GC, to improve the efficiency and accuracy of detecting and classifying surface defects in preforming materials. During this process, clear images of the entire surface are difficult to obtain due to the stickiness, high reflectivity, and black resin of the thermosetting plain woven prepreg. To address this challenge, we built a machine vision platform equipped with a linescan camera and high-intensity linear light source that captures surface images of the material during the preforming process. To solve the problem of defect detection in the case of extremely small and imbalanced samples, we adopt a transfer learning approach based on the YOLOv5 neural network for defect recognition and introduce a coordinate attention and Ghost Bottleneck module to improve recognition accuracy and speed. Experimental results demonstrate that the proposed approach achieves rapid and high-precision identification of surface defects in preforming materials, outperforming other state-of-the-art methods. This work provides a promising solution for surface defect detection in preforming materials, contributing to the improvement of composite material quality. preform; surface defect detection; YOLOv5; coordinate attention; Ghost Bottleneck Article  
[PERSON], [PERSON], [PERSON], [PERSON], M. Surface Defect Detection of Preform Based on Improved YOLOv5  
as Prewitt, Sobel, Canny, etc. [5]. When the defect area is large, scale invariant feature transformation and grayscale histogram feature methods have been applied, improving the recognition effect [6; 7]; and transform frequency domain detection methods, such as Fourier transform, wavelet transform, Gabor transform, etc. [8]. After image processing, defects can be classified using traditional machine learning methods: common traditional machine learning methods, such as support vector machines (SVM), KNN clustering, random forests, and so on. These machine learning methods combine image processing for defect classification of industrial products and fabrics, or a combination of multiple classifiers for defect classification [9]. Defect recognition and classification based on image processing and traditional machine learning methods rely more on manual experience to collect samples, and the quality of extracted features affects recognition accuracy, resulting in low versatility. In recent years, defect detection methods based on deep learning have been applied in many fields, among which the convolutional neural network (CNN) is the most widely used [10]. According to different data labels, deep-learning models can be roughly divided into supervised, unsupervised, semi-supervised, and weakly supervised learning models [11]. Currently, more research focuses on supervised representation learning, especially in defect detection. Defect detection issues are considered as classification tasks, including image label classification, region classification, and pixel classification, which can be considered as classification issues, location issues, and segmentation issues, respectively. For localization issues, target localization aims to obtain accurate location and category information for defects. The network can be divided into two-stage networks and single-stage networks. Common two-stage networks include faster R-CNN [12], and common single-stage networks include SSD [13] and YOLO series methods [14]. The single stage network uses the entire image as the input of the network, and marks the location and category of defects in the regression boundary box of the output layer. The YOLO series of methods is one of the recent research hotspots and has been applied in metal surface defects, fabric and prepreg surface defects, underwater target detection, agricultural product recognition, and other aspects [15; 16; 17]. Moreover, the YOLO series of algorithms are still in rapid development. [PERSON] et al.