# Detecting and Measuring Defects in Wafer Die Using GAN and YOLOv3
## 3 Analysis and Results of the Experiments
### Results of Die Defect Detection and Measurement  
After deciding the hyperparameters of the GAN + YOLOv3 model and training the model, defect detection and measurement of the remaining test images were performed. The pipeline of the testing process first inferred the predicted bounding boxes of the defects through YOLOv3. Then, the major and the minor axis of the defects were measured for the content inside the bounding box. After the inference was completed, different evaluation metrics were used to measure the generalization ability of the proposed algorithm. The testing AP was used to measure the performance of the predicted bounding boxes: after the testing image set was inferred by the object detection method, the predicted bounding boxes were compared with the ground truth boxes, and the average of the maximum precision values calculated  
Figure 5: Comparison of defect images. (**a1,a2**) Original defects and (**b1,b2**) pseudo defects. Figure 6: The main effect plot of 3\({}^{4}\) design of the experiment (DOE). when recall \(\geq\) 0, 0.1,..., 1.0. Coordinate prediction error was used to measure the accuracy of the coordinate prediction: after the testing image set was inferred by the object detection method, the closeness of the center coordinates, length, and width of the predicted bounding boxes were compared with those of the ground truth boxes, which could be calculated through the first two items in Equation (A2) of Appendix A. Figure 7 demonstrates the patches of defect detection results. When inputting the die image of the product, as shown in Figure 7(a1-a4), the model precisely box-bounds the corresponding particles, as in Figure 7(b1-b4). The testing blocks in Figure 7(b1-b4) are not falsely box-bounded. YOLOv3 is able to discriminate between irregular-shaped particles and rectangular testing blocks. The model effectively detected particle defects on the surface of the die, and even very small defects could be detected successfully. In order to further demonstrate the performance improvement of the GAN-based image augmentation technology for the detection of particle defects on the dies, this research also constructed the YOLOv3 model, the GAN + YOLOv3 model (augmenting 1.5 times the training sample), the GAN + YOLOv3 model (augmenting 2 times the training sample), and the CycleGAN + YOLOv3 model (augmenting 1.5 times the training sample). After the training of the four models was completed, the study used the testing AP and the testing coordinate prediction error to evaluate the models on testing images. Before calculating AP, the precision-recall (PR) curve of each model was drawn as shown in Figure 8. The pseudo defective die image generated by the GAN could work along well with the true defective die image to train the YOLOv3. In addition, when GAN helped to increase the training image by about 1.5 times, the PR curve tended to converge as shown in Figure 8, and the corresponding testing AP jumped from 81.39% to more than 88%, an increase of about 7% as shown in the second column of Table 2. As indicated by the results of the testing coordinate prediction error indicator, the coordinates and length and width of the predicted bounding boxes and the ground truth boxes, were very close to the ground truth labels. Even without the help of the GAN, the bounding box error predicted by the naive YOLOv3 model was below three decimal places. After adding the GAN, the testing coordinate prediction error could be reduced to a level below four decimal places as shown in the last column of Table 2. This experiment shows that the pseudo defect images generated by the GAN play an important role in enriching the diversity of defects, which helps to improve the efficacy  
Figure 7: Defect detection results by GAN + YOLOv3. (**a1–a4**) Images to be inspected and (**b1–b4**) detection results. and versatility of the model. Beside, we also compared the CycleGAN + YOLOv3 with proposed GAN + YOLOv3.