## 3 Experiment and Analysis
### Results for ROI Extraction  
Figure 9 visualizes the training loss of the YOLOv5 model used for ROI extraction, including localization, classification and confidence losses. It can be seen that the classification loss is not available and its value is always 0, since ROI extraction is a single target detection problem. Meanwhile, as the number of iterations rises, the two remaining curves gradually converge and the final loss values fall to close to zero. This means that the training process of the model used for ROI extraction should be correct. The performance comparison of different methods on ROI extraction are listed in Table 2, and the partial visual results results of our method are shown in Figure 10. As can be seen from the data in Table 2, the most striking observation is that both precision and recall values of our adopted YOLOv5 can reach 100%. The AP values at two different thresholds are also high, which are 99.5% and 99.3%, respectively. Another mainstream one-stage detector, the SSD, has an acceptable detection speed of 0.019 s, but its performance is relatively poor. Although the Faster R-CNN, a representative of the two-stage detector, is competitive in terms of individual criteria, it takes 0.097 s to detect a single image, which is much slower than the 0.013 s of our method. Figure 10 shows that with the adopted YOLOv5 model, the rows to be detected (i.e., the ROI) can all be detected with high confidence, without interference from the cables behind them. To verify the robustness of the method used for ROI extraction to lighting, we test it on the ROI extraction dataset with different levels of lighting conditions. As can be seen in Figure 11, our method has strong light resistance and can always locate the ROI accurately. From Table 3, we can observe that the used model, YOLOv5, consistently maintains a high performance regardless of whether the light gets brighter or darker. The above numerical and visual results consistently show that the original YOLOv5, after fine-tuning, is fully competent for the ROI extraction task. Meanwhile, it has excellent robustness to lighting, making it ideal for use in industrial scenarios where the environment is uncertain. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**ROI Extraction** & **Precision (\%)** & **Recall (\%)** & **[EMAIL_ADDRESS] (\%)** & **[EMAIL_ADDRESS]:0.95 (\%)** & **Times (s)** \\ \hline Faster R-CNN [32] & 99.5 & 96.6 & 99.5 & 88.5 & 0.097 \\ SSD [34] & 96.5 & 84.7 & 98.5 & 80.2 & 0.019 \\ Results & 100 & 100 & 99.5 & 99.3 & 0.013 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Performance comparison of different methods on ROI extraction. Figure 9: The curves of training loss on ROI extraction. Figure 12 shows the importance of ROI extraction for the solder joint quality inspection on aviation plugs. From Figure 12a, we can observe that the row of solder joints to be  
Figure 11: Visual results of our method under different levels of lighting conditions. (**a**) Low light; (**b**) high light. Figure 10: Visual results of the adopted YOLOv5 on ROI extraction. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**Lighting** & \multicolumn{5}{c}{**Low Light**} & \multicolumn{5}{c}{**High Light**} \\ \cline{2-10}
**Varying** & **P (\%)** & **R (\%)** & **mAP\({}^{1}\) (\%)** & **mAP\({}^{2}\) (\%)** & **P (\%)** & **R (\%)** & **mAP\({}^{1}\) (\%)** & **mAP\({}^{2}\) (\%)** \\ \hline ROI & & & & & & & & \\ extraction & 99.7 & 99.8 & 99.1 & 98.9 & 99.9 & 99.6 & 99.3 & 99.1 \\ Quality & & & & & & & & \\ assessment & 99.2 & 98.7 & 98.2 & 96.1 & 99.4 & 99.3 & 98.5 & 95.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Quantitative results of our method under different levels of lighting conditions. P, R, mAP\({}^{1}\) and mAP\({}^{2}\) mean Precision, Recall, [EMAIL_ADDRESS], and [EMAIL_ADDRESS], respectively inspected, located at the top or bottom of the aviation plug, are not within the DoF of the camera before the fine-adjusting, so their surface is blurred.