An image matching method, a defect detection method, and a storage medium

By calculating similarity pixel by pixel on the wafer surface and evaluating the concentration of the difference images, the false detection problem of template matching methods under illumination and product differences is solved, and higher detection accuracy is achieved.

CN120765626BActive Publication Date: 2026-06-19GUANGZHOU ZHONGKE FEICE TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGZHOU ZHONGKE FEICE TECHNOLOGY CO LTD
Filing Date
2025-07-15
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing template matching methods are difficult to accurately detect defects on the wafer surface due to the influence of lighting, manufacturing process and differences between different products, especially at the boundary between periodic and non-periodic regions where false detections are prone to occur.

Method used

The similarity between the template image and the image to be detected is calculated by sliding pixel by pixel. Several candidate positions are selected, and the concentration of difference pixel values ​​is evaluated by the difference map. The position with the highest concentration is selected as the matching position to reduce false detections.

Benefits of technology

It improves the accuracy of template matching, reduces matching errors at the boundary between periodic and non-periodic regions, and lowers the false detection rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120765626B_ABST
    Figure CN120765626B_ABST
Patent Text Reader

Abstract

An image matching method, a defect detection method, and a storage medium are disclosed. The image matching method includes: sliding a template image as a window across a wafer image to be inspected pixel by pixel; calculating the similarity between the template image and the corresponding window region at each sliding position; selecting several sliding positions as candidate positions based on the similarity; performing difference analysis between the template image and the window regions corresponding to each candidate position to obtain a difference map; counting the number of pixels for each difference pixel value in the difference map; evaluating the concentration of difference pixel values ​​in the difference map based on the statistical results; and selecting the candidate position corresponding to the highest concentration value as the matching position. This application improves the accuracy of template matching and reduces false detections caused by matching errors at the boundary between periodic and non-periodic regions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of semiconductor testing technology, specifically to image matching methods, defect detection methods, and storage media. Background Technology

[0002] Semiconductor devices such as chips are manufactured using wafers as a substrate. During the manufacturing process of semiconductor devices, it is necessary to detect defects on the wafer surface to ensure product quality.

[0003] Template matching is a commonly used detection method that uses a template image to locate specific regions or shapes, thereby detecting defects within those regions. However, interference from factors such as lighting, manufacturing processes, and differences between products can lead to errors in template matching, preventing accurate localization of the target object. This is especially true when the image contains periodic and non-periodic regions (such as...). Figure 1 In the image, the recurring dot-shaped photolithographic pattern 1 is distributed in an array, forming a periodic region, while a portion of the region 2 on the left is a non-periodic region. If a matching error occurs at the boundary between the periodic and non-periodic regions, it will have a significant impact on the detection results and will result in a large number of false detections. Summary of the Invention

[0004] This invention provides an image matching method, a defect detection method, and a storage medium, aiming to reduce template matching errors caused by lighting, manufacturing processes, and differences between different products.

[0005] According to the first aspect, one embodiment provides an image matching method, comprising:

[0006] A template image and a wafer image to be detected are obtained, wherein the wafer image to be detected has multiple periodic feature patterns, wherein at least a portion of the feature patterns use the template image as a detection reference;

[0007] The template image is used as a window and is slid pixel by pixel on the image to be detected. The similarity between the template image and the corresponding window region at each sliding position is calculated.

[0008] Several sliding positions are selected as candidate positions based on similarity.

[0009] For each candidate position, the template image and the window region corresponding to the candidate position are subtracted to obtain a difference map. The pixel values ​​in the difference map are the difference pixel values ​​between the corresponding pixels in the template image and the window region. The number of pixels for each difference pixel value in the difference map is counted, and the concentration of the difference pixel values ​​in the difference map is evaluated based on the statistical results.

[0010] The candidate position corresponding to the highest concentration value is selected as the matching position.

[0011] In some embodiments, assessing the concentration of difference pixel values ​​in the difference map based on statistical results includes:

[0012] The number of pixels whose differential pixel values ​​are located within a preset first differential pixel value interval in the differential image is obtained, and this number is used to characterize the concentration of differential pixel values ​​in the differential image, wherein the first differential pixel value interval includes 0 differential pixel values.

[0013] Alternatively, a second differential pixel value range can be obtained, which includes 0 differential pixel values, and satisfies that the number of pixels with differential pixel values ​​located in this range is not less than a first quantity threshold. The width of the second differential pixel value range is used to characterize the concentration of differential pixel values ​​in the differential image.

[0014] In some embodiments, the first quantity threshold is the product of the total number of pixels in the difference map and a first scaling factor α;

[0015] The process of obtaining the second difference pixel value range includes:

[0016] Obtain the minimum difference pixel value d in the difference map. min and the maximum difference pixel value d max ;

[0017] Obtain the difference pixel values ​​in the difference image within [d] min The number of pixels in the interval [0, 0] is used to obtain the first pixel count;

[0018] Obtain the difference pixel values ​​in the difference image within the range [0, d]. max The number of pixels within the specified interval is used to obtain the second pixel count.

[0019] From the minimum difference pixel value d min Start by accumulating the number of pixels for each differential pixel value towards 0, until the accumulated number of pixels is greater than or equal to the second quantity threshold. Record the differential pixel value dLeft1 at the time of the last accumulation, where the second quantity threshold is the product of the first number of pixels and (1-α).

[0020] From the maximum difference pixel value d max Start by accumulating the number of pixels for each differential pixel value towards 0, until the accumulated number of pixels is greater than or equal to the third quantity threshold. Record the differential pixel value dRight1 at the time of the last accumulation to obtain the second differential pixel value interval [dLeft1, dRight1]. The third quantity threshold is the product of the second pixel count and (1-α).

[0021] Alternatively, obtaining the second difference pixel value range includes:

[0022] The number of pixels whose difference pixel values ​​are in the range of [-255, 0] in the difference image is obtained to obtain the number of third pixels;

[0023] The number of pixels whose difference pixel values ​​are in the range [0, 255] in the difference image is obtained to obtain the fourth pixel count;

[0024] Starting from the differential pixel value -255, the number of pixels for each differential pixel value is accumulated one by one towards the differential pixel value 0, until the accumulated number of pixels is greater than or equal to the fourth quantity threshold. The differential pixel value dLeft2 at the time of the last accumulation is recorded, where the fourth quantity threshold is the product of the third pixel number and (1-α).

[0025] Starting from the differential pixel value 255, the number of pixels for each differential pixel value is accumulated one by one towards the differential pixel value 0, until the accumulated number of pixels is greater than or equal to the fifth quantity threshold. The differential pixel value dRight2 at the time of the last accumulation is recorded to obtain the second differential pixel value interval [dLeft2, dRight2]. The fifth quantity threshold is the product of the fourth pixel count and (1-α).

[0026] In some embodiments, obtaining the second difference pixel value range includes:

[0027] Starting from the differential pixel values ​​-255 and 255, the number of pixels for each differential pixel value is accumulated towards the differential pixel value 0. After each accumulation, it is determined whether the current accumulated number of pixels is greater than or equal to the fourth quantity threshold. If so, the accumulation is stopped, and the current differential pixel values ​​-Dif and Dif are recorded to obtain the second differential pixel value interval [-Dif, Dif].

[0028] The accumulation includes the number of pixels that accumulate one difference pixel value from the difference pixel value -255 toward 0 and the number of pixels that accumulate one difference pixel value from the difference pixel value 255 toward 0. The sum of the fourth quantity threshold and the first quantity threshold is equal to the total number of pixels in the difference map.

[0029] In some embodiments, selecting several sliding positions as candidate positions based on similarity includes:

[0030] Select the sliding position corresponding to the maximum similarity as a candidate position and exclude the selected sliding position. Continue to select the sliding position corresponding to the maximum similarity as another candidate position from the remaining sliding positions and exclude the selected sliding position until the maximum similarity is less than the similarity threshold or the number of candidate positions reaches the preset position number threshold.

[0031] In some embodiments, the image detection method further includes: recording each of the sliding positions and their corresponding similarities to form a similarity map, wherein each pixel position in the similarity map corresponds to a sliding position; and when excluding the selected sliding position, excluding other sliding positions in the neighborhood of the sliding position in the similarity map.

[0032] In some embodiments, the size of the neighborhood is positively correlated with the period size of the periodically distributed feature pattern.

[0033] In some embodiments, the similarity threshold is the product of the maximum similarity among all the similarities corresponding to the sliding positions and the second proportional coefficient β.

[0034] According to the second aspect, one embodiment provides a defect detection method, comprising:

[0035] Obtain the template image and the image to be detected on the wafer;

[0036] The matching position is obtained by the image matching method of any embodiment of the first aspect described above;

[0037] The window region corresponding to the matching position is obtained as the target region, and defect detection is performed on the target region to obtain the detection result.

[0038] According to a third aspect, one embodiment provides a computer-readable storage medium storing a computer program that can be executed by a processor to implement the image matching method of any embodiment of the first aspect or the defect detection method of any embodiment of the second aspect.

[0039] According to the image matching method, defect detection method, and storage medium of the above embodiments, a template image is used as a window and slid pixel by pixel on the image to be detected on the wafer. The similarity between the template image and the corresponding window region at each sliding position is calculated. Based on the similarity, several sliding positions are selected as candidate positions. For each candidate position, the template image and the window region corresponding to the candidate position are subtracted to obtain a difference map. The number of pixels for each difference pixel value in the difference map is counted, and the concentration of difference pixel values ​​in the difference map is evaluated based on the statistical results. Finally, the candidate position corresponding to the highest concentration value is selected as the matching position. Due to the influence of different lighting, manufacturing processes, product differences, etc., the image formed on the wafer surface will undergo grayscale changes. In this case, selecting the position with the highest similarity as the matching position may not be accurate. In this invention, several candidate positions are first selected based on similarity. Then, a difference map between the template image and the window region corresponding to each candidate position is obtained. The concentration of the difference pixel values ​​in the difference map is evaluated, and the candidate position corresponding to the highest concentration value is taken as the matching position. Since the pixels in the difference map at the position with high similarity are usually concentrated in the range where the absolute value of the difference pixel value is small, the concentration represents the proportion of pixels with small differences between the template image and the window region. By selecting the position with the highest concentration as the matching position, the accuracy of template matching is effectively improved, and false detections caused by matching errors at the boundary between periodic and non-periodic regions are reduced. Attached Figure Description

[0040] Figure 1 This is a partial image of the wafer surface in one embodiment;

[0041] Figure 2 A flowchart of an image matching method according to one embodiment;

[0042] Figure 3 This refers to a template image and an image to be detected in one embodiment;

[0043] Figure 4 This is a schematic diagram illustrating how a template image is used as a window to slide pixel-by-pixel across an image to be detected in one embodiment.

[0044] Figure 5 This is a similarity graph in one embodiment;

[0045] Figure 6 This is an image showing the statistical result of the number of pixels for each difference pixel value in a difference map in one embodiment;

[0046] Figure 7 for Figure 6 A magnified image of the middle section;

[0047] Figure 8 This is a flowchart illustrating the process of obtaining a second difference pixel value range in one embodiment;

[0048] Figure 9 This is a flowchart illustrating the acquisition of the second difference pixel value range in another embodiment;

[0049] Figure 10 This is a flowchart of a defect detection method according to one embodiment. Detailed Implementation

[0050] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings. Similar elements in different embodiments are referred to by associated similar element reference numerals. In the following embodiments, many details are described to facilitate a better understanding of this application. However, those skilled in the art will readily recognize that some features may be omitted in different situations, or may be replaced by other elements, materials, or methods. In some cases, certain operations related to this application are not shown or described in the specification. This is to avoid obscuring the core parts of this application with excessive description. For those skilled in the art, detailed description of these related operations is not necessary; they can fully understand the related operations based on the description in the specification and general technical knowledge in the art.

[0051] Furthermore, the features, operations, or characteristics described in the specification can be combined in any suitable manner to form various embodiments. At the same time, the steps or actions in the method description can be rearranged or adjusted in a manner obvious to those skilled in the art. Therefore, the various orders in the specification and drawings are only for the clear description of a particular embodiment and do not imply a necessary order, unless otherwise stated that a particular order must be followed.

[0052] The serial numbers assigned to components in this document, such as "first" and "second," are used solely to distinguish the described objects and have no sequential or technical meaning. "Multiple" means two or more. Unless otherwise specified, "connection" or "linkage" in this application includes both direct and indirect connections (linkages).

[0053] Please refer to Figure 2 The image matching method in some embodiments of the present invention includes steps 100 to 500, which are described in detail below.

[0054] Step 100: Obtain the template image and the image to be detected on the wafer.

[0055] The image to be inspected on a wafer can be obtained by imaging the wafer surface using a CCD (Charge Coupled Device) camera or a TDI (Time Delay Integration) camera. The wafer surface exhibits periodically distributed structures or patterns, thus the image to be inspected contains multiple periodic feature patterns. For example, if the wafer surface has multiple periodically distributed dies, the image to be inspected will contain multiple periodic die patterns. Similarly, if the die surface has multiple periodically distributed dot-like lithographic structures, the image to be inspected will contain multiple periodic dot-like patterns (e.g.,...). Figure 1 (As shown).

[0056] In this process, at least some feature patterns are detected using a template image as a reference. That is, some or all of the feature patterns on the image to be detected can be located by template matching on the image to be detected using the template image, so as to detect them.

[0057] Step 200: Use the template image as a window to slide pixel by pixel on the image to be detected, and calculate the similarity between the template image and the corresponding window region at each sliding position.

[0058] This step can be implemented using any existing technology. In one specific implementation, such as Figure 3 As shown, the template image has a length of h and a width of w (in pixels), and the image to be detected has a length of H and a width of W. The template image is used as a window and is slid across the image to be detected pixel by pixel. The process for calculating the similarity between the template image and the corresponding window region at each sliding position is as follows:

[0059] ① Align the top left corners of the two images to determine the window region on the image to be detected that corresponds to the template image. Use the coordinates of the top left corner of the template image to represent its position. The position of the template image at this point (i.e., the sliding position) is (0,0). Figure 4 As shown.

[0060] ② Subtract the pixel values ​​of the corresponding positions in the template image and the window area, square the result, and then divide by (255). 2 ×h×w), and finally normalize to obtain the calculation result of each pixel at each position; add the calculation results of all pixels at all positions to obtain the similarity metric value at the current sliding position; since the difference between the pixels of the two is smaller when the window region and the template image are more similar, it can be known that the closer the calculated similarity metric value is to 0, the more similar the window region and the template image are.

[0061] ③ Shift the template image one pixel to the right and repeat step ② to obtain the similarity metric at the second sliding position (1,0). Continue sliding to the next position to calculate the similarity until the template image slides to position (W-w+1,0) to complete the similarity calculation for the first row. Then slide the template image to position (0,1) to start the similarity calculation for the second row until the template image slides to position (W-w+1,H-h+1) to complete the similarity calculation for all positions.

[0062] Arranging the similarities by position yields a similarity map of size (W-w+1)×(H-h+1). Each pixel in this map corresponds to a sliding position, and the pixel value represents the similarity calculated at that sliding position. Figure 5 As shown ( Figure 5 The larger the median value, the greater the similarity.

[0063] Step 300: Select several sliding positions as candidate positions based on similarity.

[0064] It is understandable that sliding positions with high similarity should be selected as candidate positions. For example, the N sliding positions with the highest similarity should be selected as candidate positions, where N is an integer not less than 2.

[0065] Step 400: For each candidate position, the template image and the window region corresponding to the candidate position are subtracted to obtain a difference map. The pixel values ​​in the difference map are the difference pixel values ​​between the corresponding pixels in the template image and the window region. The number of pixels for each difference pixel value in the difference map is counted, and the concentration of the difference pixel values ​​in the difference map is evaluated based on the statistical results.

[0066] Candidate positions can be represented using two-dimensional coordinates (x, y). In one specific implementation, the offset is obtained by subtracting the alignment radius in the x and y directions from the x and y coordinates of the candidate position, respectively. Based on the offset, the window region on the image to be detected corresponding to the template image can be determined. The alignment radius in the x direction is... The alignment radius in the y direction is It is understandable that the obtained alignment radius is the result of rounding down.

[0067] The statistical results can be represented by a 1×511 image, and the difference statistical histogram can be shown as follows: Figure 6As shown, from left to right (x-coordinate from 0 to 510), the values ​​represent the number of pixels with difference pixel values ​​from -255 to 255. The black areas have fewer pixels, while the white areas have more. This can be understood as the difference statistical histogram counting the number of pixels for each difference pixel value between -255 and +255. Typically, the middle section (the range with the smaller absolute value of the difference pixel value) has a higher number of pixels, while the outer edges have fewer, generally exhibiting a Gaussian distribution. Figure 7 for Figure 6 The enlarged image in the middle section shows the number at each position, indicating the number of pixels; "1.57E+04" means 1.57 × 10⁻⁴. 4 "2.62E+04" means 2.62 × 10 4 And so on. It can be seen that the difference pixel values ​​in the difference map are basically concentrated in the middle part. The higher the concentration, the higher the proportion of pixels in the middle part, that is, the higher the proportion of pixels with small differences between the template image and the window area, which means the smaller the difference between the window area and the template image.

[0068] In some embodiments, assessing the concentration of differential pixel values ​​in the differential image based on statistical results includes: obtaining the number of pixels in the differential image whose differential pixel values ​​are located within a preset first differential pixel value interval, and using this number to characterize the concentration of differential pixel values ​​in the differential image, wherein the first differential pixel value interval includes 0 differential pixel values.

[0069] The first difference pixel value interval can be a symmetrical interval (e.g., [-10, 10]) or an asymmetrical interval (e.g., [-5, 15]), and can be set empirically. Since the difference pixel values ​​in the difference image are concentrated in the interval with small absolute values, this embodiment sets the first difference pixel value interval to include 0 difference pixel values. It can be understood that the larger the number of pixels whose difference pixel values ​​lie within the first difference pixel value interval, the higher the concentration of difference pixel values ​​in the difference image.

[0070] In other embodiments, assessing the concentration of differential pixel values ​​in the differential image based on statistical results includes: obtaining a second differential pixel value interval, the second differential pixel value interval including 0 differential pixel values, and satisfying that the number of pixels with differential pixel values ​​located in the interval is not less than a first quantity threshold, and using the width of the second differential pixel value interval to characterize the concentration of differential pixel values ​​in the differential image.

[0071] The first threshold can be set based on experience and the total number of pixels in the difference image; for example, it can be the total number of pixels in the difference image multiplied by a scaling factor. It can be understood that the smaller the width of the second difference pixel value range, the higher the concentration of difference pixel values ​​in the difference image.

[0072] Step 500: Select the candidate location corresponding to the highest concentration value as the matching location. Subsequent processing, such as defect detection, can be performed on the window area corresponding to the matching location.

[0073] In this application, considering the grayscale variations in the image formed on the wafer surface due to differences in lighting and product characteristics, selecting the location with the highest similarity as the matching location may not be accurate. Therefore, several candidate locations are first selected based on similarity, and then a difference map of the window region corresponding to each candidate location is obtained. The concentration of the difference pixel values ​​in the difference map is evaluated, and the candidate location with the highest concentration value is selected as the matching location. Since the pixels in the difference map at locations with high similarity are usually concentrated in the range of smaller absolute values ​​of the difference pixel values, the concentration represents the proportion of pixels with small differences between the template image and the window region. By selecting the location with the highest concentration as the matching location, the accuracy of template matching is effectively improved, and false detections caused by matching errors at the boundary between periodic and non-periodic regions are reduced.

[0074] In some embodiments, obtaining the second differential pixel value range includes: starting from the differential pixel values ​​-255 and 255, accumulating the number of pixels of each differential pixel value towards the differential pixel value 0. After each accumulation, it is determined whether the currently accumulated number of pixels is greater than or equal to the fourth quantity threshold. If so, the accumulation is stopped, and the current differential pixel values ​​-Dif and Dif are recorded to obtain the second differential pixel value range [-Dif, Dif].

[0075] Each accumulation step includes counting the number of pixels accumulated from the difference pixel value -255 towards 0 by one difference pixel value, and counting the number of pixels accumulated from the difference pixel value 255 towards 0 by one difference pixel value. The sum of the fourth quantity threshold and the first quantity threshold equals the total number of pixels in the difference image. In other words, accumulation is performed simultaneously from both sides towards the difference pixel value 0. The process stops when the accumulated pixel count is greater than or equal to the fourth quantity threshold; the unaccumulated interval in the middle is the second difference pixel value interval.

[0076] In some embodiments, the first quantity threshold is the product of the total number of pixels in the difference image and a first scaling factor α. The first scaling factor α can be set empirically, for example, it can be set to 0.997. Based on this, please refer to... Figure 8 In one embodiment, obtaining the second differential pixel value range includes the following steps 411-414.

[0077] Step 411: Obtain the number of pixels in the difference image whose difference pixel values ​​are in the range [-255, 0], and thus obtain the number of the third pixel. This involves calculating... Figure 6 The number of pixels in the x-coordinate range from 0 to 255.

[0078] Step 412: Obtain the number of pixels in the difference image whose difference pixel values ​​are in the range [0, 255], and thus obtain the number of the fourth pixel. This involves calculating... Figure 6 The number of pixels in the x-coordinate range from 255 to 510.

[0079] Step 413: Starting from the differential pixel value -255, accumulate the number of pixels for each differential pixel value towards the differential pixel value 0, until the accumulated number of pixels is greater than or equal to the fourth quantity threshold. Record the differential pixel value dLeft2 at the time of the last accumulation, where the fourth quantity threshold is the product of the third pixel count and (1-α).

[0080] Taking a first scaling factor α of 0.997 as an example, and using sumLeft to represent the third pixel count and threshLeft to represent the fourth threshold, then threshLeft = sumLeft × 0.003. Therefore, in... Figure 6 In the process, starting from x-coordinate 0 and moving towards x-coordinate 255, the number of pixels is incremented one by one to obtain the accumulated value tmpSumLeft. After each increment, a judgment is made. When the accumulated value tmpSumLeft is greater than threshLeft, the current x-coordinate xLeft is recorded, which is equivalent to recording the corresponding difference pixel value dLeft2.

[0081] Step 414: Starting from the differential pixel value 255, accumulate the number of pixels for each differential pixel value towards the differential pixel value 0 until the accumulated number of pixels is greater than or equal to the fifth quantity threshold. Record the differential pixel value dRight2 at the time of the last accumulation to obtain the second differential pixel value interval [dLeft2, dRight2]. The fifth quantity threshold is the product of the fourth pixel count and (1-α).

[0082] Let sumRight represent the number of fourth pixels and threshRight represent the threshold for the number of fifth pixels, then threshRight = sumRight × 0.003. That is, in... Figure 6In this process, starting from x-coordinate 510 and moving towards x-coordinate 255, the number of pixels is incremented sequentially to obtain the accumulated value tmpSumRight. After each increment, a judgment is made. When the accumulated value tmpSumRight is greater than threshRight, the current x-coordinate xRight is recorded, which is equivalent to recording the corresponding difference pixel value dRight2. Then, the interval [xLeft, xRight] corresponds to the second difference pixel value interval [dLeft2, dRight2]. The width of the interval [xLeft, xRight], dist = xRight - xLeft, is the width of the second difference pixel value interval [dLeft2, dRight2]. The candidate position corresponding to the minimum value of dist is selected as the matching position.

[0083] For example Figure 5 In the similarity map, eight sliding positions were selected as candidate positions based on similarity. The widths (dist) of the second difference pixel value interval [dLeft2, dRight2] obtained from candidate positions 1 to 8 are 45, 47, 49, 23, 26, 29, 33, and 42, respectively. Therefore, candidate position 4 with a width (dist) of 23 was selected as the matching position.

[0084] Please refer to Figure 9 In another embodiment, obtaining the second differential pixel value range includes the following steps 421 to 425.

[0085] Step 421: Obtain the minimum difference pixel value d in the difference map. min and the maximum difference pixel value d max .

[0086] Step 422: Obtain the difference pixel values ​​in the difference image within [d] min The number of pixels in the interval [0, 0] is used to obtain the first pixel count.

[0087] Step 423: Obtain the difference pixel values ​​in the difference image within the range [0, d]. max The number of pixels within the specified interval is used to obtain the second pixel count.

[0088] Step 424: From the minimum difference pixel value d min Start by accumulating the number of pixels for each differential pixel value towards 0, until the accumulated number of pixels is greater than or equal to the second quantity threshold. Record the differential pixel value dLeft1 at the time of the last accumulation, where the second quantity threshold is the product of the first pixel count and (1-α).

[0089] Step 425: From the maximum difference pixel value d maxStart by accumulating the number of pixels for each differential pixel value towards 0, until the accumulated number of pixels is greater than or equal to the third quantity threshold. Record the differential pixel value dRight1 at the time of the last accumulation to obtain the second differential pixel value interval [dLeft1, dRight1]. The third quantity threshold is the product of the second pixel count and (1-α).

[0090] The specific implementation methods of the above steps can be found in steps 411 to 414, and will not be repeated here.

[0091] In this embodiment, the minimum and maximum difference pixel values ​​in the difference map are first obtained, and then the difference pixel values ​​are accumulated from the minimum and maximum difference pixel values ​​toward the difference pixel value 0, instead of accumulating from the difference pixel values ​​-255 and 255 toward the difference pixel value 0, which saves time.

[0092] Because the images formed on the wafer surface vary in grayscale under different lighting conditions, manufacturing processes, and products, the difference pixel values ​​in the difference image obtained after subtracting from the template image also differ. This can cause the range of concentrated difference pixel values ​​to shift to the left or right. By using steps 411-414 or steps 421-425 to obtain the second difference pixel value range, an endpoint is determined based on the number of pixels to the left and right of the 0 difference pixel value. This can adapt to this change and find a more suitable range, thereby resisting interference from factors such as lighting, manufacturing processes, and product differences.

[0093] In some embodiments, selecting several sliding positions as candidate positions based on similarity includes: selecting the sliding position corresponding to the maximum similarity as a candidate position, excluding the selected sliding position, continuing to select the sliding position corresponding to the maximum similarity as another candidate position from the remaining sliding positions, and excluding the selected sliding position, until the maximum similarity is less than the similarity threshold or the number of candidate positions reaches a preset position number threshold.

[0094] The similarity threshold and the number of locations threshold can be set according to actual needs.

[0095] In some embodiments, the similarity threshold is the product of the maximum similarity among all sliding positions (i.e., the similarity corresponding to the first selected sliding position) and a second scaling factor β. Since variations in factors such as lighting, manufacturing processes, and products can cause changes in similarity, setting the similarity threshold to the product of the maximum similarity among all calculated sliding positions and the second scaling factor β adapts to current lighting, manufacturing processes, and products. To ensure effectiveness, the second scaling factor β can be a value not less than 90%, such as 90% or 95%.

[0096] In some embodiments, in order to balance effectiveness and computational efficiency, the threshold for the number of locations can be set to 10.

[0097] by Figure 5 For example, the similarity threshold is set to 90% of the maximum similarity among all sliding positions, and the number of positions threshold is 10. Among all sliding positions, the maximum similarity is 0.9349, so sliding position 1 is selected as a candidate position and excluded (for example, its corresponding similarity is set to 0). Among the remaining sliding positions, the maximum similarity is 0.9053, which is greater than 90% of 0.9349 and the number of candidate positions is less than 10, so sliding position 2 is selected as another candidate position and excluded. This process continues until candidate positions 1 to 8 are finally selected.

[0098] Some embodiments of the image matching method further include: recording each sliding position and its corresponding similarity to form a similarity map (see...). Figure 5 When excluding a selected sliding position, other sliding positions within its neighborhood in the similarity graph are also excluded. The size of the neighborhood can be 3×3, 5×5, etc. Figure 5 The 5×5 neighborhood was used.

[0099] Since the image to be detected has multiple periodically distributed feature patterns, and usually only one position in a period is likely to be a matching position, other positions in that period can be excluded. Therefore, in this embodiment, other sliding positions in the neighborhood of the candidate position (these sliding positions are roughly in the same period as the candidate position) are excluded, thereby improving matching efficiency and accuracy.

[0100] In some embodiments, the size of the neighborhood is positively correlated with the period of the periodically distributed feature pattern, thereby making the range of excluded sliding positions adaptable to the period of the feature pattern.

[0101] Based on the image matching method described above, this application also provides a defect detection method, please refer to... Figure 10 The method includes:

[0102] Step 10: Obtain the template image and the image to be inspected on the wafer;

[0103] Step 20: Obtain the matching position using the image matching method of any embodiment of this application;

[0104] Step 30: Obtain the window region corresponding to the matching position as the target region, and perform defect detection on the target region to obtain the detection result. The defect detection can employ any existing defect detection method.

[0105] Those skilled in the art will understand that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, which may include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to achieve the above functions. For example, the program can be stored in the memory of a device, and when the program in the memory is executed by the processor, all or part of the above functions can be achieved. In addition, when all or part of the functions in the above embodiments are implemented by computer programs, the program can also be stored in a server, another computer, disk, optical disk, flash drive, or external hard drive, etc., and can be downloaded or copied to the memory of a local device, or the system of the local device can be updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be achieved.

[0106] The above examples illustrate the present invention only to aid in understanding it and are not intended to limit the scope of the invention. Those skilled in the art can make various simple deductions, modifications, or substitutions based on the principles of this invention.

Claims

1. An image matching method, characterized in that, include: A template image and a wafer image to be detected are obtained, wherein the wafer image to be detected has multiple periodic feature patterns, and the feature patterns use the template image as a detection reference. The template image is used as a window and is slid pixel by pixel on the image to be detected. The similarity between the template image and the corresponding window region at each sliding position is calculated. Several sliding positions are selected as candidate positions based on similarity. For each candidate position, the template image and the window region corresponding to the candidate position are differentially divided to obtain a difference map. The pixel values ​​in the difference map are the difference pixel values ​​between the corresponding pixels in the template image and the window region. The number of pixels for each difference pixel value in the difference map is counted, and the number of pixels whose difference pixel values ​​are located within a preset first difference pixel value interval is obtained. This number represents the concentration of the difference pixel values ​​in the difference map. The first difference pixel value interval includes 0 difference pixel values. Alternatively, a second difference pixel value interval is obtained, which includes 0 difference pixel values, and satisfies that the number of pixels whose difference pixel values ​​are located within this interval is not less than a first quantity threshold. The width of the second difference pixel value interval represents the concentration of the difference pixel values ​​in the difference map. The candidate position corresponding to the highest concentration value is selected as the matching position.

2. The image matching method as described in claim 1, characterized in that, The first quantity threshold is the product of the total number of pixels in the difference image and the first scaling factor α; The process of obtaining the second difference pixel value range includes: Obtain the minimum difference pixel value d in the difference map. min and the maximum difference pixel value d max ; Obtain the difference pixel values ​​in the difference image within [d] min The number of pixels in the interval [0, 0] is used to obtain the first pixel count; Obtain the difference pixel values ​​in the difference image within the range [0, d]. max The number of pixels within the specified interval is used to obtain the second pixel count. From the minimum difference pixel value d min Start by accumulating the number of pixels for each differential pixel value towards 0, until the accumulated number of pixels is greater than or equal to the second quantity threshold. Record the differential pixel value dLeft1 at the time of the last accumulation, where the second quantity threshold is the product of the first number of pixels and (1-α). From the maximum difference pixel value d max Start by accumulating the number of pixels for each differential pixel value towards 0, until the accumulated number of pixels is greater than or equal to the third quantity threshold. Record the differential pixel value dRight1 at the time of the last accumulation to obtain the second differential pixel value interval [dLeft1, dRight1]. The third quantity threshold is the product of the second pixel count and (1-α). Alternatively, obtaining the second difference pixel value range includes: The number of pixels whose difference pixel values ​​are in the range of [-255, 0] in the difference image is obtained to obtain the number of third pixels; The number of pixels whose difference pixel values ​​are in the range [0, 255] in the difference image is obtained to obtain the fourth pixel count; Starting from the differential pixel value -255, the number of pixels for each differential pixel value is accumulated one by one towards the differential pixel value 0, until the accumulated number of pixels is greater than or equal to the fourth quantity threshold. The differential pixel value dLeft2 at the time of the last accumulation is recorded, where the fourth quantity threshold is the product of the third pixel number and (1-α). Starting from the differential pixel value 255, the number of pixels for each differential pixel value is accumulated one by one towards the differential pixel value 0, until the accumulated number of pixels is greater than or equal to the fifth quantity threshold. The differential pixel value dRight2 at the time of the last accumulation is recorded to obtain the second differential pixel value interval [dLeft2, dRight2]. The fifth quantity threshold is the product of the fourth pixel count and (1-α).

3. The image matching method as described in claim 1, characterized in that, The process of obtaining the second difference pixel value range includes: Starting from the differential pixel values ​​-255 and 255, the number of pixels for each differential pixel value is accumulated towards the differential pixel value 0. After each accumulation, it is determined whether the current accumulated number of pixels is greater than or equal to the fourth quantity threshold. If so, the accumulation is stopped, and the current differential pixel values ​​-Dif and Dif are recorded to obtain the second differential pixel value interval [-Dif, Dif]. The accumulation includes the number of pixels that accumulate one difference pixel value from the difference pixel value -255 toward 0 and the number of pixels that accumulate one difference pixel value from the difference pixel value 255 toward 0. The sum of the fourth quantity threshold and the first quantity threshold is equal to the total number of pixels in the difference map.

4. The image matching method according to any one of claims 1 to 3, characterized in that, The step of selecting several sliding positions as candidate positions based on similarity includes: Select the sliding position corresponding to the maximum similarity as a candidate position and exclude the selected sliding position. Continue to select the sliding position corresponding to the maximum similarity as another candidate position from the remaining sliding positions and exclude the selected sliding position until the maximum similarity is less than the similarity threshold or the number of candidate positions reaches the preset position number threshold.

5. The image matching method as described in claim 4, characterized in that, The image detection method further includes: recording each of the sliding positions and their corresponding similarities to form a similarity map, wherein each pixel position in the similarity map corresponds to a sliding position; and when excluding the selected sliding position, other sliding positions in the neighborhood of the sliding position in the similarity map are also excluded.

6. The image matching method as described in claim 5, characterized in that, The size of the neighborhood is positively correlated with the period of the periodically distributed feature pattern.

7. The image matching method as described in claim 4, characterized in that, The similarity threshold is the product of the maximum similarity among all the similarities corresponding to the sliding positions and the second proportional coefficient β.

8. A defect detection method, characterized in that, include: Obtain the template image and the image to be detected on the wafer; The matching position is obtained by the image matching method as described in any one of claims 1 to 7; The window region corresponding to the matching position is obtained as the target region, and defect detection is performed on the target region to obtain the detection result.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that can be executed by a processor to implement the image matching method as described in any one of claims 1 to 7 or the defect detection method as described in claim 8.