# Steel Surface Defect Diagnostics Using Deep Convolutional Neural Network and Class Activation Map
## 4 Experimental Results and Discussion
### Performance of Steel Surface Defect Classification  
Classification accuracy and F1-scores for identifying the steel surface defects are measured among the classifiers, which are generally divided into two categories according to the type of algorithms, \begin{table}
\begin{tabular}{l l l l} \hline \hline
**Class** & **Description** & **The Number of Samples** & **Dimension** \\ \hline
1 & Rolled-in scale & 300 & 200 \(\times\) 200 \\
2 & Patches & 300 & 200 \(\times\) 200 \\
3 & Crazing & 300 & 200 \(\times\) 200 \\
4 & Pitted surface & 300 & 200 \(\times\) 200 \\
5 & Inclusion & 300 & 200 \(\times\) 200 \\
6 & Scratches & 300 & 200 \(\times\) 200 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Description of the data set. Figure 5: Categorical examples of surface defect images. i.e., machine learning (ML) and deep learning (DL) based method. The former method is used to train shallow classification models, i.e., SVM and logistic regression, while the latter one is based on a convolutional neural network with a class activation map. Each model is trained using an optimized hyper-parameters setting of _random search_ method, where 5-fold cross-validation is carried out. Early stopping strategy is also utilized to avoid overfitting problem with a separate validation set while monitoring the training process. Likewise, the performance of the proposed CNN model is evaluated and compared with the trained ML-based models for a comparative purpose. Unlike the DL based models using the end-to-end learning process, a manual feature extraction procedure is beforehand required for the input images of ML algorithms. As previously mentioned in Section 3, GLCM and HOG are deployed to extract numeric feature representations. Figure 6 illustrates examples of extracted features from images. The examples denote both calculated features in crazing and inclusion cases, representing visually distinguishable patterns of textural and gradient-based characteristics. While four kinds of statistical texture features, i.e., ASM, contrast, entropy, and homogeneity, are drawn via the GLCM method, particularly the gradient-based histograms are made up of thousands of gradient amplitudes in the consequence of nine direction bins in each cell. Instead of using the entire histograms extracted from HOG, the optimal 60 components which indicate the highest average accuracy from 5-fold cross-validation are determined via principal component analysis (PCA) (see Figure 6e). The classification performance of traditional ML algorithms, i.e., SVM and logistic regression, are described in Table 3. Generally, it is shown that GLCM has performed better than HOG concerning accuracy and F1-score in both classifiers. It is also proved that features combination model (denoted as GLCM+HOG) outperforms the model with a single feature, given the fact that concatenated two kinds of features are expected to consider not only texture but histogram distribution, thus it is likely to earn more rich representations of the features. In ML-based models, the SVM with GLCM and HOG shows the best performance of 92.22% accuracy and 0.91 F1-score, whereas the one with HOG yields the worst accuracy and F1-score by 78.61% and 0.77, respectively. Figure 6: Examples of extracted features from steel surface defects images. (**a**) An example of GLCM in the crazing case. (**b**) An example of GLCM in the inclusion case. (**c**) An example of HOG visualization in the crazing case. (**d**) An example of HOG visualization in the inclusion case. (**e**) A graph showing changes in 5-fold cross validation accuracy in terms of principal components. Without the manual design of the features, the proposed CNN architecture is established to conduct feature learning and classification throughout the network. The performance of CNN is described in Table 3. The proposed CNN model with hyper-parameter optimization attains a remarkable performance in both accuracy and F1-score, compared to the ML-based models.