## 4 Experimental Results
### Accuracy Analysis for Classifying Normal and Defect Images  
Most defect-inspection systems [13; 16; 17; 22] are focused on the detection and repair capabilities of defect areas, and it is seldom discussed how to classify normal and defect images under image-reconstruction errors. Here, we use three kinds of datasets (nanofiber, carpet, and grid) to conduct the experiments of classifying normal and defect patch images. The Autoencoder models used in this experiment include Simple Autoencoder (SAE), \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Nanofiber** & _Carpet_ & _Grid_ \\ \hline _Model_ & & SSIM:DEC & \\ \hline _Simple AE_ & 300:1 & 140:1 & 80:1 \\ \hline _Inception AE_ & 110:1 & 80:1 & 100:1 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Weighting ratios between SSIM and DEC loss functions for Simple and Inception Autoencoders. Figure 21: Simulation result for higher weight of DEC loss function. (**a**) The defective carpet image. (**b**) The reconstructed image for image (**a**). (**c**) The difference image between images (**a,b**) obtained by SSIM function. Figure 22: The clustering analysis for different cluster number by using the latent vectors of carpet images. (**a**) k = 10. (**b**) k = 40. (**c**) k = 60. Simple Autoencoder + DEC (SAE + DEC), Inception Autoencoder (IAE), and Inception Autoencoder + DEC (IAE + DEC). Since the proposed Autoencoder models use patch images for model training and testing, the classification accuracy analysis of normal and defective images comprises patch image analysis and complete image analysis. The classification method for normal and defective images is described in Section 3.3, and the classification thresholds for three datasets are listed in Table 7.  
Tables 8-10 show the classification accuracy of each kind of dataset. The classification method is determined by whether the fourth Otsu threshold exceeds the classification threshold. If the threshold is greater than the classification threshold, it is a defective image, and if it is less than the classification threshold, it is a normal image. The accuracy of classifying good and defect images is similar to that of MVtec [14], which is defined as the number of correctly classified test images divided by the number of test images. Observing Tables 8-10, it can be found that SAE and IAE have better normal image classification accuracy when the DEC loss function is not added, but the classification of defective images is worse. After adding the DEC loss function, SAE and IAE can improve the accuracy of normal and defective image identification, and the accuracy of defective image classification can be significantly improved. However, on more complex nanofiber images, the classification accuracy of normal images is reduced because the DEC loss function can reduce the reconstruction capability on normal areas, as listed in Table 8. It is interesting that SAE + DEC outperforms IAE + DEC on complex nanofiber images. In addition, we use the AUC (area under the ROC curve) to evaluate the classification performance of the four models. Figure 23 shows the ROC curves for nanofiber, carpet, and grid datasets computed by using different classification thresholds to compare with the fourth Otsu threshold. As shown in Figure 23a, we can see that SAE + DEC has the best performance in the nanofiber dataset, while the performance of IAE + DEC is not as good as IAE. Figure 23b shows the ROC analysis for the carpet dataset in which both SAE + DEC and IAE + DEC have nearly 100% accuracy, showing that the DEC loss function has a positive effect on classification. The ROC analysis on the four models for the grid dataset is shown in Figure 23c, and their accuracies are all equal to or close to 100%. The main reason is that the grid image is regular and has an obvious defect pattern, so it is less likely to be misjudged during classification. In Tables 11-13, we analyze the classification accuracy for complete images that are spliced from the patch images back to complete images.