# Research on Automated Fiber Placement Surface Defect Detection Based on Improved YOLOv7
## 4 Experimental Setup and Result Analysis
### AFP Surface Defect Dataset  
Currently, there is no established comprehensive open dataset for surface defects in composite material AFP within the industry. Considering the data quantity requirements of deep learning, this dataset primarily consists of surface defect data generated during AFP operations on actual typical components. Additionally, artificial simulation experiments were conducted to further enrich the dataset. The carbon fiber prepreg used in this experiment is a cutting-edge research material developed by the Aerospace Research Institute of Materials & Processing Technology (ARIMT), with the grade being MT7001603B.  
During the actual laying process, we use an industrial camera to record videos to capture the complete visual information of the laying process. Subsequently, the video data are processed to convert them into image sequences, and the data are then selected for subsequent annotation. Figure 6 illustrates the collection of overlap and gap defects during the AFP process. However, due to the limited number of captured images and potential selection bias, the types and forms of surface defects may not be fully covered. To obtain more defect images for research purposes, we need to artificially simulate AFP operations to generate diverse defect images, such as overlapping and gapped defects during the laying process.  
To simulate actual defect images, it is necessary to replicate the actual laying environment, including camera position, light source position, and shooting angle, among others. By accurately simulating these conditions, the generated defect images become more realistic. This approach helps in obtaining defect images that closely resemble those in real laying processes, thereby providing accurate data for research and algorithm evaluation. Subsequently, we simulate defects in AFP, such as adjusting the width of single-fiber placement tracks to create gap and overlap defects, or introducing defects in multi-fiber placement tracks. Meanwhile, the camera is fixed for video capturing, and defect images are saved and captured. Additionally, two types of defects occur during the placement process; by simulating these defects and different background environments, the dataset is enriched with diverse training and testing samples to improve algorithm adaptability. Through adjusting placement tracks, simulating defects at different placement levels and backgrounds, and introducing wrinkle defects, we enrich the dataset. By combining real and simulated surface defects, diverse samples are provided to challenge algorithm training and evaluation, aiding in optimizing defect detection algorithms. This simulated dataset facilitates the enhancement of defect detection in production and provides valuable references.  
Datasets are the foundation for building and training models. In this study, approximately 8000 sample images were collected and gradually filtered to form the final dataset, totaling over 5000 images. The dataset was divided into training, validation, and test sets at  
Figure 6: Surface defect data collection in AFP process.  
a ratio of 8:1:1. To more accurately describe and distinguish different defect scenarios, these defects are categorized into five different types: gap, overlap, foreign material, wrinkle, and twist.