# Research on Automated Fiber Placement Surface Defect Detection Based on Improved YOLOv7
## 4 Experimental Setup and Result Analysis
### Ablation Study
#### 4.4.2 Experimental Environment and Parameter Configuration  
The current experimental setup and model training parameter settings are outlined in Tables 2 and 3.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Name** & **Configuration/Version** \\ \hline Operating system & Windows 11 \(\times\) 64 \\ CPU & Intel (R) Core (TM) i9-12900 \\ CPU & NVIDIA RTX A2000 \\ Memory & 64 GB \\ Graphics memory & 6 GB \\ IDE & PyCharm 2023.1.3 (Community Edition) \\ Deep learning framework & Pytorch 1.11.0 \\ CUDA & CUDA 11.3 \\ cudnn & cuDNN 8.3.3 \\ Python version & Python 3.9 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Experimental hardware and software configuration.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Setting** \\ \hline Initial Learning Rate & 0.01 \\ Epoch & 300 \\ Batch Size & 6 \\ Momentum Size & 0.937 \\ Weight Decay Coefficient & 0.0005 \\ Input Image Size & 640 \(\times\) 640 \\ nc & 5 \\ Optimizer & SGD \\ \hline \hline \end{tabular}
\end{table}
Table 3: Model training parameter settings.  
For the Location loss, YOLOv7 + BiFormer, YOLOv7 + WIoU, and Improved YOLOv7 all exhibited a faster decrease in the initial 10 epochs, while YOLOv7 and YOLOv7 + AFFN had a slightly slower decline slope. This indicates that the YOLOv7 + BiFormer, YOLOv7 + WIoU, and Improved YOLOv7 algorithms are able to learn useful features more quickly in the initial stages and effectively reduce losses during training. Among them, YOLOv7 + BiFormer and Improved YOLOv7 both incorporate the BiFormer self-attention mechanism in the algorithm. BiFormer uses sparse sampling during feature extraction, which retains fine-grained details critical for small object defects like those in AFP surfaces. Therefore, BiFormer can better capture the subtle features of defects. The dynamic non-monotonic focusing mechanism of the WIoU loss function makes it more sensitive to features of small targets, thereby providing some optimization. After 300 iterations, the localization loss of all five algorithms converged, with Improved YOLOv7 performing the best, followed by YOLOv7+BiFormer and YOLOv7 + WIoU, then YOLOv7 + AFPN, and finally YOLOv7.  
For both Objectness loss and Classification loss, the models show a fast convergence speed in the first 50 epochs, and by epoch 300, the models have essentially converged. From the curve in Figure 8a, it can be observed that the Objectness losses of YOLOv7 + BiFormer, YOLOv7 + AFPN, YOLOv7 + WIoU, and Improved YOLOv7 models are similar in magnitude. Compared to the original YOLOv7, these models achieve lower Objectness loss, thus further enhancing the precision performance of the models.  
Figure 9 illustrates that under the same configuration parameters, all five algorithms underwent 300 iterations. The original YOLOv7 showed a rapid increase around the 75 th iteration and began to converge, stabilizing around the 125 th iteration. In comparison, the proposed improved algorithm, Improved YOLOv7, showed a rapid increase in the first 50 iterations and reached stability around the 100 th iteration. This indicates that the improved model in this study achieved good performance stability in a relatively short period of time.  
In summary, overall, the improved YOLOv7 shows a significant performance improvement compared to the original YOLOv7. Additionally, the other four models also demonstrate a certain level of improvement compared to the original YOLOv7. These analysis results further confirm that the proposed improved algorithm in this study exhibits superior performance in experiments, showing good convergence speed and generalization capability.  
Figure 9: Comparison chart of mAP for five algorithms.