## 1 Introduction
Most of the above papers focused on the detection and repair capabilities of defect areas, and seldom discussed how to classify normal and defect images. MVTec [14] built a database for defect inspection, including 5 types of texture images and 10 object images, and evaluated the detection capabilities of 6 defect detection models for 15 types of images. This paper proposes a classification method for normal and defect images, but its accuracy is low. Therefore, in addition to improving the accuracy of repairing defect areas, this paper also focuses on proposing effective methods to improve the accuracy of classification of normal and defect images. Here, we use carpet and grid datasets in the MVTec database to conduct experiments, and compare the performance between the proposed method in this paper and the four models in MVTec [14]. As the Inception network architecture of GoogleNet [24; 25; 26; 27] can provide multi-scale feature-extraction capabilities, we refer to the Inception network to design a new Autoencoder model to improve the feature-extraction and texture-reconstruction capabilities. For normal image reconstruction, we apply SSIM (Structural Similarity Index Measure) [28] as the loss function for network training. For the repair of the defect region, we also use the KL-Divergence function [13; 23] for clustering Latent feature vectors, and enlarge the distance among different clusters, so as to obtain better defect area repair capability. The Inception Autoencoder and traditional Autoencoder networks proposed in this paper will be trained in a two-stage manner. In the first stage, the Autoencoder model is trained with normal images to obtain the basic image-reconstruction capability, and in the second stage, the Autoencoder model combined with a clustering module is trained to obtain the defect area repair capability. Hence, this paper has the following main contributions:  
1. We construct four kinds of Autoencoder models by referring to the structures of Inception architecture in GoogleNet [24; 25; 26; 27] and combine the DEC clustering technology [13; 23] to strengthen the discrimination of the latent vectors. Then, the defect-detection performance including the normal-area-reconstruction error and defect area repair capability are analyzed. Furthermore, SSIM is applied to calculate the similarity between the reconstructed image and the input image for acquiring the defect region. 2. An effective two-stage model training method is proposed to train the model with high normal-area-reconstruction accuracy and defect-area repair capability. In the first stage, the Autoencoder model is trained with a basic defect-reconstruction capability. In the second stage, the DEC loss function is combined with the Autoencoder for the clustering of latent vectors to further strengthen the feature discrimination and increase the capability of repairing defect regions. 3. A novel defect-image-classification method between normal and defective images is proposed by using the multi-thresholding image segmentation algorithm, which outperforms the method mentioned in [14]. Furthermore, with the proposed method, the defect region can be identified precisely. The defect-image-inspection architecture is shown in Figure 3, which includes an encoder module (feature extraction), a decoder module (image reconstruction), and a feature-clustering module. The SSIM loss function is used to train both the encoder and decoder, and is also used in the testing process for computing the difference between the input and output images. Finally, the multi-thresholding module is proposed to classify normal and defect images.