# Research on Automated Fiber Placement Surface Defect Detection Based on Improved YOLOv7
## 4 Experimental Setup and Result Analysis
### Ablation Study
#### 4.4.5 Application Results and Analysis  
To validate the detection performance of the model and compare it with the YOLOv7 model, this study applied the detection model to actual photos or videos from the composite material AFP site under detection. As shown in Figure 10, images a-c are photo data from the test set, while images d-f are screenshots from videos of the AFP process after detection. Different lighting conditions were selected to showcase various scenarios. To ensure that edge defects in the test set can be clearly displayed with their categories and confidence levels for comparison, we decided to fill the surroundings of images a-c with a white area.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Models** & **mAP** & **FPS** \\ \hline Faster R-CNN & 72.7\% & 18 \\ EfficientDet & 75.6\% & 28 \\ YOLOv5-tiny & 78.6\% & 45 \\ YOLOv5 & 80.8\% & 35 \\ YOLOv7-tiny & 80.4\% & 53 \\ YOLOv7 & 85.3\% & 48 \\ \hline Our models & YOLOv7 + BiFormer & 93.8\% & 55 \\ YOLOv7 + AFPN & 90.5\% & 52 \\ YOLOv7 + WIoU & 92.3\% & 55 \\ Improved YOLOv7 & 95.8\% & 62 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Performance of each model on test set.  
For the confidence information not displayed in the video detection screenshots d-f, we will clearly label it in the caption.  
In Figure 10, we can see that images a1 to f1 show the results of detection using the YOLOv7 algorithm, while images a2 to f2 depict the results of detection using the improved version of YOLOv7. Below is a detailed analysis of these results:  
Firstly, in image a, the original YOLOv7 algorithm exhibits missed detections for overlapping defects and lower confidence compared to the improved YOLOv7. This suggests that the improved model demonstrates higher accuracy and reliability in detecting overlapping defects. In images c and d, where the lighting angles are relatively uniform, the focus should be on the accuracy and confidence of the bounding boxes. It is evident that the improvement from the WIoU loss function in the improved YOLOv7 significantly enhances the bounding box regression, with the defect bounding boxes in c2 and d2 notably superior to those in c1 and d1. Additionally, the confidence levels in the improved YOLOv7 are also superior to those in the original YOLOv7. Furthermore, in image d, we encounter the issue of overlapping defects of multiple classes, where foreign object defects overlap with gap defects. The improved YOLOv7 exhibits better performance in addressing this issue, detecting high-quality defects that are difficult to differentiate more accurately compared to the original YOLOv7, with higher confidence levels. Lastly, in images e and f, due to dim lighting, the original YOLOv7 shows missed detections in image e1, while the improved YOLOv7 exhibits higher confidence levels under the premise of detecting the targets. Additionally, when facing situations where multiple surface defects overlap, the original YOLOv7 algorithm experiences missed detections. The dynamic and non-monotonic focusing mechanism of the replaced WIoU loss function in the improved YOLOv7 reduces the gradient gains for simple examples, enabling the model to focus on challenging instances such as occlusions, enhancing the model's generalization performance against difficult samples with target occlusions.  
Through the comparative analysis above, it is evident that the improved YOLOv7 demonstrates better detection performance and capabilities in real-world applications at composite material AFP sites.  
Figure 10: _Cont._