# Stain Defect Classification by Gabor Filter and Dual-Stream Convolutional Neural Network
## 5 Experimental Result
### Compact Camera Module Dataset  
The CCM dataset [31] is where a stain defect exists in the cover of the camera module. Figure 7 shows an example of a CCM dataset. Table 5 shows the number of training, validation, and evaluation data of the CCM dataset used in the experiment. In this paper, the 2048 \(\times\) 2048 CCM image is divided into 224 \(\times\) 224 image patches, and then the image patch is trained with CNN to generate a stain defect classification model. The MT stain defect dataset is labeled as a stain defect if a stain defect is included in the image patch region in the ground truth image. Meanwhile, it is labeled as \"OK\" if it is excluded. The CNN receives an image patch and outputs the classification result of each image patch. In the classification result of each image patch, the image was classified as a stain defect if even one image patch was a stain defect. Otherwise, it was classified as OK if none of the image patches was a stain defect.  
Table 6 shows the classification performance according to the CNN structure and gray and Gabor filter images select method. As shown in Table 6, the F1-score shows the highest performance with 97.6 when using eight Gabor filter images. It improved by about 11.1 percent compared to the network trained by inputting only Gray Image. Through this, it was confirmed that the Gabor filter was effective in detecting stains. In addition, Single-stream or dual-stream inputting Gray Image and Gabor image together can confirm that the accuracy is slightly reduced, but both methods can confirm that the accuracy is increased compared to the network using only Gray Image.  
Table 7 shows the comparison results with the existing defect detection method using the CCM data set. Among the comparative experiments, the proposed method had the highest F1-score. In the case of SEGDEC and MCuePush, defects were output from OK images as the method for detecting defects using the segmentation network. In addition, the CS-Flow method, in which only OK images were input, classified all images as stain images.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Method** & **Precision** & **Recall** & **F1-Score** \\ \hline SEGDEC & 75.1 & 92.2 & 82.0 \\ MCuePush & 98.6 & 96.6 & 97.6 \\ CS-FLOW & 99.6 & 90.4 & 94.7 \\ Proposed & 96.7 & 99.0 & 97.8 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Performance of defect detection method on magnetic tile dataset.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Network Structure** & **Number of Gray Image** & **Number of Gabor Images** & **Precision** & **Recall** & **F1-Score** \\ \hline Single-stream & 1 & 0 & 93.2 & 97.6 & 95.3 \\ \hline Single-stream & 0 & 8 & 96.7 & 99.0 & 97.8 \\ \hline Single-stream & 1 & 8 & 96.5 & 99.0 & 97.7 \\ \hline Dual-stream & 1 & 8 & 95.8 & 99.4 & 97.6 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Performance of proposed method on magnetic tile dataset.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Type** & **Train** & **Validation** & **Test** \\ \hline OK & 353 & 96 & 100 \\ Stain & 346 & 82 & 100 \\ \hline Total & 699 & 178 & 200 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Compact camera module dataset.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Network Structure** & **Number of Gray Image** & **Number of Gabor Images** & **Precision** & **Recall** & **F1-Score** \\ \hline Single-stream & 1 & 0 & 79.6 & 93.2 & 85.7 \\ \hline Single-stream & 0 & 8 & 96.6 & 97.2 & 96.8 \\ \hline Single-stream & 1 & 8 & 92.7 & 92.2 & 92.3 \\ \hline Dual-stream & 1 & 8 & 89.5 & 93.0 & 91.1 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Performance of proposed method on compact camera module dataset.  
Figure 7: Compact Camera Module Dataset (**Left**: image, **Right**: Stain Defect segmentation image).