## 5 Results and Analysis
### Simulation of Industrial Actual Defect Detection Environment  
After the abovementioned training process, we obtained the model with the best performance for the first-stage and second-stage recognition. In order to illustrate the advancement of the two-stage framework, we first conducted three sets of verification experiments with the Enriched-NEU-DATA dataset. It can be seen from Table 9 that, due to the single-stage model Optimized-Inception-ResnetV2 being a classification network, it is not suitable for a situation where an image has multiple different types of defects that require identification--an inevitable drawback. In addition, we found that the mAP value of the two-stage recognition is 5.2% higher than that of the single-stage recognition model Improved-YOLOv5. To sum up, the defect detection method proposed in this paper represents a breakthrough compared with the current mainstream defect detection method based on vision, and can be applied to complex and multitarget detection scenarios like the Enriched-NEU-DATA dataset. Therefore, our model improves the detection efficiency and accuracy. In order to further verify whether the two-stage defect recognition framework proposed in this paper is effective in an actual defect detection environment, we built a simulation environment for industrial defect detection. The implementation process is shown in Figure 16.  
Figure 16: The implementation process of an industrial environment. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Algorithms** & **Parameters (M)** & **Accuracy (\%)** \\ \hline VGG19 & 39.0 & 69.42 \\ Resnet50 & 25.6 & 73.60 \\ InceptionV4 & 41.3 & 78.03 \\ Inception-ResnetV2 & 28.9 & 78.76 \\ Optimized-Inception-ResnetV2 & 37.7 & 82.33 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: The comparison results of four algorithms. We borrowed a number of discarded steels with defects from a factory. On this basis, we manually created several defects on the steels. The final number of various types of defects is shown in Table 10.  
We used the AUBO-i5 robot to fix the Intel RealSense D435 industrial camera so that it could scan the steel surface by itself to complete the image collection of the steel surface, and take photos with robot teaching. At the same time, we used the exposure lamp to illuminate the steel. The images were sent to the first-stage recognition model in real time, allowing us to obtain images of the suspected areas of the defect; the details were written into a suspected defect area database (\"C:Users \(\backslash\)HUAWEI\(\backslash\)Desktop \(\backslash\)SuspiciousDefectStorage.txt\"). After each image was detected, one or more groups of suspected defects was obtained, cropped, and filled to a uniform size. We performed second-stage recognition on the suspected areas, judged the final category of the defect, and wrote the obtained result into the \"C:Users \(\backslash\)HUAWEI\(\backslash\)Desktop \(\backslash\)Result.txt\". We wrote a Python script to compare the results of the two levels and calculate the value of each indicator. We compared the types of defects in the two documents (\"SuspiciousDefectStorage.txt\" and \"Result.txt\"): if they are the same, TP + 1; otherwise, TN + 1. When all the defects were traversed, the final index was calculated. TP indicates the number of defects that are correctly identified; TN indicates the number of defects that are incorrectly identified. The precision value is TP\(/\)(TP + TN). If the results of the two-stage detection were the same, we directly output the image in the suspected defect area database; otherwise, the image was output after being marked for later processing of the surface defects of the steel.