## 5 Surface Roughness Estimation
### Experiment Results  
Confusion matrix is an effective visualization tool to estimate the performance of classification algorithm. Each column of the confusion matrix represents the instances in a predicted class (output class), while each row represents the instances in an actual class (target class). Figure 17 illustrates the confusion matrix using ResNet model for the 10-pattern recognition problem, where C_i_ means the surface roughness condition in Table 3. As can be seen in Figure 17, the trained model presents a good generalization result, with only 18 misclassifications in the entire 370 testing records. Therefore, the accuracy rate of the proposed method is calculated at 95.14%.  
The metrics used for evaluating the final classification results also include precision, recall and F1 score. Precision is the ratio of correctly predicted positive observations to the total predicted positive observations. Recall is the ratio of correctly predicted positive observations to the all observations in actual class. F1 score is the weighted average of Precision and Recall. Denoted TP as true positives (the value of actual class is yes and the value of predicted class is also yes), FP as false positives (actual class is no and predicted class is yes), FN as false negatives (actual class is yes but predicted class in no), the three evaluation parameters can be defined as [42]:  
Precision = TP/TP + FP Recall = TP/TP + FN F1 Score = 2 \(\times\) (Recall \(\times\) Precision)/(Recall + Precision)  
The results evaluation effects of different surface roughness condition are shown in Table 4. The acquired mean precision, recall and F1 score were 0.9543, 0.9514 and 0.9512 respectively. The result validates the effectiveness of proposed classification method in surface roughness estimation.  
Through visual inspection on the various layers in Figure 18, filter characteristics can be obtained. Filters on the first layer (row 1) show that their main functions lie in the utilization of different brightness contrast ratio to eliminate disturbances of ambient light. Filters on the middle layer (row 2) are used to distinguish background information and main surface roughness information. However, the functions of the filters on the last layer (row 3) are difficult to be explained. It should be noticed that the network function is similar to the surface roughness comparison specimens,  
\begin{table}
\begin{tabular}{c c c c c c c c c c c c} \hline \hline
**Parameters** & **C1** & **C2** & **C3** & **C4** & **C5** & **C6** & **C7** & **C8** & **C9** & **C10** & **Mean** \\ \hline Precision & 1 & 0.95 & 0.94 & 0.86 & 1 & 1 & 0.97 & 0.95 & 0.88 & 1 & 0.95 \\ Recall & 1 & 0.95 & 0.84 & 1 & 0.95 & 0.97 & 1 & 1 & 0.95 & 0.86 & 0.95 \\ F1 score & 1 & 0.95 & 0.89 & 0.93 & 0.97 & 0.99 & 0.99 & 0.97 & 0.91 & 0 which used to tactile and visual comparison of the workpiece surface. Generally, the effect of surface roughness comparison specimens is strongly influenced by the operator prior knowledge and experience. Therefore, the proposed surface roughness estimation method can be a superior alternative for the surface roughness estimation.