## 3 Experiments and Analysis
### Evaluation of the Images Generated through DCGAN  
Inception score (IS) [20] is a more common metric in the literature to evaluate the quality of the generating image; it is modeled by a pre-trained Inception v3 Net [21] on ImageNet, when the input is the image generated by the generator and the output is the probability that a sample belongs to each target class. For a good generator, we expect the image it generates to be clear, that is, the cross-entropy \(H(y|x)\) of \(p(y|x)\) should be very low, and at the same time, we expect that the image it generates should be diverse, that is, the cross-entropy \(H(y)\) of \(p(y)\) should be very high. IS takes into account both the quality and diversity of the image, and the evaluation equation is as follows:  
\[IS(G)=\exp\Bigg{\{}\frac{1}{N}\sum_{i=1}^{N}p(y|x)\{\log[p(y|x)]-\log[p(y)]\} \Bigg{\}}=\exp\{H(y)-H(y|x)\} \tag{1}\]  
where \(x\) represents the generated image, \(y\) represents the prediction label of the inception model, \(p(y|x)\) represents the probability distribution of the picture belonging to each category, and \(p(y)\) represents the probability of the edge distribution of the image generated by each category. Therefore, a better generator model should have a higher IS value.  
To evaluate the image generation model in this paper, 75 defect samples of each category were randomly selected from the defect images generated by DCGAN to form a test set 1. As a control group, a true defect sample was selected to form Test Set 2. At the same time, in this work, since the gear end face defect data in this article were not ready-made image data in ImageNet, the gear end face defect was classified using the CNN model given in Section 2.2 to calculate the corresponding IS. In Table 5, column 2 shows the score when all defect types are considered together (as a multi-class classification). The last four columns in Table 5 are the scores for separate evaluation of each defect type (as a binary classification). As you can see, the IS of the generated image was slightly lower than the real image. This indicates that the generated image was clear and similar to the real image.  
Figure 7: Experimental equipment layout.  
However, IS is also flawed: it only considers the confidence level of \(p(y|x)\) and \(p(y)\). The accuracy of the classification is not taken into account. If the generated images are classified into the wrong labels with high confidence, the IS of these images will still have a higher value. In order to analyze the correctness of the classification, we calculated the accuracy, which is the ratio of the correctly predicted sample (the sum of true positive and true negative) to all samples,  
\[Accuracy=\frac{TP+TN}{TP+FP+TN+FN} \tag{2}\]  
in the above given equation, \(TP\) refers to the number of defective products that are correctly classified; \(FP\) refers to the number of non-defective products that are mislabeled; \(TN\) refers to the number of non-defective products that are correctly classified; and \(FN\) refers to the number of defective products that are mislabeled.  
As shown in Table 6, the detection accuracy of stains, breakages, scratches, and circles is 96.00%, 98.67%, 98.67%, and 97.33%, respectively. The average accuracy is 97.67%. This shows that DCGAN performs well in terms of generating gear defect data.