# Detecting and Measuring Defects in Wafer Die Using GAN and YOLOv3
## 1 Introduction
[9] used a discrete wavelet transform (DWT) to extract the standard image from three defective IC chip images, and then used the difference between the standard image and the defect image to highlight the defects. [PERSON] et al. [9] also used the image gray-scale matching method to reduce the impact of different brightness on the detection results. This method avoided the alignment problem, but was limited by the need to zoom out to capture the die's repetitive pattern when shooting the image. Since the image resolution was reduced, small defects became difficult to detect. However, the defect inspection algorithms used in AOI systems often need to be highly customized, highly accurate alignments, and rely heavily on experts to design hand-crafted features. As a result, existing algorithms described above cannot be applied to different product types [1; 2; 3; 4; 5; 6; 7; 8; 9]. A cruel truth is that die AOI inspection machines are often idle in practice when the production line is changed. To overcome the above problem, deep learning methods have been introduced into die defect classification in recent years. [PERSON] et al. [10] proposed a four-layer convolutional neural network (CNN) architecture based on stacked convolution and max-pooling to classify five types of die defects. They also used the k nearest neighbor (KNN) in the 3D autoencoder output space to detect unknown defects that were very different from the existing types. [PERSON] et al. [11] designed a six-layer CNN to classify LED chip defects, and used class activation mapping (CAM) to create a heat map corresponding to the analyzed image to locate the defective area. [PERSON] et al. [12] constructed a CNN network based on the separable convolutional and bottleneck for six times to classify four types of die defects. From the existing literature, it finds that deep learning methods are shown not to require any feature extraction process, to be able to avoid shift, rotation, exposure, and so on, which is very powerful and has attracted global attention. However, most studies focused on how to use deep learning methods to solve the problem of die defect classification, while relatively few focused on how to use those to solve the problem of die defect detection. The latter is the focus of the present study and makes a contribution to introduce an object detection method, you only look once version 3 (YOLOv3), to solve the die defect detection problem. The YOLOv3 model is able to predict the center coordinate, width, and height of each bounding box where the defect is located, and the confidence that each bounding box contains a defect. There is no need to rely on experts for feature engineering and have a certain degree of invariance to interference such as translation and rotation, which are attractive characteristics for companies that face constant changes die patterns. In addition, since the particle defects embedded on the dies are very tiny and some of the defects are dense, YOLOv3 uses DarkNet53 as the backbone and introduces multiscale detection, which is able to detect defects of different sizes on the extracted feature maps. In this way it can effectively detect tiny and dense defects, ensuring the quality of the die. Moreover, there is another issue regarding defective samples collection and annotation in the factory environment. Operators do not have much time to collect various appearances of different kinds of defects. Since the collection of defect images is time-consuming, recent research on generating pseudo defective images with GAN has attracted attention. [PERSON] et al. [12] uses affine transformation and naive generative adversarial networks (GAN) to tackle the problem of having unbalanced quantities of defect-free and defective images. They expanded the number of defective images that enhanced the classifier's generalization ability. [PERSON] et al.