## 5 Results and Analysis
### Second-Stage Recognition  
Steel images are processed by the trained Improved-YOLOv5 model to identify the suspected defect areas, which are added into a suspected defect database for second-stage recognition. The second-stage recognition needs to use the best-trained Optimized-Inception-ResnetV2 model on the NEU-DET dataset, so the classification performance of the model is related to the output of the entire framework result. We adopted a method of training based on transfer learning [28]. First, all the parameters of the convolutional layers are locked, then the global average pooling is connected, and next, the dropout layer is connected to prevent overfitting, where the parameter is set to 0.5. Finally, we connect the softmax classifier. The pretraining model is trained on the Imagenet1000 dataset by Inception-Resnetv2 as the basic model, and we directly transfer the basic model to NEU-DET dataset for training. The initial learning rate is 0.0002. When the training reaches the 60 th epoch, the fine-tuning method of unlocking the convolutional layers locked previously is used to continue training to the 100 th epoch, and to adjust the learning rate to 0.00002. In order to prevent randomness in the training process, multiple trainings are carried out, and, finally, the best parameter model is selected for testing. The configuration of training parameters is shown in Table 7.  
Figure 14a,b show the changing situations for the recognition accuracy and the loss function with the epochs during the training process on the NEU-DET dataset. As can be seen from Figure 14a, at the 70 th epoch, the recognition accuracy of the two models tends to be stable. The results show that the recognition accuracy of Optimized-Inception-ResnetV2 has improved compared with the original network model, by 3.57%. As can be seen from Figure 14b, when the training reaches the 61 st epochs, the abovementioned fine-tuning method is adopted, then the loss function has a sudden fluctuation, then continues to decrease. This shows that fine-tuning during training can reduce the loss and improve the accuracy. We also know that the Optimized-Inception-ResnetV2 model reached the best state at the 75 th epoch and began to stabilize (in the original model this was at about the 85 th epoch). This shows that the training convergence speed of Optimized-Inception-ResnetV2 is significantly faster than the Inception-ResnetV2 model. This is because the CBAM module can effectively suppress the interference of useless features and redefine \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Parameters** & **Size** & **Optimizer** & **Lr** & **Epochs** & **Batch Size** & **Loss Function** & **Classifier** \\ \hline Settings & 224 \(\times\) 224 & Nadam & 0.0002 & 100 & 32 & Cross entropy loss & Softmax \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Configuration of training parameter values for Comparison Experiment. the importance of each channel and spatial feature. This makes the network stable faster and gives it a better performance. In order to further investigate the ability of the Optimized-Inception-ResnetV2 model to identify various types of defects and the details of defect misjudgment, a multiclassification confusion matrix was introduced to quantitatively analyze the training and testing status of the NEU-DET dataset described above. A confusion matrix comprehensively reflects the recognition accuracy and the misjudgment of real defect types. The quantization diagram of the confusion matrix of Optimized-Inception-ResnetV2 model and Inception-ResnetV2 model is shown in Figure 15. It can be seen that the optimized model is significantly better than the original model, and the confusion between different types of defects is lower. We know that \"crazing\" and \"scratches\" are the two most easily confused types in the recognition process, and there may be misjudgments between the two. This is because the \"scratches\" are mostly concentrated in one direction in our dataset; however, the \"crazing\" is in all directions.