Development of an adaptive template for fast detection of lithographic patterns of light-emitting diode chips

With the expansion in light-emitting diode (LED) lighting market and technology, control of product quality has become the focus of LED development. To achieve high online production capacity, automated quality detection with object image has been employed for comparison using mostly the standard templates. However, the resulting poor fitting causes misjudgment of the detection system. This study proposes an adaptive template method to improve the system fitting, reduce the system misjudgment, and enhance the detection efficiency. The severely damaged LED chips were screened out based on their grayscale entropy indices and related coefficient indices, which enhanced the reliability of the adaptive template system and accelerated the overall system detection process. To overcome the displacement and scale changes of the lithographic patterns, the scale-invariant feature transform (SIFT) and Harris–Laplace methods were used for comparison. The scale-invariant feature transform (SIFT) and Harris–Laplace methods were used to search and compare the feature points of the chip patterns, with the aim to overcome the displacement and scale changes of the lithographic patterns and establish the adaptive template in real conditions. The fast correlation coefficient comparison method was compared with the adaptive template comparison method proposed in this study. The results showed that the detection accuracy of the new method was 98.36%, which is 15.79% more accurate than the fast correlation coefficient comparison method. In terms of time performance, the method proposed in this study took 0.08 s less to complete the partition defect template. Moreover, the average detection time per chip was reduced by another 1.4 s, which improved the efficiency by 30.43%. The adaptive template proposed in this study exclusively establish itself based on different lithographic patterns, thus improving the detection efficiency and accuracy of the LED industry, and raising its market competitiveness in the industry.


Introduction
In recent years, energy demand has increased across the world, leading to rising prices. Energy-saving and high-efficiency lighting have gradually become the focus of energy development [1]. The light-emitting diode (LED) has the advantages of low energy consumption, high brightness, and long service life [2], which is a new development focus in lighting systems [3]. To form lithographic patterns on LED chips, as shown in Figure 1a, lithographic optical and chemical etching procedures are required, with a variety of light masks [4] and optical path projection systems [5]. However, in the lithographic optical process, the poor location of the lithographic masks and the poor quality of wafer result in the displacement and scale changes of the different layers of light mask patterns. The lithographic optical system is shown in Fig. 1a. In Fig. 1b, there is a significant displacement of the two chips on the lithographic patterns. When the standard template is used for detection, there will be dismatching as leakage or overkill during detection due to poor fitting. However, once the displacement of the object has been overcome, the templated matching could be considered as a fast detection method [6].
Machine vision technology is now using for quality inspection and automatic inspection, since considerable personnel resources may generate corresponding misjudgment due to human fatigue [7]. The measurement of the lithographic mask variation in each layer of LED chips is mainly divided into two steps: segmentation of image blocks and location of feature points. The lithographic patterns of LED chips include the finger electrode area, pad electrode area, light-emitting area, and mesa area, as shown in Fig. 2. In practical application, three problems arise during object detection: (1) variant scale of object, (2) deformations of intra-class objects, and (3) cluttered edges between the background and object. These problems can lead to confusion during object location and detection [8]. For the best segmentation index to extract the lithographic patterns in each layer, related research on location of feature points is divided into the area-based method [9][10][11] and the feature-based method [12][13][14].
The area-based method refers to finding the correlation coefficient of a specific area between two images. The fast normalized cross correlation (FNCC) is the most famous method for finding this relationship [15]. It is widely used for similar inspection and dectetion [16]. Kuo et al. [17] proposed a robust template matching technique to improve the time and accuracy for printed circuit boards (PCB). The results proved that the template matching technique not only has sub-pixel level high accuracy and short computing time but also robust rotation change and scale change interference.
Stefano et al. [18] proposed an area-based stereo algorithm, referred to as a single matching phase (SMP), which is suitable for real-time applications. The algorithm is based on core matching and checks the validity of a match directly at the comparison stage without reverse matching. We know from the literature that once the correlation coefficient has been normalized, it becomes more stable and suitable for rapid template comparison. Wang et al. [19] presented the camera calibration algorithm of the LED chip visual positioning system to improve the chip positioning accuracy. Through error analysis of the visual positioning system, the system errors of each part of the system were obtained, and the relationship between the chip positioning error and the chip position distribution in the image was found. Then, based on the results of error analysis and the characteristics of the chip positioning process, an improved calibration algorithm was proposed to improve the chip positioning accuracy Perng et al. [20] demonstrated a machine vision system combined the inspection area (IR) method automatically generated to inspect two types of LED surface mount devices (SMD). The proposed automatic inspection method could achieve 95% accuracy. The detected defects included missing components, wrong orientation, reverse polarity, mouse bites, missing gold wires, and surface stains.
For the feature-based method, the main instructions for finding the key points are as follows: (1) the dominant gradient orientation of the local interest region around the feature points must be estimated from the local appearance and geometry; (2) the direction of the line linking two nearby feature points must be consistent with the local geometry [21,22]. Harris et al. [23] proposed an algorithm for detecting corner points and edge points in separate studies of research [24,25]. They used the  function eigenvalue formed by Taylor expansion and similarity comparison in the detection template to determine whether the corresponding points in the template were corner points, and then screened out the feature points based on the corner points. Smith and Brady [26] proposed a set of corner point detection methods to calculate the pixel changes and extract the corner points with a detection template, using the path movement mode [27], which is also called the Susan corner point operation. In the Harris and Susan feature point detection, the corner point operator only has displacement-, grayscale-, and rotation-invariant features, but does not have a scale-invariant feature. To apply the feature point comparison to the objects with scale changes, as there are scale changes between sample layers in this study, the scale-invariant search method is adopted. Zhang et al. [28] used blob analyzation-based template matching algorithm for LED chip localization to solve the elimination of polycrystalline and fragmented LED chips. The image segmentation method was used to obtain spots, exclude abnormal spots, and predict the pose (position and direction) of potential objects. Precise positioning of LED chips based on gradient direction characteristics. Yan et al. [29] detected typical surface defects of aluminum alloy welds; the structured laser was responsible for obtaining 3D depth images of the bead surface. The multi-angle illumination was used to capture grayscale images. According to the different features shown in the 3D depth map and the 2D grayscale map, extracting the weld boundary was presented. Lowe [30] applied the scale-invariant feature transform (SIFT) method, which extracted feature points through Gaussian pyramid decomposition and difference of Gaussians (DoG) [31,32], and then generated feature vectors to search features. The SIFT method can provide rotation-and scale-invariant features, and achieve robustness against environmental interference. A subsequent study by Se et al. [33] employed the SIFT method to address the combination of location and reality maps. The Harris-Laplace algor i t h m m e t h o d w a s d e v e l o p e d t o e x t r a c t t h e scale-invariant feature points [34][35][36]. Through the image pyramid decomposition and DoG calculation, Harris corner point detection can be used to search layered regional feature points. Specifically, the optimal effect is to decompose the four-level scale factors, and the extracted normalized feature points are invariant in terms of scale, rotation, and displacement [37,38]. SIFT and other invariant moments have been more recently cited for comparison, due to their reproducibility. Therefore, in this study, the SIFT and Harris-Laplace methods have been used to explore the scale-invariant moments. Zhang et al. [39] improved the Harris-Laplace method for higher repeatability, using all points in the image with the largest scale in the scale-space as tracked and grouped. The experimental results showed the effectiveness of the inspection, with an average inspection time of 8.78 ms per die and an average accuracy 92.4%.
The shortcoming of the SIFT and Harris-Laplace methods is that the image information calculation workload is huge during the comparison of feature points of the standard images and comparison images, which greatly slows down the comparison process. Therefore, the comparison method must be improved in practice to meet the demand for high production speed. To extract the feature points in this study, SIFT and Harris-Laplace methods were used to search for feature points due to their scale invariance, and to detect the feature points of the chip patterns. Correlation coefficient matching was used to obtain the integrity index of the LED chip layers, and compared to template matching for fast pre-screening. The feature points were quickly searched and accurately located by area-based search. Next, the feature areas were located by the template comparison method. An adaptive template that matched the chip was established based on the location of light masks, in order to overcome the displacement and scale changes between the mask patterns in the different layers, and to achieve the fastest fitting effect.

Methods
In this study, the SIFT and Harris-Laplace methods were used to search for the feature areas on the LED chip patterns and analyze the LED chip lithographic patterns for adaptive template development. The feature area-based template comparison method was used to accelerate the location of feature points. Through the lithographic layered information of the located points, an adaptive template was established. To improve the location accuracy of adaptive template comparison, a fast chip integrity screening algorithm was introduced before the locating process to improve the efficiency of system judgment.

Fast chip integrity screening
Statistical analysis showed that the surface patterns of the chip whose images were extracted from the wafer were severely damaged or heavily contaminated, which caused misjudgment of the locating system and increased a lot of meaningless computing workload. Before an adaptive template was established, a fast screening algorithm was introduced to improve its locating feasibility. The process is shown in Fig. 3.

Grayscale entropy index
In this study, prior to integrity screening of the lithographic patterns of the chip, the optimal judgment index of the chip structure was analyzed in advance, and the grayscale distribution and the pattern gradient were compared. There were obvious differences in the grayscales of different areas in the LED chip patterns, as shown in Fig. 4. The chip's lithographic patterns extracted by the grayscale distribution were more accurate than those extracted by the pattern gradient.
As shown in Fig. 5, there are obvious peaks in the grayscale histogram of the non-defective samples, while the cumulative peak pixels in the defective chip histogram are lower. Therefore, the defective chips can be identified by histogram analysis of the grayscale distribution indices, which refer to the range marked by the line segment in Fig. 5d.

Correlation coefficient index
As the grayscale index range of the defective chips was close to the grayscale index range of the non-defective chips, it was difficult to fast-screen the severely damaged chips. The correlation coefficient was used as an auxiliary index to screen out chips with severely damaged lithographic patterns, thus avoiding errors during the subsequent establishment of the adaptive template.
The fast correlation coefficient comparison method can find the correlation between the detected image and the standard template image. For a detected image f(x, y) of size M×N pixels, when the goal is to search for a standard template image r(i, j) of size m×n pixels, the process can be achieved where f is the mean grayscale in the detected image window, r is the mean grayscale in the standard image window, and s f and s r are the standard deviations of the grayscale in the standard image comparison window. Due to the displacement and scaling differences between the chip patterns, the blurring effect was introduced in the standard template to relax parameters of the comparison template and alleviate the poor fitting caused by changes between layers. In the blurring method, which is based on the Gaussian blur function, a convolution integral is evaluated on the standard template image with a Gaussian blur function structure of dimensions 5 ×5, as shown in Fig. 6.

Extraction of chip feature areas
The search for feature points must overcome the displacement and scale changes between layers of the LED chip's  lithographic patterns. The SIFT and Harris-Laplace methods were adopted to judge and analyze the feature points.

SIFT feature point search method
The SIFT algorithm includes scale space generation, feature point extraction, and feature vector statistics. The purpose of feature vector statistics is to calculate the change in images of the same object using vectors. In the SIFT feature point extraction, the feature points were extracted by the image of the DoG to analyze the feature points of a single image. First, the scale smoothing filter function in the image scale space was defined as follows: where G(x, y, σ) is the two-dimensional Gaussian blur function, I(x, y) is the original image, L(x, y, σ) is the scale space, and σ is the Gaussian scale factor. The Gaussian blur function was used to evaluate the convolution integral on the original image to obtain the scale space.
Then, the exponential rate of k was introduced into the Gaussian blur function to obtain the blurring effect at different levels and rates. In this study, k was set to ffiffi ffi 2 p and imported into different scale spaces. Then, blurred images at adjacent levels were subtracted and convolved with the original images to obtain the difference of Gaussians space. The schematic diagram is shown in Fig. 7.
The local extreme point was detected in the difference of Gaussians image and compared with a total of 26 pixels. The relative maximum or minimum was the local feature point of the image, as shown in Fig. 8.
The feature points extracted from the local feature points may include low-contrast feature points and boundary noise points. The scale space function D(x, y, σ) was expanded into quadratic terms via Taylor expansion around the local extreme where x = x(x, y, σ) T is the displacement of the local feature points, and is assumed to be 0. In Eq. (8), D(x)can be used to calculate the extreme b x of the sample displacement. If the extreme is higher than threshold, the local feature points are regarded as unstable and removed, which can improve the stability and accuracy of the low-contrast feature point search.
After the SIFT calculation on the LED chips, the SIFT feature point distribution was obtained as shown in Fig. 9.
As the feature points were located in the grayscale blocks instead of at the pattern boundaries, if the grayscale in the area was different or defective, the system was more likely to make errors in the locating judgment, and it was not easy to reach the hierarchical location of each lithographic pattern. Therefore, the feature points were introduced to the Harris-Laplace feature point for the judgment.

Harris-Laplace feature point search method
Both the Harris-Laplace algorithm and the SIFT algorithm adopt the Gaussian pyramid and difference of Gaussians as the feature extraction space. Harris corner point detection was introduced into the K-level [11] to detect the boundary corner points in the level and match them to the coordinates in the K-1 layer. The boundary corner points detected at a higher level, i.e., the boundary corner points detected at a more blurred level, showed more stable feature points and higher calculation weights, as shown in Fig. 10.
Compared with the SIFT feature point comparison method, the feature points of the Harris-Laplace method were distributed at the boundary corner points of the lithographic patterns, which is similar to the case with the LED chip lithographic layered block. After chips were calculated by the Harris-Laplace algorithm, the distribution of the Harris-Laplace feature points was as shown in Fig. 11.

Feature area template locating method
The matching step of the SIFT and Harris-Laplace methods requires two searches of the feature points, and the direction vector of the feature points must be calculated. The huge calculation workload increases the processing time. In the case of an image of size 180 × 180 pixels, the required comparison time is about 4.6 s. To meet the requirements of industrial production lines, the Harris-Laplace method was adopted to train the feature areas, and then select the near trained feature points adjacent to the pixel areas as the feature area template, as shown in Fig. 12. In the figure, the dotted line is the light mask in the light-emitting area measured by the template, the black box is the light mask in the finger electrode area measured by the template, and the gray box is the light mask in the pad electrode area measured by the template. Feature area template comparison was then adopted to explore the relative location of the locating points between templates and calculate the relative displacement and scale changes between templates, which shortened the comparison time.
In its locating process, the feature area template was divided into 13 × 13 pixels and 13 × 25 pixels, and the centroid coordinates of each feature area template were regarded as the location of the corresponding feature area pattern. Then, the locating points on the LED chip patterns were determined through the feature template search, and the influencing parameters of the displacement and scale changes between the light masks were obtained. The pre-established standard template was adjusted based on the affine transformation of the influencing parameters. As shown in Figure 13a-c, the standard template was adjusted to fit the locating points of each chip pattern area. Later, the adjusted standard template and the center reference point of the adaptive template were superimposed on the chip pattern so that the adaptive template fitted the chip pattern. The locating of the feature area template and the establishment of the adjusted adaptive template are shown in Fig. 13. The affine transformation operation is shown in Eq. (9).
where r and c are the coordinates of the standard template; a 11 , a 12 , a 21 , and a 22 are the conversion parameters, which can adjust the rotation or zoom of the images; t r and t c are the displacement parameters; r′ and c′ are the coordinates of the standard template converted to the adaptive template. The transformation and translation parameters in the affine transformation were changed to translate, scale, and rotate images

Optimal template boundary fitting
During the fitting process of the adaptive template, a poor fitting occurs at boundaries if the adaptive template is directly compared to the LED chip and template, as shown in Fig. 14. This is because the chip lithographic process leads to inconspicuous contrast at the chip lithographic pattern boundary. Therefore, a Gaussian blur function was used to smooth boundaries of the established adaptive template and set the binarization threshold to achieve the optimal template boundary fitting effect. A 13-pixel line-width was used as the standard template for the finger electrode area, and the adaptive template was blurred by a Gaussian blur function of dimensions 3 × 3 pixels, as shown in Fig. 15. The fitted adaptive chip template was subtracted from the original chip image to extract the defects, as shown in Fig. 16a. Then, the multi-area growth method was used to separate defects into different pattern areas so that the system can judge defects (see Fig. 16c-e).
The overall process in this study was divided into two stages, as shown in Fig. 17. The first was the image preprocessing stage. Here, the wafer image was segmented to obtain the chip sub-images, and the chip pattern integrity was fast-screened. The second was the adaptive template establishment stage. In this stage, the feature points were located quickly through the screened chip image, and the adaptive template was established. Finally, the image's defects were extracted to assist the user in detection.

Experimental details
The chip sample in this study was the LED wafer images captured by the LED detector shown in Fig. 18a. These LED wafer images were divided into LED chip sub-images through digital image processing, as shown in Fig. 18b. The LED chip sample used included the finger electrode area, pad electrode area, light-emitting area, and mesa area, as shown in Fig. 18c. The detection specifications for this chip are shown in Table 1. Specifically, the light gray stripe is the finger electrode area, the middle circle is the pad electrode area, the gray background is the light-emitting area, and the peripheral white area is the mesa area.

Image extractor and measurement system
The LED wafer image samples used in this study were extracted by the self-designed automated optical detector shown in Fig. 19. The relevant shooting environments and parameters are shown in Table 2. Figure 20 shows the steps involved in the image preprocessing. In the image preprocessing, the wafer images   extracted by the automated detector were analyzed. First, the wafer images extracted by the system were median-filtered to eliminate the background blue film texture of the back wafer and avoid excessive noise in subsequent processing. Then, the filtered images were subjected to the Sobel edge calculation to completely select the chip boundary. The morphological opening and closing operations were performed to intensify the chip boundary images and eliminate the tiny image noises. Next, the area was filled according to the chip boundaries to form the LED wafer shield and facilitate the extraction of wafer sub-images. Depending on the connection marks, the convolution integral was evaluated on the LED wafer shield and the original images to extract the chip images. The extracted chip frame was externally rotated to ensure that the extracted chip had no frame rotation variables.   Figure 21 shows the adaptive template comparison process of this study. The comparison and correction aimed to stretch the contrast of the fast-screened chip images to intensify the chip boundaries. In this study, the Harris-Laplace feature areas of chips were located using the feature template method. According to the feature area template method, the feature points of the input chips were located, while the relative positions of the feature points were used to discuss variables in each layer. Next, the adaptive template was adjusted according to variables to fit the chip. Then, boundaries of the adaptive template were fitted using a Gaussian blur function to reach an optimal template comparison effect and extract the image's defects.

Receiver operating characteristic curve
The receiver operating characteristic (ROC) curve [40,41] was used in this study for overall evaluation and verification. Using the confusion matrix (see Table 3) and the related ROC equations (see Eqs. (10)-(12)), the judgment of the dominant and recessive samples by the system can be displayed and the judgment results are summarized by the ROC curve. The related ROC equations are as follows: where P is the total number of positive samples, N is the total number of negative samples, TP (true positive) is the number of actually positive samples that were judged as positive, TN (true negative) is the number of actually negative samples that were judged as negative, FN (false negative) is the number of actually positive samples that were judged as negative, FP (false positive) is the number of actually negative samples that were judged as positive, TPR (true positive rate) is the ratio of TP samples to all positive samples, FPR (false positive rate) is the ratio of FP samples to all negative samples, and ACC (accuracy) is the overall system correction rate.
The system ROC curve can be obtained from the above parameters as shown in Fig. 22, where the horizontal axis is the FPR and the vertical axis is the TPR. If the judgment results are closer to the upper left, the system judgment accuracy is higher; if the judgment results are closer to the lower right corner, the system judgment accuracy is lower. The diagonal line is the zero recognition line. If the judgment results are on the diagonal line, the system has no recognition ability. Among curves A, B, and C in the figure, the system represented by curve A has the best judgment effect, followed by the system represented by curve B. Curve C is lower than the zero recognition line, which indicates that the probability of incorrect judgment of the system represented by curve C is higher than the probability of correct judgment. As ROC cannot be used as a binary recognition system, advantages and disadvantages of the system can be quickly resolved by the ROC curve.   Fig. 19 Detector system 3.5 Training of the grayscale entropy screening threshold during fast screening Before the adaptive template was established, the severely damaged chips were removed, through fast screening of the chip pattern integrity, to improve the locating accuracy of the feature points. During rapid screening, the grayscale entropies of the defective and non-defective chips were very different. Therefore, the index threshold was selected based on the non-defective chips, and all the LED chips were described according to the definition of defects in Table 1. A total of 50 non-defective chips were selected for analysis, and the six sigma was adopted to select the threshold.
The grayscale entropy E, total average, and standard deviation of 50 groups of non-defective chip samples were calculated. According to the definition of six sigma [42,43], the total average and the total average ± six sigma were used to    (17).
In this study, the grayscale entropy range of the trained 50 groups of non-defective chips was calculated, and results are shown in Table 4

Training of the correlation coefficient screening threshold during fast screening
In this study, the correlation coefficient index was used to judge whether chips were defective or not. During the screening of the correlation coefficient index, the ROC parameters were used to select the threshold. During the extraction of training samples, as shown in Fig. 26, all the LED chip samples were randomly sampled, and the No. 1 to No. 100 chips were trained subsequently. Defects of the 100 chips were detected according to the detection specifications in Table 1. The defect detection results were compared with the defect detection results of the screened chips under different correlation coefficients to obtain the correct judgment, leakage, and overkill phenomenon. The highest ACC was 0.75, and the correlation coefficient threshold was set to 0.92, as shown in Table 5. The defective pattern is shown in Fig. 27.

Impact of fast screening on location of the adaptive template
All the LED chip samples were fast-screened based on the grayscale entropy index interval [14473,34897], and the   correlation coefficient index after training was 0.92. However, for each of the 364 chips, it took 9.951 s to read images and statistically deduce the grayscale entropy index, 8.677 s to calculate the correlation coefficient index, and only 0.052 s on average to screen one chip. After fast screening, the system removed 60 severely defective chips out of the 364 chips, and no overkill occurred. The 60 severely defective chips were fast-screened and then confirmed by location of the feature area template. Next, the impact of the chips on location of the adaptive template was reconfirmed, of which only No. 46 chip is located through the auxiliary locating points. As shown in Fig.  28a, b, the locating points in the upper right corner of the mesa area were affected by the defective block, resulting in poor location. However, as location of the mesa area template was aided by the locating points in the lower right and upper left corners, the establishment of the adaptive template was not affected. The remaining screened chips could not be accurately positioned. In Fig. 29d, e, chips could not be located due to severe defects. Therefore, fast screening can greatly improve    Correct   judgment  69  70  70  70  71  73  73  75  74  70  64  46   Leakage  31  30  30  30  29  27  27  25  25  20

Location results of the adaptive template
By searching the feature area template, the locating points of the chip patterns were obtained to establish the adaptive template and fit the LED chip patterns. The sizes of the feature area template were 13 × 13 pixels and 13 × 25 pixels. When the adaptive template was actually established and defects were extracted, it took about 0.14 s to establish a chip and about 0.11 s to extract defects. Therefore, it took about 0.25 s in total to establish the adaptive template and extract defects.
The layered areas of the LED chips were located by 12 locating points when the template was established. Specifically, there were three layered areas each located by four locating points respectively: areas included the pad electrode area, finger electrode area, and light-emitting area. During the experiment, as some chip's defects were located in the feature area template, the template locating center was set as the reference point, when the layered areas were located using the standard template, to avoid poor template location; this is shown in Fig. 30.
In the pad electrode area, four locating points were used to locate the layered areas, as shown in Fig. 31a. The displacement of the upper locating points affected by defects was determined according to the locating points and the reference point. When only one locating point was affected, the remaining three locating points and the reference point were used to locate the adaptive template, as shown in Fig. 31b. The relationship between the locating points and the reference points in the finger electrode area and in the light-emitting area was the same, as shown in Figs. 32 and 33. The overall locating system can be more stable during the correction process of the locating points.

Detection rate of adaptive template comparison
The defective areas in the 304 fast-screened LED chips were calculated with the adaptive template comparison system, according to the LED chip detection specifications. The defect threshold was 130 pixels in the electrode area, 50 pixels in the light-emitting area, and 180 pixels in the mesa area. The detection rate was analyzed based on the number of statistical defects and the number of actual defects. As a result, 223 chips were correctly judged as non-defective, 76 chips were correctly judged as defective, two chips were overkilled, and three chips were leaked, as shown in Table 6.
(Unit: pixels) As shown in Table 7, the adaptive template comparison method had a correct judgment rate of 99.11% for non-defective samples and 96.12% for defective samples. The overall detection rate of the adaptive template comparison   Fig. 34 are also close to the upper left corner, which indicates that the system had a high accuracy.
The ROC parameters are as follows: FPR : During image subtraction, the chip whose defective area was close to the screening threshold or whose defect contrast was low were prone to leakage. Figures 35 and 36 show the leakage of the defective area with low contrast. In Fig. 37, the defective area of the mesa area is small, but has penetrated the light-emitting area. According to the defect specifications, it was judged as a defective chip, which caused the leakage.
The overkill phenomenon occurred during adaptive template comparison because the positioning was

Detection and verification of the template comparison method
Industrial automation detectors often adopt standard template comparison algorithms whose comparison speeds meet the  Regarding the chip samples, there was a huge process error between the lithographic patterns of the different mask layers. During detection, the detection parameters must be relaxed to conform to detection standards. The standard template comparison method and the proposed adaptive template comparison method were used to compare and verify results, as well as to explain the pros and cons of the method.

Detection rate of the template comparison method
The template comparison system was used to detect the 304 fast-screened chips. Defects were judged based on the defective areas of chips, and the number of defective and non-defective chips was obtained to analyze the detection rate. The detection results included the leakage of 32 chips and the overkill of 21 chips. Then, the ROC confusion matrix was used to explore the impact of the template comparison method on the system detection rate and obtain the verification indicators, as shown in Table 8 and Eqs. (21)- (23).
The ROC parameters are as follows: The results of the template comparison method show that the correct judgment rate of the non-defective samples was 90.67%, the correct judgment rate of the defective samples was only 59.49%, and the overall detection rate of the template comparison method was 82.57%.

Detection rate of the adaptive template
The extracted LED chip sub-images contained a total of 364 chips, including 255 non-defective chips and 139 defective chips. Specifically, 359 chips were correctly judged, three chips were leaked, and two chips were overkilled. From the confusion matrix and related verification indicators of the ROC, the correct judgment rate of the non-defective samples and defective samples and the overall detection rate are deduced. The related equations are shown in Table 9 and Eqs. (24) to (26).
The ROC parameters are as follows: As shown in Table 9, when the fast screening was combined with the adaptive template comparison method, the correct judgment rate of the non-defective samples was 99.11%, the correct judgment rate of the defective samples was 97.84%, and the overall detection rate of the template comparison method was 98.63%. The results indicate that the overall detection system in this study had a high detection accuracy.
Comparing the template comparison and the adaptive template methods, we obtain the following table. Establishment of a standard template is the average time from establishing features of one single chip to extracting defects, and the detection time is the average detection time for one single chip (Table 10).
Under the same experimental conditions as the adaptive template method, the fast template comparison method was used to detect the chip defects after fast screening and obtain the system detection rate. The displacement of the lithographic patterns between different layers produced a poor fitting of the standard template, as shown in Fig. 40. As a result, the system judged non-defective chips as defective, which led to the overkill phenomenon and greatly increased the number of chip misjudgment. To reduce this phenomenon, the comparison parameters were relaxed to simulate parameter relaxation in the actual detector environment. In the parameter relaxation step, boundaries of the standard template were processed by a Gaussian blur function, and the threshold of defective areas was relaxed to reduce the misjudgment caused by the displacement and scale changes between lithographic patterns. In addition, the defect threshold was adjusted to 150 pixels for the electrode area, 85 pixels for the light-emitting area, and 200 pixels for the mesa area to simulate the case in actual production where the detection parameters will be relaxed to reduce the number of chip misjudgment.
The contributions of this study are as follows: (1) The LED chip images were fast-screened according to the grayscale entropy index and the correlation coefficient index. The severely defective LED chips were removed in advance to increase the locating stability of the adaptive template. It only took 0.052 s to fast screen one single chip. (2) SIFT and Harris-Laplace scale space was used to search for and compare the feature points of fast-screened LED chip lithographic patterns. The locating method was innovatively improved to locate feature points by the feature template method for accelerated processes. According to the information of the feature area location points, the standard template of the LED chips was fitted to obtain an adaptive template that matched the chips. It only took 0.14 s from locating to fitting after the feature area template was improved.    poor fitting between the standard template and the actual chip patterns. In this study, the adjusted adaptive template method had a detection accuracy of 98.36%, which is 15.79% higher than that of the fast template comparison method. Therefore, the method proposed effectively improved the comparison accuracy. In terms of time performance, it only took 0.25 s to establish the adaptive template for one single chip. The average detection time of each chip was reduced by 1.4 s, and the efficiency was increased by 30.43%; these values meet the industrial high-speed detection requirements.

Conclusion
This study improved the poor fitting between the template and the chip patterns in industrial automated detector algorithms with machine vision and proposed an adaptive template algorithm. Specifically, the feature points of the LED chip lithographic patterns were fitted, and an adaptive template that conformed to the LED chip lithographic patterns was established to detect the chip defects in the object images. The template comparison method and detection rate verification were introduced, which highlighted that the method proposed could improve product detection accuracy. The research samples used in this study were wafer images extracted by an actual industrial detector. The adaptive template can overcome poor fitting by using standard templates and effectively improve the accuracy of the automated optical detectors as well as enhance the industrial production efficiency. Data availability All data sets generated in this study are available from the corresponding author upon reasonable request.

Declarations
Ethics approval and consent to participate Not applicable.

Consent for publication Not applicable.
Competing interests The authors declare no competing interests.