Wafer defect detection method and system based on self-supervised learning algorithm
By utilizing physical priors such as polar angle deviation and grain boundary density in wafer defect detection and dynamically adjusting the contrast loss function, the problem of feature collapse in dark field images is solved, thereby improving the accuracy and reliability of wafer defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YANCHENG INST OF TECH
- Filing Date
- 2026-05-18
- Publication Date
- 2026-07-24
AI Technical Summary
Existing technologies do not utilize physical priors such as illumination geometry and grain boundary density in dark-field image scenarios, leading to feature collapse in wafer defect detection. This results in a high false alarm rate in dense grain boundary regions and a high false negative rate in sparse grain boundary regions, thus reducing detection accuracy.
By acquiring each image block in the wafer sample, negative sample pairs are determined based on the polar angle deviation distribution. Combined with the grain boundary density and gray-scale gradient distribution, the contrast loss function value is dynamically adjusted to perform feature encoding training, determine the assigned group and defect intensity, and achieve accurate defect detection.
It effectively avoids the feature collapse problem, significantly reduces the false alarm rate in dense grain boundary regions and the false alarm rate in sparse grain boundary regions, improves the accuracy of wafer defect detection, and can identify grain boundary disorder caused by wafer process abnormalities.
Smart Images

Figure CN122453808A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and specifically to a wafer defect detection method and system based on a self-supervised learning algorithm. Background Technology
[0002] In chip manufacturing, wafers are circular silicon slabs that carry chips. Their surfaces may have defects such as scratches, particle contamination, and missing patterns. Detecting these defects is a key step in ensuring yield. Self-supervised learning is a machine learning method that does not require manual labeling. It constructs "pseudo-labels" from the data itself to pre-train the model, solving the problems of few defect samples and high labeling costs in industrial scenarios. Through contrastive learning algorithms, the model can learn to distinguish between a pure black background and anomalies with bright spots in a dark field image without any labeling.
[0003] However, in dark-field images, normal areas are almost entirely black, and the pixel content of normal image blocks at different locations is highly similar (containing only random sensor noise). This causes the contrastive learning algorithm to tend to map the features of all normal image blocks to the same minimal region in the feature space when constructing negative sample pairs, i.e., feature collapse. Furthermore, the wafer surface actually exhibits brightness differences due to illumination geometry (areas facing the light source and areas away from the light source) and scattering morphology differences due to grain boundary density differences (dense grain boundary regions exhibit continuous linear scattering, while sparse grain boundary regions exhibit isolated point scattering). Existing technologies do not utilize these physical priors, resulting in the trained feature space being unable to distinguish normal image blocks under different lighting conditions or with different grain boundary densities. Consequently, during subsequent defect detection, tiny particle defects (isolated points) are easily masked by background lines in dense grain boundary regions and falsely reported, while in sparse grain boundary regions they are easily confused with noise and missed, reducing the accuracy of wafer defect detection. Summary of the Invention
[0004] To address the technical problem that existing technologies in dark-field image scenarios fail to utilize physical priors such as illumination geometry and grain boundary density, leading to feature collapse, high false alarm rates in dense grain boundary regions, and high false negative rates in sparse grain boundary regions, thus affecting the accuracy of wafer defect detection, this invention aims to provide a wafer defect detection method based on a self-supervised learning algorithm. The specific technical solution adopted is as follows: This invention proposes a wafer defect detection method based on a self-supervised learning algorithm, the method comprising: Obtain each image block in the wafer sample; determine the corresponding negative sample pair based on the polar angle deviation distribution in the image block; The grain boundary density of each image block is determined based on the gray-level gradient distribution of pixels within each image block; the contrast loss function value of each batch of image blocks is determined based on the combination of grain boundary densities between image blocks in the negative sample pair; and the grouping of each target image block in the wafer under test is determined based on the contrast loss function value. Based on the directional response distribution of pixels within each target image block, a defect image for each target image block is determined; based on the grayscale gradient distribution of pixels within the defect image, the corresponding original defect intensity is determined; based on the original defect intensity, and according to the directional distribution of image blocks in the assigned group, the final defect intensity for each target image block is determined. Defect detection is performed on the wafer under test based on the final defect strength.
[0005] Furthermore, the method for obtaining the negative sample pairs includes: Obtain the polar angle of the center point of each image block in the wafer polar coordinate system; One image block is randomly selected from each batch of image blocks as the anchor image block; the non-illuminated region is determined based on the deviation between the polar angle of the anchor image block and the preset azimuth angle of the light source; all image blocks located in the non-illuminated region are used as negative sample image blocks of the anchor image block. Based on the anchored image block and each negative sample image block, all negative sample pairs are determined.
[0006] Furthermore, the method for obtaining grain boundary density includes: The scattering pixels of each image block are determined based on the difference in gray values of each pixel within a preset neighborhood range. Connectivity analysis is performed on the scattering pixels to determine the connected components of each image block; The corresponding bar coefficients are determined based on the aspect ratio of the minimum bounding rectangle of each connected component and the number of pixels in each connected component. The grain boundary density of each image block is determined based on the central tendency of the bar coefficients of all connected domains within each image block.
[0007] Furthermore, the method for obtaining the contrastive loss function value includes: The illumination range is determined based on the deviation between the polar angle of the anchored image block and the azimuth angle of the preset light source; all image blocks located within the illumination range are used as positive sample image blocks of the anchored image block; all positive sample pairs are determined based on the anchored image block and each positive sample image block. For each image block in each batch of image blocks, feature encoding is performed to determine the corresponding feature vector; based on the cosine similarity between the feature vector of the anchor image block in each positive sample pair and the feature vector of each positive sample image block, the positive sample similarity index of each positive sample pair is determined; based on the cosine similarity between the feature vector of the anchor image block in each negative sample pair and the feature vector of each negative sample image block, the negative sample similarity index of each negative sample pair is determined. Based on the grain boundary density of the anchored image block and the grain boundary density of the negative sample image block in each negative sample pair, the corresponding boundary coefficient is determined; based on the boundary coefficient and the negative sample similarity index, the weighted negative sample similarity index of each negative sample pair is determined. The contrast loss function value for each batch of image blocks is determined based on the positive sample similarity index and the weighted negative sample similarity index.
[0008] Furthermore, the method for obtaining the belonging group includes: With the objective of minimizing the contrast loss function value, each image patch in the wafer sample is used as training data to train the encoder for feature encoding; the trained encoder is then used as a feature extractor. The feature extractor is used to obtain the sample feature vector of each image patch in the training data; the sample feature vectors are clustered to determine all candidate group assignments; The feature extractor is used to obtain the target feature vector of each target image block in the wafer under test; the group to which each target image block belongs is determined based on the similarity distance between the target feature vector and each candidate group.
[0009] Furthermore, the method for obtaining the defect image includes: Convolve each target image patch to determine the response direction of each pixel in each target image patch; determine the line direction of each target image patch based on the number of pixels in each response direction. The corresponding line length is determined based on the size of each target image block and its corresponding grain boundary density; Based on the line direction and the line length, a morphological opening operation is performed on the target image block to determine the opening operation image; based on the difference between each target image block and the corresponding opening operation image, a defect image of each target image block is determined.
[0010] Furthermore, the method for obtaining the original defect strength includes: Based on the overall gray-level normal distribution of pixels in the defect image, and combined with the grain boundary density of the target image block, the gray-level threshold is determined. Connectivity analysis is performed on pixels in the defect image whose grayscale values are greater than the grayscale threshold to determine all defect connected components; the original defect intensity of the target image block is determined based on the central tendency of grayscale values in all defect connected components.
[0011] Furthermore, the method for obtaining the final defect strength includes: Connectivity analysis is performed on the opening operation image of each target image block to determine all background connected components; the angle between the long side of the smallest bounding rectangle of the background connected component and the horizontal line is taken as the background connected component angle; the background angle deviation is determined according to the dispersion of all background connected component angles. Based on the image block corresponding to the group to which each target image block belongs, determine the connected component angle of each connected component within the image block; based on the dispersion and central tendency of all connected component angles, combined with the background angle deviation, determine the arrangement deviation of each target image block. The final defect strength is determined based on the arrangement deviation of each target image patch and the original defect strength.
[0012] Furthermore, the method for obtaining the grayscale threshold includes: The base gray value is determined based on the central tendency of the gray values of all pixels in the defect image; the gray value offset is determined based on the dispersion of the gray values of all pixels in the defect image; and the weighted offset is determined based on the gray value offset and the grain boundary density. Based on the aforementioned base grayscale value, and combined with the weighted offset, the grayscale threshold is determined comprehensively.
[0013] The present invention also proposes a wafer defect detection system based on a self-supervised learning algorithm, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of a wafer defect detection method based on a self-supervised learning algorithm.
[0014] The present invention has the following beneficial effects: This invention determines corresponding negative sample pairs based on the polar angle deviation distribution in image blocks, prioritizing image blocks from different illumination zones to form negative sample pairs. This effectively avoids the feature collapse problem of existing technologies and improves the discrimination capability of the feature space. By determining the contrast loss function value of each batch of image blocks based on the grain boundary density combination of the two image blocks in the negative sample pair, it achieves differentiated processing for regions with different grain boundary densities, significantly reducing the false alarm rate in dense grain boundary regions and the false negative rate in sparse grain boundary regions. By determining the grouping of each target image block in the wafer under test, the source of defects is effectively located. By determining the original defect intensity of each target image block, the interference of continuous line background in dense grain boundary regions on the detection of isolated point defects is fundamentally avoided, improving the accuracy of defect detection. Based on the original defect intensity and the directional distribution of image blocks in the grouping, the final defect intensity of each target image block is determined, achieving accurate identification of grain boundary arrangement disorder caused by wafer process anomalies. This solves the problems of feature collapse, high false alarm rate in dense grain boundary regions, and high false negative rate in sparse grain boundary regions, improving the accuracy of wafer defect detection. Attached Figure Description
[0015] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 The flowchart illustrates a wafer defect detection method based on a self-supervised learning algorithm, as provided in one embodiment of the present invention. Figure 2 This is a flowchart of a method for obtaining grain boundary density according to an embodiment of the present invention; Figure 3 This is a flowchart of a method for obtaining the value of a contrastive loss function according to an embodiment of the present invention. Detailed Implementation
[0017] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a wafer defect detection method based on a self-supervised learning algorithm proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0019] The following description, in conjunction with the accompanying drawings, details a specific scheme for a wafer defect detection method based on a self-supervised learning algorithm provided by the present invention.
[0020] Please see Figure 1 The diagram illustrates a flowchart of a wafer defect detection method based on a self-supervised learning algorithm according to an embodiment of the present invention. The method includes: S101: Obtain each image block in the wafer sample; determine the corresponding negative sample pair based on the polar angle deviation distribution in the image block.
[0021] In wafer dark-field detection, the physical properties of different regions on the wafer surface vary significantly. First, because the light source illuminates the wafer surface at a fixed angle, the areas facing the light source and those facing away from it exhibit different brightness distributions in the image; the former has higher brightness, and the latter has lower brightness. Second, the grain boundary density on the wafer surface is unevenly distributed across different spatial regions; dense grain boundary areas exhibit continuous linear scattering, while sparse grain boundary areas exhibit isolated point scattering. If the entire image frame is used as a sample for comparative learning, a single image frame may simultaneously contain regions with multiple different physical properties, leading to feature averaging and preventing the model from learning the subtle differences in local areas. Therefore, this invention acquires each image block from the wafer sample, dividing each image frame into several small image blocks, ensuring that each image block has relatively uniform physical properties.
[0022] In one specific implementation of this invention, before the automated optical inspection equipment begins inspection, wafer alignment is first performed using an edge sensor to determine the coordinates of the wafer's center in the equipment coordinate system. Using this center as the origin, the positive X-axis of the equipment coordinate system as the polar axis, and the counter-clockwise rotation direction as the positive direction, a wafer polar coordinate system is established. The stage is controlled to move the wafer in a step-scan manner. Every 16 pixels of movement, a dark-field image frame is captured using an area scan camera, forming an image block. Each image block is 32×32 pixels in size, covering a square physical area of approximately 32 micrometers on the wafer. Simultaneously, the equipment control system records the polar angle of the image frame's center point in the wafer polar coordinate system, as well as the azimuth angle of the light source. It should be noted that the light source position and camera parameters remain constant during the scanning process until the entire effective area of the wafer is covered.
[0023] It should be noted that, since the contrastive learning training process requires dividing all image patches into multiple batches for iterative training, this embodiment of the invention treats 10 consecutive dark-field images as one image patch batch; if the last image patch batch contains fewer than 10 dark-field images, it is still treated as a separate image patch batch. Subsequent analysis is performed on each image patch batch, and each image patch batch corresponds to only one anchored image patch. Furthermore, the wafer samples used in this embodiment of the invention are defect-free, normal wafers.
[0024] Existing technologies typically select other samples within a batch as negative samples during contrastive learning. However, in dark-field images, normal areas are almost entirely black, and normal image patches at different locations are highly similar at the pixel level, containing only random sensor noise. If negative sample pairs are randomly selected, the model tends to compress the feature vectors of all normal image patches into the same minimal region in the feature space—a phenomenon known as feature collapse. Once feature collapse occurs, during subsequent defect detection, both background lines in dense grain boundary regions and tiny particle defects in sparse grain boundary regions will be mapped to the same area, making effective differentiation impossible. To address this issue, this invention introduces an illumination geometry prior. Based on the polar angle deviation distribution in image patches, image patches from different illumination intervals are preferentially constructed as negative sample pairs. This maps normal wafer sample image patches under different illumination conditions to different regions in the feature space, thereby preventing feature collapse at its source and laying the feature space foundation for subsequent accurate defect detection.
[0025] S102: Determine the grain boundary density of each image block based on the grayscale gradient distribution of pixels within each image block; determine the contrast loss function value of each batch of image blocks based on the combination of grain boundary densities between image blocks in the negative sample pair; determine the grouping of each target image block in the wafer under test based on the contrast loss function value.
[0026] In dark-field images of wafers, grain boundary densities vary significantly across different spatial regions. Dense grain boundary regions exhibit continuous linear scattering, while sparse grain boundary regions show isolated point scattering. This difference directly impacts the difficulty of defect detection: in dense grain boundary regions, continuous linear backgrounds can easily be confused with tiny particle defects, leading to false alarms; in sparse grain boundary regions, clean backgrounds but isolated noise can easily be confused with real defects, resulting in missed detections. However, conventional grayscale statistics alone cannot effectively distinguish these regions. For example, the grayscale distribution of a continuous line in a dense grain boundary region may be very similar to the grayscale distribution of an isolated particle defect in a sparse grain boundary region. Therefore, this invention determines the grain boundary density of each image block based on the grayscale gradient distribution of pixels within that block, directly quantifying the grain boundary density of the region where the image block is located, and providing a physical basis for subsequent dynamic adjustment of the contrast loss function.
[0027] In conventional contrastive learning, all negative sample pairs are treated equally, meaning the model applies the same repulsive force to all negative sample pairs. This uniform approach has significant drawbacks in wafer dark-field image scenarios. If both image patches in a negative sample pair originate from dense grain boundary regions, the complex background and naturally dispersed feature distribution in these regions can lead to excessive compression of the feature space by applying an overly strong repulsive force, causing normally occurring background lines to be misclassified as defects. Conversely, if both image patches in a negative sample pair originate from sparse grain boundary regions, the clean background and naturally compact feature distribution in these regions can result in the model being unable to effectively distinguish between normal background and isolated point defects, leading to missed detection of minute particle defects. Therefore, this invention dynamically adjusts the contribution weight of each negative sample pair in the contrastive loss function based on the combination of grain boundary densities between the image patches in the negative sample pair, thereby determining the contrastive loss function value for each batch of image patches. Through this dynamic boundary adjustment that adapts to grain boundary density, the contrastive loss function can apply differentiated training signals according to the characteristics of different regions, so that the final feature space can maintain a reasonable dispersion in dense regions and sufficient compactness in sparse regions.
[0028] After training using the contrastive loss function, the encoder is optimized to map wafer sample image patches with similar physical properties (illumination conditions and grain boundary density) to similar locations in the feature space, thus forming several groups. Each group corresponds to a specific combination of illumination interval and grain boundary density, recording the feature distribution patterns of different regions on the wafer surface under normal conditions. Therefore, based on the contrastive loss function, this invention determines the group to which each target image patch in the wafer belongs, comparing the target image patch with image patches on wafer samples within its own group, rather than comparing it with all image patches on the entire wafer. This same-group comparison mechanism avoids misjudgments caused by differences in physical properties between different regions, making defect detection more accurate and physically interpretable.
[0029] S103: Determine the defect image of each target image block based on the directional response distribution of pixels within each target image block; determine the corresponding original defect intensity based on the gray-level gradient distribution of pixels within the defect image; and determine the final defect intensity of each target image block based on the original defect intensity and the directional distribution of image blocks in the assigned group.
[0030] In dark-field images of wafers, the scattering signal on the wafer surface is actually composed of two superimposed parts: one part is continuous strip-shaped scattering generated by the wafer's own microstructure (grain boundaries), and the other part is isolated point-shaped scattering generated by defects on the wafer surface (such as particle contamination, scratches, etc.). If defect detection is performed directly on the original image, continuous lines in dense grain boundary regions are easily misjudged as defects, leading to a large number of false alarms. Traditional morphological processing methods usually use structure elements of fixed shape and size for opening operations, but this method cannot adapt to the differences in different regions of the wafer surface. Dense grain boundary regions require longer structure elements to effectively strip continuous lines, while sparse grain boundary regions only require shorter structure elements. Using a fixed length will result in incomplete stripping in dense regions or over-stripping in sparse regions. Therefore, this invention determines the defect image of each target image block based on the directional response distribution of pixels within each target image block.
[0031] After acquiring the defect image, it is necessary to extract the actual wafer defect signal. Since the defect image contains both isolated scattering points generated by real defects and interference signals such as sensor noise, using a fixed grayscale threshold for segmentation can easily lead to false alarms in dense grain boundary regions due to complex backgrounds, even after opening operations. Conversely, in sparse grain boundary regions with clean backgrounds, the grayscale of weak defects may be low, leading to missed detections with a fixed threshold. Therefore, this invention employs a dynamic threshold strategy based on the grayscale gradient distribution of pixels within the defect image to determine the corresponding original defect intensity. The original defect intensity reflects the significance of the grayscale of isolated scattering points in the image block and serves as the basis for determining the presence of defects.
[0032] Since the original defect intensity is calculated based solely on the grayscale of isolated points in the defect image, it does not consider structural anomalies in grain boundary arrangement. In actual wafer manufacturing, certain process anomalies (such as uneven etching, deposition anomalies, etc.) may lead to disordered grain boundary arrangement, and such structural anomalies are not necessarily accompanied by obvious grayscale anomalies. If only the original defect intensity is relied upon for judgment, such structural anomalies are easily missed. Therefore, this invention corrects the original defect intensity based on the directional distribution of image blocks in the assigned group, thereby determining the final defect intensity of each target image block. Through this correction mechanism, this invention can detect not only particle defects reflected by grayscale anomalies but also process defects reflected by structural anomalies, achieving the localization of wafer surface defects.
[0033] S104: Perform defect detection on the wafer under test based on the final defect strength.
[0034] Since the final defect intensity obtained in S103 quantifies the defect degree of each target image block of the wafer under test, the final defect intensity is still a local indicator on a per-image-block basis and has not yet formed a global judgment on the defect status of the entire wafer. Defect instance information available for production line use, such as whether each image block constitutes a defect, how the same defect detected in multiple adjacent image blocks is merged, and the actual physical location of the defect on the wafer, has not yet been obtained. Therefore, this invention performs defect detection on the wafer under test based on the final defect intensity.
[0035] Specifically, target image blocks with a final defect intensity greater than a preset defect threshold are used as candidate defect image blocks. Since there are overlapping areas between image blocks, the same defect may be detected by multiple adjacent image blocks simultaneously. Therefore, this invention divides the wafer image under test into grids, setting the grid size to 16×16 pixels. For each grid cell, the number of candidate defect image blocks covering that grid cell is counted. If the number of candidate defect image blocks is greater than or equal to 3, the grid cell is marked as a defect region. Connectivity analysis is performed on the defect region in the wafer image under test, and adjacent grid cells are merged into a defect instance. By obtaining all defect instances of the wafer under test, defect detection of the wafer under test is achieved.
[0036] In one specific implementation of this invention, an 8-connectivity rule is used to perform connectivity analysis on each defect region, merging adjacent mesh cells into a single defect instance. A preset defect threshold of 0.6 is set, which can be adjusted according to the specific implementation scenario.
[0037] It should be noted that the higher the preset defect threshold, the stricter the detection standard, the lower the false alarm rate, but the higher the missed detection rate; the lower the preset defect threshold, the more lenient the detection standard, the lower the missed detection rate, but the higher the false alarm rate.
[0038] In summary, this invention determines corresponding negative sample pairs based on the polar angle deviation distribution in image blocks, prioritizing the construction of negative sample pairs for image blocks in different illumination regions. This effectively avoids the feature collapse problem of existing technologies and improves the discriminative ability of the feature space. By determining the contrast loss function value of each batch of image blocks based on the grain boundary density combination of the two image blocks in the negative sample pair, it achieves differentiated processing for regions with different grain boundary densities, significantly reducing the false alarm rate in dense grain boundary regions and the false negative rate in sparse grain boundary regions. Furthermore, by determining the classification of each target image block in the wafer under test... By grouping images into groups, the source of defects can be effectively located. By determining the original defect intensity of each target image block, the interference of continuous lines in the background of dense grain boundary regions on the detection of isolated point defects is fundamentally avoided, thus improving the accuracy of defect detection. Based on the original defect intensity and the directional distribution of image blocks in the group, the final defect intensity of each target image block is determined, enabling accurate identification of grain boundary disorder caused by wafer process anomalies. This solves the problems of feature collapse, high false alarm rate in dense grain boundary regions, and high false negative rate in sparse grain boundary regions, thereby improving the accuracy of wafer defect detection.
[0039] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the negative sample pairs includes: In wafer dark-field imaging, a light source illuminates the wafer surface at a fixed tilt angle and azimuth angle. Since the wafer is a circular thin sheet, the angle of incidence of light emitted from the light source varies when it reaches different areas of the wafer. Areas facing the light source (i.e., those with a polar angle close to the azimuth angle of the light source) receive more light energy and appear brighter in the image; areas facing away from the light source receive less light energy and appear less bright in the image. This brightness difference caused by illumination geometry is an inherent physical property of wafer imaging, rather than an anomaly caused by defects. Therefore, this invention obtains the polar angle of the center point of each image block in the wafer polar coordinate system to reflect the angular position of that image block on the wafer.
[0040] In contrastive learning frameworks, the selection of negative samples needs to be defined relative to a reference sample (i.e., anchor sample). If image patches at certain specific locations are fixed as anchor samples, the model will overfit to these locations and fail to learn the illumination variation patterns of different areas on the wafer surface. Therefore, this invention randomly selects one image patch from each batch of image patches as the anchor image patch, ensuring that the model can access samples at various angles on the wafer during training, thereby learning the global illumination geometry distribution.
[0041] In one specific implementation of this invention, a random number method is used to randomly select an image block from each batch as the anchor image block. The random number method is a technique well-known to those skilled in the art, and its implementation process will not be described in detail here.
[0042] Regions on the wafer with polar angles close to the anchored image block (i.e., regions facing similar light sources) exhibit similar brightness distributions and scattering characteristics. Differences between these regions fall within the normal range of illumination gradients and should not be forcibly pushed apart. Conversely, regions with significantly different polar angles from the anchored image block (i.e., regions facing away from or to the side of the light source) exhibit fundamentally different brightness distributions and scattering characteristics. These differences are caused by illumination geometry rather than defects. Therefore, this invention determines non-illuminated regions based on the deviation between the polar angle of the anchored image block and the preset azimuth angle of the light source.
[0043] In one specific implementation of this invention, the minimum angle between the polar angle of each image block and the preset azimuth angle of the light source is taken as the corresponding incident angle deviation. For example, if the polar angle of the image block is... If the preset light source azimuth angle Then the angle between the two is or In this embodiment of the invention, the smallest included angle between the two is selected, i.e. As the incident angle deviation; As a lighting zone, in which Indicates the incident angle deviation of the anchored image patch; This represents the half-width of the lighting interval, which is set in this embodiment of the invention. The settings can be adjusted according to the specific implementation scenario; areas outside the illumination zone are designated as non-illumination zones. The preset light source azimuth angle is determined during the data acquisition process in S101 and remains constant throughout the detection process; all image blocks in the current image block batch whose incident angle deviation falls within the non-illumination zone are designated as negative sample image blocks.
[0044] In dark-field images, normal areas are almost entirely black, and the pixel content of normal image patches at different locations is highly similar (containing only random sensor noise). This leads to a tendency in existing technologies, when constructing negative sample pairs using contrastive learning algorithms, for the model to map the features of all normal image patches to the same extremely small region in the feature space—a phenomenon known as feature collapse. Therefore, this invention uses all image patches located in unlit areas as negative sample image patches for anchoring, forcing the model to separate the features of normal image patches under different lighting conditions. Features of image patches facing the light source are mapped to one region in the feature space, while features of image patches facing away from the light source are mapped to another region far from that region. The feature space is thus enlarged, forming multiple regions distributed along the direction of light, thereby preventing feature collapse from the outset.
[0045] Finally, based on the anchored image block and each negative sample image block, all negative sample pairs are determined. It should be noted that each negative sample pair consists of one anchored image block and one negative sample image block.
[0046] Preferably, in some possible implementations of the embodiments of the present invention, the specific process for obtaining the grain boundary density in S102 includes: Please refer to... Figure 2 The diagram illustrates a flowchart of a method for obtaining grain boundary density according to an embodiment of the present invention, the method comprising: S201: Determine the scattering pixels of each image block based on the difference in gray values of each pixel within a preset neighborhood range.
[0047] In wafer dark-field images, the microstructures (grain boundaries) and defects (particles, scratches) on the wafer surface generate scattering signals, which are typically represented by pixels with high grayscale values in the image. However, these two types of scattering signals have fundamentally different morphological characteristics: scattering from grain boundaries exhibits a continuous strip-like structure, while scattering from defects usually presents an isolated point-like structure. To distinguish between these two types of scattering signals, it is first necessary to extract the scattering pixels from the background. Considering that the background (normal area) of a wafer dark-field image is almost entirely black, with extremely low and uniformly distributed grayscale values, containing only random sensor noise, in contrast, the grayscale values of scattering from both grain boundaries and defects are significantly higher than those from the background. Therefore, this invention determines the scattering pixels of each image block based on the difference in grayscale values of each pixel within a preset neighborhood range.
[0048] In this embodiment of the invention, the preset neighborhood range is set to 24 neighborhoods; the average gray value of all pixels within the preset neighborhood range of each pixel is calculated as the neighborhood gray value threshold; if the gray value of the pixel is greater than the neighborhood gray value threshold, then the pixel is regarded as a scattering pixel.
[0049] S202: Perform connected component analysis on the scattered pixels to determine the connected components of each image block; The extracted scattering pixels may be distributed in different forms: some are continuous lines (grain boundaries), some are clustered (particle defects), and some are isolated and scattered (noise). Simply knowing which pixels are scattering pixels is insufficient to determine whether the scattering is caused by grain boundaries or defects. For example, a continuous line caused by a grain boundary may contain dozens of adjacent scattering pixels, a tiny particle defect may contain only a few adjacent scattering pixels, and random noise may appear as isolated single pixels. Therefore, connected component analysis is needed to determine the corresponding connected components. Through connected component analysis, the originally scattered scattering pixels are divided into several meaningful wholes, with each connected component corresponding to a grain boundary line, a particle defect, or a cluster of noise, used to subsequently distinguish different scattering patterns.
[0050] In one specific implementation of this invention, a seed filling method is used to label connected components for all scattering pixels. Utilizing the 8-connectivity rule (including top, bottom, left, right, and four diagonal directions), adjacent scattering pixels are aggregated into an independent connected component. It should be noted that the seed filling method is a well-known technique, and its calculation process will not be elaborated upon here.
[0051] S203: Determine the corresponding bar coefficients based on the aspect ratio of the minimum bounding rectangle of each connected component and the number of pixels in each connected component.
[0052] After obtaining each connected region, its morphological characteristics need to be quantified to distinguish between strip-like structures (grain boundaries) and point-like structures (defects or noise). The minimum bounding rectangle of a connected region can well reflect its overall morphology: for a long, thin strip-like connected region, the longer side of its minimum bounding rectangle is much larger than the shorter side, resulting in a large aspect ratio; for an approximately circular point-like connected region, the longer side of its minimum bounding rectangle is close to the shorter side, resulting in an aspect ratio close to 1. However, aspect ratio alone is insufficient to fully describe the morphology of a connected region. A long, thin line may only be a few pixels long, while an irregular defect cluster may have a large aspect ratio but a small area. Therefore, the number of pixels within the connected region also needs to be considered. The number of pixels reflects the size of the connected region; therefore, this embodiment of the invention determines the corresponding strip coefficient based on the aspect ratio of the minimum bounding rectangle of each connected region and the number of pixels within each connected region.
[0053] In one specific implementation of this invention, the minimum bounding rectangle of each connected component is obtained using the rotating caliper method. The normalized value of the product of the aspect ratio of the minimum bounding rectangle and the number of pixels in the connected component is used as the bar coefficient, which physically reflects the elongation and size of the connected component. In this embodiment, the minimum-maximum normalization algorithm is used to map the product to the range [0,1]. The maximum and minimum values used in the minimum-maximum normalization algorithm can be obtained by statistically analyzing the maximum and minimum values of the product of the aspect ratio of the minimum bounding rectangle of all image blocks in the wafer and the number of pixels in the connected component. The minimum-maximum normalization algorithm is a well-known technique, and its implementation process will not be described in detail here.
[0054] It should be noted that if the width of the minimum bounding rectangle is 0, it means that all pixels in the connected component are distributed along a one-dimensional straight line (single row or single column) or degenerate into a single point (single pixel). In this case, the aspect ratio is theoretically infinite (single row / single column) or undefined (single pixel, not a strip structure), and directly calculating the aspect ratio has no physical meaning. Therefore, in this embodiment of the invention, when the width of the minimum bounding rectangle is 0, if all pixels in the connected component are distributed along a one-dimensional straight line (single row or single column), its strip coefficient is forcibly set to 1; if the connected component has only one pixel, its strip coefficient is forcibly set to 0.
[0055] S204: Determine the grain boundary density of each image block based on the central tendency of the bar coefficients of all connected domains within each image block.
[0056] After extracting scattering pixels and performing connected component analysis, each image patch typically contains multiple connected components. These connected components may have different bar coefficients: in grain boundary-dense regions, there are more connected components, and the bar coefficient of each connected component is generally higher; in grain boundary-sparse regions, there are fewer connected components, and the bar coefficient of each connected component is generally lower; in the transition regions between the two, there may be multiple types of connected components, and the bar coefficients are widely distributed. Therefore, the distribution of bar coefficients of connected components within each image patch indirectly reflects the grain boundary density of each image patch. Thus, this invention determines the grain boundary density of each image patch based on the central tendency of the bar coefficients of all connected components within each image patch.
[0057] In one specific implementation of this invention, considering that the mean value can eliminate the influence of the number of connected components, truly reflect the average stripe degree of each connected component, and is robust to noise, this embodiment uses the mean value of the stripe coefficients of all connected components within each image block as the grain boundary density of each image block. It should be noted that the grain boundary density is a dimensionless constant within the range [0,1].
[0058] Preferably, in some possible implementations of the embodiments of the present invention, the specific process of obtaining the comparison loss function value in S102 includes: Please refer to Figure 3 The diagram illustrates a flowchart of a method for obtaining a contrastive loss function value according to an embodiment of the present invention. The method includes: S301: Determine the illumination range based on the deviation between the polar angle of the anchored image block and the preset azimuth angle of the light source; take all image blocks located in the illumination range as positive sample image blocks of the anchored image block; determine all positive sample pairs based on the anchored image block and each positive sample image block.
[0059] Regions on the wafer with polar angles close to those of the anchored image block (i.e., regions facing the light source in a similar direction) exhibit similar brightness distributions and scattering characteristics. Differences between these regions fall within the normal range of illumination gradients and should not be forcibly pushed apart. Conversely, regions with polar angles significantly different from those of the anchored image block (i.e., regions facing away from or to the side of the light source) exhibit fundamentally different brightness distributions and scattering characteristics. These differences are caused by illumination geometry rather than defects. Therefore, this embodiment of the invention determines the illumination interval based on the deviation between the polar angle of the anchored image block and the preset azimuth angle of the light source; and designates all image blocks located within the illumination interval as positive sample image blocks for the anchored image block; finally, it determines all positive sample pairs based on the anchored image block and each positive sample image block. Each positive sample pair consists of one anchored image block and one positive sample image block.
[0060] In one specific implementation of this invention, all image blocks in the current image block batch whose incident angle deviation falls within the illumination range are designated as positive sample image blocks. It should be noted that the illumination range has already been determined during the acquisition of the negative sample pairs described above, and this acquisition process will not be elaborated upon here.
[0061] S302: Perform feature encoding on each image block in each batch of image blocks to determine the corresponding feature vector; determine the positive sample similarity index of each positive sample pair based on the cosine similarity between the feature vector of the anchor image block in each positive sample pair and the feature vector of each positive sample image block; determine the negative sample similarity index of each negative sample pair based on the cosine similarity between the feature vector of the anchor image block in each negative sample pair and the feature vector of each negative sample image block.
[0062] Considering the high dimensionality of the original pixel matrix of image blocks and the presence of a large amount of redundant information unrelated to defect detection (such as sensor noise, absolute brightness values, etc.), directly performing similarity comparisons in the high-dimensional pixel space is not only computationally intensive but also susceptible to noise interference, failing to capture the semantic similarity between image blocks. Therefore, this embodiment of the invention performs feature encoding on each image block in each batch to determine the corresponding feature vector. In the feature vector space, the cosine similarity between two vectors can effectively measure the semantic similarity between two image blocks; the higher the cosine similarity, the closer the features of the two image blocks are. Therefore, this embodiment of the invention determines the positive sample similarity index of each positive sample pair based on the cosine similarity between the feature vector of the anchor image block in each positive sample pair and the feature vector of each positive sample image block; and determines the negative sample similarity index of each negative sample pair based on the cosine similarity between the feature vector of the anchor image block in each negative sample pair and the feature vector of each negative sample image block.
[0063] In one specific implementation of this invention, an encoder based on a convolutional neural network architecture is used to obtain the feature vector of each image block; and the cosine similarity between the feature vector of the anchored image block in each positive sample pair and the feature vector of each positive sample image block is used as the corresponding positive sample similarity index; and the cosine similarity between the feature vector of the anchored image block in each negative sample pair and the feature vector of each negative sample image block is used as the corresponding negative sample similarity index.
[0064] S303: Determine the corresponding boundary coefficient based on the grain boundary density of the anchored image block and the grain boundary density of the negative sample image block in each negative sample pair; determine the weighted negative sample similarity index of each negative sample pair based on the boundary coefficient and the negative sample similarity index.
[0065] In conventional contrastive loss functions (such as InfoNCE), all negative sample pairs are treated equally, meaning the model applies the same repulsive force to all negative sample pairs. This uniform approach has significant drawbacks in wafer dark-field image scenarios. The grain boundary density varies significantly across different regions of the wafer surface: dense grain boundary regions exhibit continuous linear scattering, with a complex and diverse background and naturally dispersed feature distribution; sparse grain boundary regions exhibit isolated point scattering, with a clean background and naturally compact feature distribution. Applying the same repulsive force to negative sample pairs in both dense and sparse regions can lead to over-compression of features in dense regions (increasing the risk of false positives) or under-compression of features in sparse regions (increasing the risk of false negatives). To address this issue, this invention introduces a grain boundary density prior. Based on the grain boundary density of the anchor image block and the grain boundary density of the negative sample image block in each negative sample pair, corresponding boundary coefficients are determined. These boundary coefficients are then used to perform a weighted analysis of the negative sample similarity index for each negative sample pair, resulting in a weighted negative sample similarity index.
[0066] As an example, boundary coefficients The calculation formula can be expressed as: in, This represents the grain boundary density of the anchored image block; Represents the grain boundary density of the negative sample image block; This represents the minimum-maximum normalization function, used in embodiments of the invention to... Mapped to the range [0,1], where the maximum and minimum values used by the min-max normalization algorithm can be obtained by statistically analyzing the maximum and minimum values of the reciprocal of the sum of the grain boundary density of the anchored image block and the grain boundary density of the negative sample image block in all negative sample pairs. The boundary coefficient represents the mapping offset, with a preferred range of [0.2, 0.8]. In this embodiment, it is set to 0.5 (which can be adjusted within the preferred range according to the specific implementation scenario). This makes the boundary coefficient range [0.5, 1.5]. When the boundary coefficient is greater than 1, the negative sample similarity index is amplified, forcing the model to prioritize reducing the similarity of these negative samples, thereby achieving the training objective of compact features in sparse regions. When the boundary coefficient is less than 1, the negative sample similarity index is reduced, allowing negative samples in dense regions to maintain relatively high similarity, thereby achieving the training objective of dispersed features in dense regions. When the boundary coefficient is equal to 1, the negative sample similarity index and the positive sample similarity index remain at the same order of magnitude.
[0067] The design logic is as follows: when the sum of the grain boundary densities of two image patches is large (both originating from dense regions), the boundary coefficient is small, reducing the repulsive force on the negative sample pair and allowing the feature distribution in the dense region to be relatively dispersed; when the sum of the grain boundary densities is small (both originating from sparse regions), the boundary coefficient is large, increasing the repulsive force on the negative sample pair and forcing the feature distribution in the sparse region to be more compact. The product of the boundary coefficient and the negative sample similarity index is used as the weighted negative sample similarity index.
[0068] It should be noted that when the sum of the grain boundary density of the anchored image block and the grain boundary density of the negative sample image block in each negative sample pair is 0, it means that there are no scattering pixels in the image block or only isolated scattering pixels, which are usually located in the sparse grain boundary region or near the edge of the wafer. The repulsion force on the negative sample pair should be set to the default strength of conventional contrastive learning. In this embodiment of the invention, its boundary coefficient is forcibly set to 1, neither enhancing nor weakening it.
[0069] S304: Determine the contrast loss function value for each batch of image blocks based on the positive sample similarity index and the weighted negative sample similarity index.
[0070] As an example, compare the loss function values The calculation formula can be expressed as: in, This indicates the number of positive sample pairs within each image patch; Indicates the first Positive sample similarity index for positive sample pairs; This indicates the number of negative sample pairs within each image patch; Indicates the first The weighted negative sample similarity index for each negative sample pair; This represents an exponential function with the natural constant e as its base. It is used to map the positive sample similarity index and the weighted negative sample similarity index to positive numbers and amplify the differences, making the loss function more sensitive to changes in similarity and thus providing a stronger training signal.
[0071] It should be noted that the denominator in the above formula is composed of the sum of the positive sample similarity indices and the sum of the negative sample similarity indices. Since the range of the exponential function exp is (0, +∞), and the number of samples in each batch is always greater than zero, meaning there is at least one positive or negative sample image patch, the denominator is always greater than 0, and there is no risk of division by zero.
[0072] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the affiliation group includes: In dark-field images of wafers, normal areas are almost entirely black, and normal image patches at different locations are highly similar at the pixel level. If raw pixels are used directly for defect detection, continuous lines in dense grain boundary regions and isolated point defects in sparse grain boundary regions may be very similar in pixel distribution, making effective differentiation impossible. However, the contrast loss function forces the model to learn the differences in illumination direction by dividing the illumination interval, and dynamically adjusts the repulsive force of negative samples through grain boundary density combinations. Therefore, this invention aims to minimize the contrast loss function value by using each image patch in the wafer sample as training data to train the encoder for feature encoding; the trained encoder is then used as a feature extractor. In one specific implementation of this invention, in each training iteration, the positive and negative sample pairs of the current image patch batch are input into the pre-trained encoder to obtain the corresponding feature vectors; the contrastive loss function value of the current batch is calculated; and the encoder parameters are updated through backpropagation. This process is repeated until the average change in the loss value is less than 0.001 or the number of iterations reaches 1000, at which point convergence is determined and training stops. The trained encoder is used as a feature extractor for target image patch feature extraction in the subsequent inference stage.
[0073] During wafer manufacturing, wafers from different products and batches may have different illumination distributions and grain boundary density distributions, making it impossible to predefine fixed grouping boundaries. Cluster analysis can adaptively determine the number of groups and grouping boundaries based on the actual data distribution; since the feature extractor can map image patches with similar physical properties to nearby locations in the feature space, the feature vectors of all training samples (image patches of wafer samples) form several natural clusters in the feature space. Therefore, this embodiment of the invention uses the feature extractor to obtain the sample feature vector of each image patch in the training data; the sample feature vectors are clustered to determine all candidate groupings.
[0074] In one specific implementation of this invention, the K-means clustering algorithm is used to cluster the sample feature vectors to determine all candidate groups; the number of cluster centers is set to 10, which can be adjusted according to the specific implementation scenario; after clustering, each cluster corresponds to a candidate group, and the feature center of each group is the cluster center of that cluster.
[0075] It should be noted that the K-means clustering algorithm is a well-known technique in the field, and its implementation process will not be described in detail here.
[0076] During the inference phase, it is necessary to determine whether each target image block in the wafer under test deviates from its normal state. Since different groups have different normal benchmarks (e.g., the variance of the angle between dense grain boundary regions is naturally larger, while the variance is naturally smaller in sparse grain boundary regions), a globally unified benchmark cannot be used for judgment. Furthermore, considering that the position of the feature vector directly reflects the physical properties of the image block, it is necessary to first determine the group to which each target image block belongs, i.e., find the training group most similar to the features of that target image block. In this embodiment of the invention, the feature extractor is used to obtain the target feature vector of each target image block in the wafer under test; based on the similarity distance between the target feature vector and each candidate group, the group to which each target image block belongs is determined.
[0077] In one specific implementation of this invention, the Euclidean distance between the target feature vector and the feature center of each candidate group is used as the similarity distance; the candidate group with the smallest similarity distance to the target feature vector is selected as the group to which the target image patch belongs.
[0078] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the defect image includes: In dark-field images of wafers, the scattering signals generated by grain boundaries exhibit a continuous strip-like structure with a clear directionality; that is, grain boundary lines typically extend along a specific direction (e.g., horizontal, vertical, or diagonal). In contrast, the scattering signals generated by defects (e.g., particulate contamination) usually present as isolated point-like structures without a clear directionality. This morphological difference is an important clue for distinguishing between grain boundary background and defects. Therefore, this embodiment of the invention performs convolution on each target image block to determine the response direction of each pixel in each target image block; further considering that the gray value of a single pixel alone cannot determine whether it belongs to a strip-like structure or a point-like structure. In image blocks of dense grain boundary regions, the response directions of most pixels may be concentrated in a dominant direction (e.g., horizontal), while in image blocks of sparse regions, the response directions of pixels may be more dispersed. Therefore, this invention determines the line direction of each target image block based on the number of pixels in each response direction.
[0079] In one specific implementation of this invention, four linear filter kernels with different directions are set, corresponding to 0°, 45°, 90°, and 135° directions, respectively. Each filter kernel has a size of 5×5, with coefficients of 1 along the corresponding angle direction and 0 at other positions. Each image block is convolved with the four linear filter kernels to obtain four directional response maps. For each pixel in the image block, its values in the four directional response maps are compared, and the direction corresponding to the maximum value is taken as the response direction of that pixel. All pixels in the image block are traversed, and the number of pixels in each response direction is counted. The response direction with the most pixels is determined as the line direction of the image block.
[0080] It should be noted that if there are multiple response directions with the same number of pixels, the minimum value of the response direction is selected as the line direction of the image block.
[0081] Since grain boundary density reflects the degree of grain boundary concentration in the region where the image patch is located, in densely grained regions, the grain boundary lines are dense and continuous, requiring longer structural elements to effectively strip these lines; in sparsely grained regions, the grain boundary lines are sparse and short, and using excessively long structural elements will lead to over-stripping, eliminating background details that should be preserved. Therefore, this invention determines the corresponding line length based on the size of each target image patch and its corresponding grain boundary density.
[0082] As an example, line length The calculation formula can be expressed as: ,in The maximum value of the line segment length of the target image block is set to 7 pixels in this embodiment of the invention; The minimum length of a line segment representing a target image patch is set to 5 pixels in this embodiment of the invention. This represents the grain boundary density of the target image patch. When the grain boundary density is high, the line length is close to the length of the target image patch (longer), allowing for the stripping of longer, continuous lines. When the grain boundary density is low, the line length is close to the width of the target image patch (shorter), stripping only shorter lines and avoiding over-stripping. This adaptive mechanism enables the opening operation to perform differentiated processing based on the grain boundary density characteristics of different regions, ensuring effective background stripping in dense areas while preserving the detail information in sparse areas.
[0083] It should be noted that, in order to facilitate the construction of subsequent linear structural elements, the line lengths obtained in this embodiment of the invention are all rounded down to ensure that the obtained line lengths are all integers.
[0084] Morphological opening is a combination of erosion and dilation operations. Its function is to eliminate small structures that do not match the structural elements, while retaining large-scale structures that match the structural elements. In this embodiment of the invention, morphological opening is performed on the target image block based on the line direction and line length to determine the opening image. This preserves continuous lines (i.e., grain boundary background) that are consistent with the grain boundary line direction and of sufficient length, while eliminating isolated points (including defects and noise) that do not conform to the direction or are insufficient in length. Since the obtained opening image mainly contains the grain boundary line background, and the wafer defect information is mainly present in the image foreground, this embodiment of the invention determines the defect image of each target image block based on the difference between each target image block and its corresponding opening image. The background signal is stripped from the original signal, and what remains is the foreground signal. Since the grain boundary line background has been effectively stripped, the residual image mainly contains real defects and noise.
[0085] In one specific implementation of this invention, a two-dimensional matrix is constructed based on the line direction and line length of each target image block, serving as the corresponding linear structural element. Specifically, for a line direction of... The line length is The process of constructing the linear structure elements corresponding to the target image patch is as follows: When X = 0° (horizontal direction): Construct a matrix with 1 row and 1 Y column, with all elements having a value of 1, representing a line segment in the horizontal direction.
[0086] When X = 45° (diagonal direction): Construct a Y×Y matrix with values of 1 along the main diagonal and 0 elsewhere, representing line segments in the 45° direction.
[0087] When X = 90° (vertical direction): Construct a matrix with Y rows and 1 column, where all elements are 1, representing line segments in the vertical direction.
[0088] When X = 135° (anti-diagonal direction): Construct a Y×Y matrix with values of 1 along the secondary diagonal and 0 elsewhere, representing the line segment in the 135° direction.
[0089] The above linear structuring elements are used to perform morphological opening operations on the target image blocks to obtain the opening operation image. For each pixel position, its gray value in the target image block is subtracted from the corresponding gray value in the opening operation image to obtain its gray value in the defect image. The gray value of each pixel position in the defect image is calculated sequentially to obtain the defect image of each target image block.
[0090] It should be noted that morphological opening operations are a technique well-known to those skilled in the art, and their implementation process will not be elaborated here.
[0091] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the original defect strength includes: Defect images contain both isolated scattering points from actual defects and interference signals such as sensor noise. Using a fixed grayscale threshold for segmentation presents a fundamental challenge: dense grain boundary regions, even after opening operations, may still retain some background lines. These residual background lines may have high grayscale values, making them prone to misclassification as defects with a fixed threshold, leading to a higher false alarm rate. Conversely, sparse grain boundary regions have clean backgrounds, but the grayscale values of actual defects may be relatively low, making them prone to missed detection with a fixed threshold, resulting in a higher false negative rate. Therefore, this invention determines the grayscale threshold based on the overall normal grayscale distribution of pixels within the defect image and the grain boundary density of the target image block.
[0092] As an example, grayscale threshold The calculation formula can be expressed as: in, This represents the base grayscale value, which in this embodiment of the invention is set as the average grayscale value of all pixels in the defective image. This represents the grayscale offset, which in this embodiment of the invention is set as the standard deviation of the grayscale values of all pixels within the defective image. This represents the grain boundary density of the target image block corresponding to the defect image; This represents the weighted offset. When the grain boundary density... A larger value indicates that the image patch originates from a region with dense grain boundaries and a relatively complex background. Smaller, grayscale threshold close to The segmentation conditions are relatively strict to reduce false alarms; when the grain boundary density is low, it indicates that the image block comes from a sparse grain boundary region with a clean background. Larger, grayscale threshold close to The segmentation conditions are relatively lenient to reduce missed detections. This formula allows the grayscale threshold to be set within a certain range. Within the range, it adaptively adjusts with grain boundary density.
[0093] After dynamic thresholding, the defect image is binarized, yielding several candidate pixels. However, true defects typically manifest as connected regions formed by clusters of adjacent pixels, while random noise usually appears as isolated single pixels. If the grayscale information of all candidate pixels is directly used to calculate the final defect intensity, isolated noise points will introduce significant errors, leading to an artificially inflated original defect intensity. Therefore, this embodiment of the invention performs connected component analysis on pixels in the defect image with grayscale values greater than the grayscale threshold to determine all defect connected components. Each connected component represents a potential defect structure. Through connected component analysis, true defects and isolated structural noise can be distinguished. In subsequent processing, different weights can be assigned to connected components of different sizes to suppress the influence of noise on the final defect intensity calculation.
[0094] In this embodiment of the invention, pixels with gray values greater than the gray threshold in the defect image are taken as candidate pixels. A seed filling method is used to mark connected components for all candidate pixels. Using the 8-connectivity rule, including the top, bottom, left, right and four diagonal directions, adjacent candidate pixels are aggregated into an independent connected component, thereby obtaining all defect connected components.
[0095] Furthermore, considering that each connected component contains multiple pixels, each with a different grayscale value, generally, the more severe the defect, the stronger its scattering signal, and the higher the grayscale value of the corresponding pixel. Therefore, this embodiment of the invention determines the original defect intensity of the target image block based on the central tendency of the grayscale values within all defect connected components.
[0096] In one specific implementation of this invention, the maximum gray value of each pixel in each defect connected region is taken as the gray value feature of each defect connected region; the mean of the gray value feature of all defect connected regions in each defect image is taken as the central tendency quantity, thereby obtaining the original defect intensity of the target image block.
[0097] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the final defect strength includes: The opening operation image primarily preserves the grain boundary line structure of the wafer itself, which is a normal manifestation of the wafer's microstructure. Each grain boundary line appears as a continuous strip-shaped connected region in the image, and its extension direction reflects the alignment and orientation of the grain boundaries at that location. In a normal wafer, grain boundary lines in the same region usually have a relatively consistent direction, because the wafer manufacturing process (such as ingot cutting, polishing, etching, etc.) determines the preferred orientation of the grains. Therefore, the consistency of the grain boundary line direction can serve as a physical indicator of whether the wafer structure is normal. To quantify this indicator, this embodiment of the invention performs connected component analysis on the opening operation image of each target image block to determine all background connected components. Since the minimum bounding rectangle is the rectangle that can completely contain all pixels within the connected component and has the smallest area, the direction of this rectangle can be freely rotated according to the orientation of the connected component. Therefore, this embodiment of the invention uses the angle between the long side of the minimum bounding rectangle of the background connected component and the horizontal line as the background connected component angle; and determines the background angle deviation based on the dispersion of all background connected component angles.
[0098] In one specific implementation of this invention, a seed filling method is used to mark connected components in the opening operation image. Utilizing the 8-connectivity rule (where vertical, horizontal, left, and right, and the four diagonals are considered adjacent), consecutive pixels on the same line are marked as the same connected component, thus obtaining all background connected components. A rotating caliper method is used to obtain the minimum bounding rectangle of each background connected component. The angle between the long side of the minimum bounding rectangle and the horizontal line is taken as the background connected component angle, which is between 0° and 180°. The normalized value of the variance of all background connected component angles is taken as the background angle deviation. In this embodiment, a minimum-maximum normalization algorithm is used to map the variance of all background connected component angles to the range [0,1]. The maximum and minimum values used in the minimum-maximum normalization algorithm can be obtained by statistically analyzing the maximum and minimum variances of the background connected component angles of all target image blocks within the wafer under test.
[0099] Considering that the background angle deviation of a target image patch alone is insufficient to determine whether it is abnormal, since different grouped wafer regions have different normal references, if a uniform reference is used for judgment, normal image patches in dense areas may be misjudged as abnormal (due to their large variance), while abnormal image patches in sparse areas may be missed (due to their small variance). To solve this problem, this invention determines the connected component angle of each connected component within the image patch based on the image patch corresponding to the group to which each target image patch belongs; and determines the arrangement deviation of each target image patch based on the dispersion and central tendency of all connected component angles, combined with the background angle deviation.
[0100] In one specific implementation of this invention, based on the principle of obtaining the same background connected component angles, the connected component angles of each image block can be obtained by simply replacing the opening operation image with each image block corresponding to the group to which each target image block belongs. The normalized value of the mean of the connected component angles of all image blocks corresponding to the group to which each target image block belongs is used as the central tendency of the group. The normalized value of the standard deviation of the connected component angles of all image blocks corresponding to the group to which each target image block belongs is used as the dispersion of the group. In this embodiment of the invention, the minimum-maximum normalization algorithm is used to map the mean and standard deviation of all connected component angles to the range [0,1]. The maximum and minimum values used by the minimum-maximum normalization algorithm can be obtained by statistically analyzing the maximum and minimum values of the mean and standard deviation of all connected component angles within the wafer under test.
[0101] As an example, permutation bias The calculation formula can be expressed as: in, Indicates the deviation of the background angle; Indicates the central tendency of the grouping; Indicates the dispersion of the assigned group; This represents a very small positive number, and in this embodiment of the invention, it is set to 0.001 to prevent the denominator from being 0; This indicates the absolute deviation of the angular deviation of the target image patch from the grouped normal baseline. A larger value indicates a greater difference between the grain boundary arrangement of the target image patch and the normal state. Because... This reflects the natural fluctuation range of the grain boundary arrangement of a normal wafer within the group. Therefore, this invention directly quantifies the deviation of the target image block by calculating the ratio of the two to the multiple of the dispersion of the assigned group, thereby eliminating the dimensional differences caused by the different normal fluctuation ranges between different groups.
[0102] Since the original defect strength is calculated based solely on the grayscale of isolated points in the defect image, it reflects the severity of grayscale anomalies (such as particle defects, scratches, etc.). However, certain process anomalies (such as uneven etching, deposition anomalies) may lead to disordered grain boundary alignment, and such structural anomalies are not necessarily accompanied by obvious grayscale anomalies. If only the original defect strength is relied upon for judgment, such structural anomalies are easily missed. Therefore, this invention introduces alignment deviation as a correction factor into the final defect strength calculation, determining the corresponding final defect strength based on the alignment deviation and original defect strength of each target image block.
[0103] As an example, final defect strength The calculation formula can be expressed as: ,in Indicates the original defect strength; This indicates the arrangement deviation; the formula is derived by using the original defect strength. Based on this, the arrangement deviation p is used as a penalty factor for amplification. This results in the final defect strength being enhanced when there is an anomalous grain boundary arrangement (p > 0); and when the grain boundary arrangement is normal (p approaches 0), the final defect strength remains essentially unchanged.
[0104] Based on the same inventive concept, the present invention also proposes a wafer defect detection system based on a self-supervised learning algorithm, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of a wafer defect detection method based on a self-supervised learning algorithm.
[0105] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0106] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A wafer defect detection method based on a self-supervised learning algorithm, characterized in that, The method includes: Obtain each image block in the wafer sample; determine the corresponding negative sample pair based on the polar angle deviation distribution in the image block; The grain boundary density of each image block is determined based on the gray-level gradient distribution of pixels within each image block; the contrast loss function value of each batch of image blocks is determined based on the combination of grain boundary densities between image blocks in the negative sample pair; and the grouping of each target image block in the wafer under test is determined based on the contrast loss function value. Based on the directional response distribution of pixels within each target image block, a defect image for each target image block is determined; based on the grayscale gradient distribution of pixels within the defect image, the corresponding original defect intensity is determined; based on the original defect intensity, and according to the directional distribution of image blocks in the assigned group, the final defect intensity for each target image block is determined. Defect detection is performed on the wafer under test based on the final defect strength.
2. The wafer defect detection method based on a self-supervised learning algorithm according to claim 1, characterized in that, The method for obtaining the negative sample pairs includes: Obtain the polar angle of the center point of each image block in the wafer polar coordinate system; One image block is randomly selected from each batch of image blocks as the anchor image block; the non-illuminated region is determined based on the deviation between the polar angle of the anchor image block and the preset azimuth angle of the light source; all image blocks located in the non-illuminated region are used as negative sample image blocks of the anchor image block. Based on the anchored image block and each negative sample image block, all negative sample pairs are determined.
3. The wafer defect detection method based on a self-supervised learning algorithm according to claim 1, characterized in that, The method for obtaining grain boundary density includes: The scattering pixels of each image block are determined based on the difference in gray values of each pixel within a preset neighborhood range. Connectivity analysis is performed on the scattering pixels to determine the connected components of each image block; The corresponding bar coefficients are determined based on the aspect ratio of the minimum bounding rectangle of each connected component and the number of pixels in each connected component. The grain boundary density of each image block is determined based on the central tendency of the bar coefficients of all connected domains within each image block.
4. The wafer defect detection method based on a self-supervised learning algorithm according to claim 2, characterized in that, The method for obtaining the value of the contrastive loss function includes: The illumination range is determined based on the deviation between the polar angle of the anchored image block and the azimuth angle of the preset light source; all image blocks located within the illumination range are used as positive sample image blocks of the anchored image block; all positive sample pairs are determined based on the anchored image block and each positive sample image block. For each image block in each batch of image blocks, feature encoding is performed to determine the corresponding feature vector; based on the cosine similarity between the feature vector of the anchor image block in each positive sample pair and the feature vector of each positive sample image block, the positive sample similarity index of each positive sample pair is determined; based on the cosine similarity between the feature vector of the anchor image block in each negative sample pair and the feature vector of each negative sample image block, the negative sample similarity index of each negative sample pair is determined. Based on the grain boundary density of the anchored image block and the grain boundary density of the negative sample image block in each negative sample pair, the corresponding boundary coefficient is determined; based on the boundary coefficient and the negative sample similarity index, the weighted negative sample similarity index of each negative sample pair is determined. The contrast loss function value for each batch of image blocks is determined based on the positive sample similarity index and the weighted negative sample similarity index.
5. The wafer defect detection method based on a self-supervised learning algorithm according to claim 1, characterized in that, The method for obtaining the attribution group includes: With the objective of minimizing the contrast loss function value, each image patch in the wafer sample is used as training data to train the encoder for feature encoding; the trained encoder is then used as a feature extractor. The feature extractor is used to obtain the sample feature vector of each image patch in the training data; the sample feature vectors are clustered to determine all candidate group assignments; The feature extractor is used to obtain the target feature vector of each target image block in the wafer under test; the group to which each target image block belongs is determined based on the similarity distance between the target feature vector and each candidate group.
6. The wafer defect detection method based on a self-supervised learning algorithm according to claim 5, characterized in that, The method for obtaining the defect image includes: Convolve each target image patch to determine the response direction of each pixel in each target image patch; determine the line direction of each target image patch based on the number of pixels in each response direction. The corresponding line length is determined based on the size of each target image block and its corresponding grain boundary density; Based on the line direction and the line length, a morphological opening operation is performed on the target image block to determine the opening operation image; based on the difference between each target image block and the corresponding opening operation image, a defect image of each target image block is determined.
7. The wafer defect detection method based on a self-supervised learning algorithm according to claim 1, characterized in that, The method for obtaining the original defect strength includes: Based on the overall gray-level normal distribution of pixels in the defect image, and combined with the grain boundary density of the target image block, the gray-level threshold is determined. Connectivity analysis is performed on pixels in the defect image whose grayscale values are greater than the grayscale threshold to determine all defect connected components; the original defect intensity of the target image block is determined based on the central tendency of grayscale values in all defect connected components.
8. The wafer defect detection method based on a self-supervised learning algorithm according to claim 6, characterized in that, The method for obtaining the final defect strength includes: Connectivity analysis is performed on the opening operation image of each target image block to determine all background connected components; the angle between the long side of the smallest bounding rectangle of the background connected component and the horizontal line is taken as the background connected component angle; the background angle deviation is determined according to the dispersion of all background connected component angles. Based on the image block corresponding to the group to which each target image block belongs, determine the connected component angle of each connected component within the image block; based on the dispersion and central tendency of all connected component angles, combined with the background angle deviation, determine the arrangement deviation of each target image block. The final defect strength is determined based on the arrangement deviation of each target image block and the original defect strength.
9. A wafer defect detection method based on a self-supervised learning algorithm according to claim 7, characterized in that, The method for obtaining the grayscale threshold includes: The base gray value is determined based on the central tendency of the gray values of all pixels in the defect image; the gray value offset is determined based on the dispersion of the gray values of all pixels in the defect image; and the weighted offset is determined based on the gray value offset and the grain boundary density. Based on the aforementioned base grayscale value, and combined with the weighted offset, the grayscale threshold is determined comprehensively.
10. A wafer defect detection system based on a self-supervised learning algorithm, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the wafer defect detection method based on a self-supervised learning algorithm as described in any one of claims 1 to 9.