# A Generic Automated Surface Defect Detection Based on a Bilinear Model
## 3 Experiments
### Contrast Experiments
#### 3.3.2 Real Collected Datasets
The classification results of the comparative experiments on this dataset are shown in Table 4.  
It can be seen from Table 4 that even if there is a task of defect detection with strong interference factors, the detection accuracy of the proposed method is still nearly 6% higher than that of BCNN. (C) Evaluation of Binary Classification Performance: The above experiments have shown that the average precision of the proposed method on four datasets is higher than that of other methods. However, the detection rate of defects and the precision of non-defects are often emphasized in defect detection, and at this time, only the dataset is divided into defects and non-defects. TP and TN denote the number of true positives and true negatives respectively, FP and FN denote the number of false positives and false negatives, respectively. Then the definitions of the Precision Rate (PR), True Positive Rate (TPR), False Positive Rate (FPR) and False Negative Rate (FNR) are as follows. \[PR=\frac{TP}{TP+FP} \tag{7}\]  
\[TPR=\frac{TP}{TP+FN} \tag{8}\]  
\[FPR=\frac{FP}{FP+TN} \tag{9}\]  
\[FNR=\frac{FN}{FN+TP} \tag{10}\]  
Results of the four methods PR, TPR, FPR and FNR on the diode glass bulb and fluorescent magnetic powder surface defect dataset are shown in Table 5.  
Precision Rate and True Positive Rate are often a pair of contradiction measure, and generally speaking, when the Precision Rate is high, the True Positive Rate tends to be low, and the higher True Positive Rate, the lower the Precision Rate. Therefore, the Precision Rate and the True Positive Rate cannot accurately reflect the effectiveness of the detection method, but usually \(F_{1}\) is used, which is defined as follows. \[F_{1}=\frac{2\times PR\times TPR}{PR+TPR} \tag{11}\]  
\(F_{1}\) value of GLCM + MLP, gcForest, BCNN and the proposed method on the diode glass bulb surface defect dataset and fluorescent magnetic powder surface defect dataset are shown in Figure 12. \begin{table}
\begin{tabular}{c c} \hline \hline
**Method** & **Average Precision** \\ \hline GLCM + MLP & 90.56\% \\ gcForest & 92.59\% \\ BCNN & 93.33\% \\ Ours & 99.13\% \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Comparison of results on fluorescent magnetic powder surface defect dataset. \begin{table}
\begin{tabular}{c c} \hline \hline
**Method** & **Average Precision** \\ \hline GLCM + MLP & 90.56\% \\ gcForest & 92.59\% \\ BCNN & 93.33\% \\ Ours & 99.13\% \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Comparison of results on fluorescent magnetic powder surface defect dataset. The results are shown in Figure 12. The proposed surface defect detection method achieves a higher \(F_{1}\) among all of the methods. It outperforms both methods combining statistical features with machine learning (GLCM + MLP) and the generic deep learning method based on a Convolutional Neural Network (BCNN). There are many kinds of defects in actual industrial production, and one method which works well in a specific category is usually not applicable to the other types of defects. Experimental results show that the surface defect detection method proposed in this paper demonstrates excellent detection performance in surface defects with features of texture, shape and color. Furthermore, it can simultaneously realize an automatic localization and classification of defects. In the prediction phase, it takes an average of 0.292 s to a localization and classification of defects for an image at the same time.