A training method and system of a wafer defect detection model
By dividing the region and indexing the structure, target region samples and equivalent structure candidate samples are generated, an anchor grid correspondence table is constructed, and the coverage and aggregation of substitution blocking chains are calculated. This solves the problem of distinguishing between real defects and pseudo-anomalies in the wafer defect detection model and improves the model's ability to identify continuously distributed defects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 合肥孚烜自动化科技有限公司
- Filing Date
- 2026-04-10
- Publication Date
- 2026-07-03
AI Technical Summary
Existing wafer defect detection models struggle to effectively distinguish between real defects and pseudo-anomalies in regions with repetitive structures, and the correlation features between continuously distributed defect locations are difficult to incorporate into training supervision simultaneously, resulting in insufficient ability of the model to identify chain-like real defects.
By acquiring training image data, performing region segmentation and structure indexing processing, generating target region samples and equivalent structure candidate samples, constructing an anchor grid correspondence table, and calculating chain coverage, chain penetration and chain aggregation based on substitution blocking chains, generating blocking chain discrimination values, dividing real defects and pseudo-anomalies into training samples, constructing a blocking chain position supervision map, and finally training a wafer defect detection model.
This improved the accuracy of the wafer defect detection model in distinguishing between real defects and pseudo-anomalies, enhanced its ability to identify continuously distributed defects, and improved the consistency of training results.
Smart Images

Figure CN122335804A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence and machine learning technology, specifically to a training method and system for a wafer defect detection model. Background Technology
[0002] As the complexity of wafer manufacturing processes continues to increase, the amount of wafer image data that inspection equipment can acquire continues to grow. Training wafer defect detection models based on image data has become a common technical approach to improve defect identification efficiency and inspection consistency. Existing wafer defect detection models are usually based on extracting regional features from training image data and establishing defect discrimination relationships to identify and classify abnormal regions in wafer images, thereby providing data support for subsequent re-inspection, process analysis, and quality control. In the training process of wafer defect detection models, there are still problems such as the difficulty in effectively distinguishing between real defects and pseudo-anomalies caused by process disturbances in repetitive structural regions, and the difficulty in simultaneously incorporating the correlation features between continuously distributed defect locations into training supervision. Specifically, on the one hand, there are a large number of repetitive regions with the same or similar structural templates in wafer images. Affected by process fluctuations, local offsets, and imaging differences, some regions will exhibit pseudo-anomalies that are similar in appearance to real defects, resulting in a mixture of real defect samples and pseudo-anomaly samples in the training samples, which can easily lead to the formation of incorrect discrimination boundaries during model training. On the other hand, some real defects are not manifested as a single isolated anomaly point, but as a chain of anomalies formed by the continuous distribution of multiple local mismatch locations. Existing training methods usually cannot simultaneously express the connectivity, extension, and aggregation relationships between each mismatch location, resulting in insufficient ability of the model to identify chain-like real defects. Summary of the Invention
[0003] The purpose of this invention is to provide a training method and system for a wafer defect detection model, in order to solve the problems mentioned in the background art, such as the difficulty in effectively distinguishing between real defects and pseudo-anomalies caused by process disturbances in repetitive structural regions, and the difficulty in synchronously incorporating the correlation features between continuously distributed defect locations into the training supervision.
[0004] To achieve the above objectives, the technical solution of the present invention is: a training method for a wafer defect detection model, comprising: S1. Obtain training image data, perform region segmentation and structure indexing processing on the training image data, generate target region samples and retrieve equivalent structure candidate samples, and construct an anchor grid correspondence table based on the target region samples and equivalent structure candidate samples. Among them, the equivalent structure candidate sample is a region sample with the same structural template identifier as the target region sample but a different region source identifier; the anchor grid correspondence table is a correspondence table that records the positional correspondence between the target region sample and the equivalent structure candidate sample; S2. Based on the anchor grid correspondence table, the equivalent structure candidate samples are mapped to the target region samples to obtain the substitution results. The boundary misalignment, connection breakage and occupation conflict of the substitution results are calculated to obtain the blocking value. Substitution blocking edges are constructed, and substitution blocking chains are generated based on the adjacency and transmission relationships between the substitution blocking edges. Among them, the blocking value is the value that represents the degree of substitution mismatch at the corresponding position; the substitution blocking edge is the edge obtained by marking the corresponding position in the substitution result where the blocking value is greater than the preset blocking threshold; the substitution blocking chain is a chain structure obtained by aggregating the interconnected substitution blocking edges. S3. Calculate chain coverage, chain penetration and chain aggregation based on substitution blocking chains, generate blocking chain discrimination values, compare the blocking chain discrimination values with preset discrimination thresholds to generate sample category labels, and divide the target area samples into real defect training samples and pseudo-anomaly training samples according to the sample category labels. Construct a blocking chain position supervision map based on substitution blocking chains, and construct training sample groups based on real defect training samples, pseudo-anomaly training samples, blocking chain position supervision map and sample category labels. Among them, the sample category identifiers include real defect identifiers and pseudo-anomaly identifiers; the blocking chain position supervision map is a supervision map obtained by marking the position distribution of substitution blocking chains in the target area samples; S4. Input the training sample group into the wafer defect detection model, train the wafer defect detection model based on the sample category identifier and the blocking chain position supervision map, and update the model parameters.
[0005] Preferably, in step S1, the target region sample is a region sample formed by dividing the training image data into regions according to a preset region scale and then processing it with a structure index, and is used as the target input object for substitution verification; the equivalent structure candidate sample is a region sample determined based on the target region sample according to the retrieval rules of consistent structure template identifiers and different region source identifiers, and is used as a substitute reference object for the target region sample; the specific rule method for retrieving equivalent structure candidate samples is as follows: extract the structure template identifier and region source identifier for each region sample after region division, and determine the region sample with the same structure template identifier and different region source identifier as the target region sample as the equivalent structure candidate sample; the target region sample and the equivalent structure candidate sample maintain a consistent structure template relationship and a distinguishable region source relationship.
[0006] Preferably, in step S1, the anchor grid correspondence table is a correspondence table obtained by recording the pairing relationships of boundary positions, connection positions, and placeholder positions between the target region sample and the equivalent structure candidate sample. It is used to represent the substitution correspondence basis between the target region sample and the equivalent structure candidate sample. The data structure of the anchor grid correspondence table includes target position identifier, candidate position identifier, position type identifier, and position pairing relationship. The specific method for constructing the anchor grid correspondence table based on the target region sample and the equivalent structure candidate sample is as follows: extract the boundary positions, connection positions, and placeholder positions in the target region sample and the equivalent structure candidate sample respectively, establish position pairing relationships according to the principle of consistent position type, and write each position pairing relationship into the anchor grid correspondence table. Each position pairing relationship in the anchor grid correspondence table is used to limit the corresponding position constraints when the equivalent structure candidate sample is mapped to the target region sample.
[0007] Preferably, in S2, the substitution result is the positional correspondence state result formed after mapping the equivalent structure candidate sample to the target region sample according to the anchor correspondence table, which is used to characterize the substitution matching state between the equivalent structure candidate sample and the target region sample; the boundary misalignment amount is a value obtained by quantifying the degree of offset between the target region sample and the equivalent structure candidate sample at the boundary position; the connection break amount is a value obtained by quantifying the degree of continuity mismatch between the target region sample and the equivalent structure candidate sample at the connection position; the occupancy conflict amount is a value obtained by quantifying the degree of overlap mismatch between the target region sample and the equivalent structure candidate sample at the occupancy position; the blocking value is a substitution mismatch judgment value obtained by performing a summary processing on the boundary misalignment amount, connection break amount and occupancy conflict amount, which is used to characterize the overall mismatch degree of the substitution result at the corresponding position.
[0008] Preferably, in step S2, the substitution blocking edge is constructed based on the blocking value through threshold determination, and the data structure of the substitution blocking edge is a binary edge structure. The specific method for constructing the substitution blocking edge based on the blocking value through threshold determination is as follows: an edge-type marking relationship is established for the corresponding positions where the blocking value is greater than a preset blocking threshold to form a substitution blocking edge; the substitution blocking chain is constructed based on the substitution blocking edge through chain aggregation, and the data structure of the substitution blocking chain is a chain aggregation structure; wherein, the adjacency relationship between substitution blocking edges is that the corresponding positions of two substitution blocking edges satisfy the relationship of boundary adjacency, connection adjacency, or occupancy adjacency in the target area sample, and the transitive relationship is that multiple substitution blocking edges form an extended connection based on continuous adjacency; the set of adjacent substitution blocking edges is identified based on the adjacency relationship, and continuous aggregation is performed on the set of adjacent substitution blocking edges based on the transitive relationship to generate a substitution blocking chain.
[0009] Preferably, in step S3, the blocking chain discrimination value is a judgment value obtained by comprehensively characterizing the degree of blocking by the substitution blocking chain in the target area sample, and is used as the discrimination basis for generating sample category identifiers; the chain coverage, chain penetration, and chain aggregation are calculated based on the substitution blocking chain, specifically: the chain coverage is determined based on the coverage range of the substitution blocking chain in the target area sample, the chain penetration is determined based on the extension span of the substitution blocking chain in the target area sample, and the chain aggregation is determined based on the concentrated distribution of the substitution blocking edge in the substitution blocking chain; wherein, the chain coverage is the degree of blocking by the substitution blocking chain. The blocking chain is defined as the proportion of the coverage area of the blocking chain in the target area sample to the total range of the target area sample. The chain penetration is the proportion of the extension range of the substitution blocking chain in the target area sample to the total span of the target area sample in the corresponding direction. The chain aggregation is the degree of concentration of the substitution blocking edge in the substitution blocking chain. The specific method for generating the blocking chain discrimination value is as follows: the chain coverage, chain penetration, and chain aggregation are summarized, and the blocking chain discrimination value is determined based on the summary results. The blocking chain discrimination value corresponds to the coverage expansion state, extension penetration state, and concentration distribution state of the substitution blocking chain.
[0010] Preferably, in step S3, the sample category identifier is a category identifier obtained by marking the training category to which the target region sample belongs, including a true defect identifier bit and a pseudo-anomaly identifier bit; wherein, the true defect identifier bit is used to mark the target region sample as a true defect training sample based on the comparison result of the blocking chain discrimination value and the preset discrimination threshold, and the pseudo-anomaly identifier bit is used to mark the target region sample as a pseudo-anomaly training sample based on the comparison result of the blocking chain discrimination value and the preset discrimination threshold; the blocking chain position supervision map is a position supervision map obtained by marking the position distribution of the substitution blocking chain in the target region sample, and is used as the position supervision basis of the wafer defect detection model, and the data structure of the blocking chain position supervision map is a two-dimensional position marking structure; the specific method for constructing the blocking chain position supervision map based on the substitution blocking chain is as follows: extract the position distribution range of the substitution blocking chain in the target region sample, perform position marking on the position distribution range, and form the blocking chain position supervision map; the training sample group is a training data set obtained by associating the true defect training sample, the pseudo-anomaly training sample, the blocking chain position supervision map and the sample category identifier, and is used as the training input of the wafer defect detection model.
[0011] On the other hand, the present invention provides a training system for a wafer defect detection model, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described method for training a wafer defect detection model.
[0012] Compared with the prior art, the above-mentioned technical solution of the present invention has the following beneficial technical effects: 1. In this invention, based on the substitution mapping relationship between the target region sample and the equivalent structure candidate sample, substitution blocking edges and substitution blocking chains are constructed by combining the boundary misalignment amount, connection break amount and occupation conflict amount. This can distinguish between pseudo-anomalies and real defects formed by process fluctuations in the repeating structure region during the training stage, avoid the model learning anomaly features based only on local appearance differences, and improve the accuracy of the wafer defect detection model in distinguishing between real defects and pseudo-anomalies. 2. In this invention, the chain coverage, chain penetration and chain aggregation of the substitution blocking chain are calculated to generate the blocking chain discrimination value. Furthermore, a sample category identifier and a blocking chain position supervision map are constructed to simultaneously incorporate the connectivity, extension and aggregation relationships between multiple consecutive mismatch positions into the model training process. This enables the wafer defect detection model to learn the overall distribution characteristics of chain anomalies, improve the ability to identify continuously distributed defects and the consistency of training results. Attached Figure Description
[0013] Figure 1 This is a flowchart of one embodiment of the present invention. Detailed Implementation
[0014] Example 1, as Figure 1 As shown, the specific implementation steps of the training method for a wafer defect detection model proposed in this invention are as follows: S1. Obtain training image data, perform region segmentation and structure indexing processing on the training image data, generate target region samples and retrieve equivalent structure candidate samples, and construct an anchor grid correspondence table based on the target region samples and equivalent structure candidate samples. Among them, the equivalent structure candidate sample is a region sample with the same structural template identifier as the target region sample but a different region source identifier; the anchor grid correspondence table is a correspondence table that records the positional correspondence between the target region sample and the equivalent structure candidate sample; S2. Based on the anchor grid correspondence table, the equivalent structure candidate samples are mapped to the target region samples to obtain the substitution results. The boundary misalignment, connection breakage and occupation conflict of the substitution results are calculated to obtain the blocking value. Substitution blocking edges are constructed, and substitution blocking chains are generated based on the adjacency and transmission relationships between the substitution blocking edges. Among them, the blocking value is the value that represents the degree of substitution mismatch at the corresponding position; the substitution blocking edge is the edge obtained by marking the corresponding position in the substitution result where the blocking value is greater than the preset blocking threshold; the substitution blocking chain is a chain structure obtained by aggregating the interconnected substitution blocking edges. S3. Calculate chain coverage, chain penetration and chain aggregation based on substitution blocking chains, generate blocking chain discrimination values, compare the blocking chain discrimination values with preset discrimination thresholds to generate sample category labels, and divide the target area samples into real defect training samples and pseudo-anomaly training samples according to the sample category labels. Construct a blocking chain position supervision map based on substitution blocking chains, and construct training sample groups based on real defect training samples, pseudo-anomaly training samples, blocking chain position supervision map and sample category labels. Among them, the sample category identifiers include real defect identifiers and pseudo-anomaly identifiers; the blocking chain position supervision map is a supervision map obtained by marking the position distribution of substitution blocking chains in the target area samples; S4. Input the training sample group into the wafer defect detection model, train the wafer defect detection model based on the sample category identifier and the blocking chain position supervision map, and update the model parameters.
[0015] In this embodiment S1, the target region sample is a region sample formed by dividing the training image data into regions according to a preset region scale and then processing it with a structure index. It is used as the target input object for substitution verification. The equivalent structure candidate sample is a region sample determined based on the target region sample according to the retrieval rule that the structure template identifier is consistent and the region source identifier is different. It is used as the substitution reference object for the target region sample. The specific rule method for retrieving the equivalent structure candidate sample is as follows: extract the structure template identifier and the region source identifier of each region sample after region division, and determine the region sample with the same structure template identifier and different region source identifier as the target region sample as the equivalent structure candidate sample. The target region sample and the equivalent structure candidate sample maintain a consistent structure template relationship and a distinguishable region source relationship so that the target region sample and the equivalent structure candidate sample satisfy the subsequent substitution mapping conditions.
[0016] In this embodiment S1, the training image data can be a set of wafer images formed during the wafer inspection process. The wafer image set can be organized and stored according to batch, wafer number, or acquisition sequence. Before entering the region division, basic processing such as size unification, coordinate normalization, brightness normalization, and noise suppression can be performed to ensure that the region division scale, boundary extraction results, and index generation conditions are consistent among different wafer images. During region division, a single wafer image can be divided into grids according to a preset region scale, or a structured division can be performed according to the boundary of the repeated structure distribution in the image. After division, multiple local regions are formed, and each local region corresponds to a region sample. The region sample participating in the current training construction process is selected from the multiple region samples as the target region sample. The target region sample records the corresponding local image content, local location range, and region number information so that the structure indexing processing and candidate retrieval processing can be continued in the current embodiment.
[0017] In this embodiment S1, before the training image data enters the region segmentation, basic unification processing is performed. Basic unification processing includes image size unification, coordinate reference unification, grayscale range unification, and noise suppression processing. Size unification is achieved using a fixed resolution resampling method; coordinate reference unification is achieved using wafer image center alignment and region coordinate renumbering; grayscale range unification is achieved using grayscale linear normalization; and noise suppression processing is achieved using any of the following methods: median filtering, morphological opening / closing operations, or edge smoothing. After completing the basic unification processing, the training image data is region segmented based on a preset region scale. The scale is a parameter used to define the coverage of a single region sample. Specifically, it determines the width, height, and step size of the region sample. The preset region scale can be pre-set based on the average occupancy of repeating structural units in the wafer image, ensuring that a single region sample can completely cover a local structural unit or a combination of local structures. This guarantees that subsequent structural indexing, candidate sample retrieval, and anchor grid correspondence establishment are all performed at a uniform scale. Region division can be achieved using sliding window segmentation, regular grid segmentation, or segmentation based on structural boundaries. When using sliding window segmentation, the preset region scale is used as the window size. The image is traversed and cropped horizontally and vertically along a preset step size to form multiple local image blocks. When a regular grid segmentation method is used, the training image data is mapped to a unified grid coordinate system and segmented according to a preset row and column index to form region samples. When a structure boundary-based segmentation method is used, the local structural contours are first identified using contour extraction algorithms, connected component extraction algorithms, or edge tracking algorithms, and then the outer region of the contour is used as the segmentation boundary to form region samples. The region samples formed by different segmentation methods are all bound and recorded with region number, image number, and position coordinates, thereby generating a set of region samples that can participate in subsequent indexing and retrieval. The target region sample is the region sample to be verified selected from the region sample set after the structure indexing process. The target region sample can be generated by sequential selection, batch traversal, or selection according to preset marking rules. The equivalent structure candidate sample is obtained based on the target region sample through a two-stage retrieval method. The first stage performs consistency screening based on the structure template identifier, retaining the region sample with the same structure template identifier as the target region sample. The second stage performs source exclusion based on the region source identifier, eliminating the region sample with the same region source identifier as the target region sample, and retaining the remaining region sample as the equivalent structure candidate sample.The structural template consistency relationship refers to the relationship where the target region sample and the equivalent structure candidate sample maintain the same structural template identifier. The region source distinction relationship refers to the relationship where the target region sample and the equivalent structure candidate sample maintain different region source identifiers. Maintaining the structural template consistency relationship ensures that the two have a comparable local structural basis, while maintaining the region source distinction relationship avoids the substitution check degenerating into self-correspondence processing because the candidate sample and the target region sample come from the same region.
[0018] In this embodiment S1, region division can be achieved using a sliding window segmentation method, a regular grid segmentation method, or a segmentation method based on structural boundaries. When using the sliding window segmentation method, a preset region scale is used as the window size, and a preset step size is used to traverse and extract images along the horizontal and vertical directions of the wafer image to form multiple local region image blocks. When using the regular grid segmentation method, the training image data is mapped to a unified grid coordinate system, and region samples are formed by segmentation according to a preset row and column index. When using the segmentation method based on structural boundaries, the local structural contours are first identified using a contour extraction algorithm, a connected component extraction algorithm, or an edge tracking algorithm, and then the region circumscribed by the contour is used as the segmentation boundary to form region samples. The region samples formed by different segmentation methods are all bound and recorded with region number, image number, and position coordinates, thereby generating a set of region samples that can participate in subsequent indexing and retrieval.
[0019] In this embodiment S1, the structure indexing process is a process of extracting index information that can characterize the local structure type and source attribute of the region sample. The structure indexing process forms at least a structure template identifier and a region source identifier. The structure template identifier is used to indicate the structure template category to which the region sample belongs, and the region source identifier is used to indicate the source position or source image of the region sample in the wafer image set. The structure template identifier can be generated based on the boundary contour distribution, connection pattern distribution and occupancy pattern distribution in the region sample, and the region source identifier can be generated based on the wafer number, image number, coordinate partition number or region sequence number. After the target region sample is formed, the structure template identifier of the target region sample is read first, and then the region samples with the same structure template identifier and different region source identifiers are retrieved in the region sample set corresponding to the current training image data. The region samples that meet the dual conditions are determined as equivalent structure candidate samples. After this processing, a correspondence is formed between the target region sample and the equivalent structure candidate samples with the same structure template but different source regions.
[0020] In this embodiment S1, the retrieval range of equivalent structure candidate samples can be set to the remaining region samples in the same wafer image, or it can be set to all region samples in multiple wafer images. During the retrieval, a first round of screening is performed according to the structure template identifier, and a second round of screening is performed according to the region source identifier. Region samples with the same structure template as the target region sample are excluded from the region samples with the same source, and the remaining region samples are retained as equivalent structure candidate samples. When the retrieval result is a candidate sample, the candidate sample is directly written into the candidate sample record corresponding to the current target region sample. When the retrieval result is multiple candidate samples, all of them can be retained to form a candidate sample list, or some candidate samples can be selected according to a preset number rule to form a candidate sample sequence. In this embodiment, the target region sample and the equivalent structure candidate sample maintain a unified structure template identifier format and region source identifier format to ensure that the candidate retrieval result has a definite boundary in the current step and can completely express the correspondence between the target region sample and the equivalent structure candidate sample.
[0021] In this embodiment S1, the retrieval of equivalent structure candidate samples can be performed within the same wafer image or across multiple training images. When the retrieval range covers multiple training images, candidate index buckets are first established according to the structure template identifier, and then the corresponding index buckets are accessed according to the structure template identifier of the target region sample. Region samples whose region source identifier is consistent with the target region sample are removed from the index buckets to form an equivalent structure candidate sample set. When multiple equivalent structure candidate samples are formed, they can all be retained to form a candidate sample sequence, or they can be filtered according to the position integrity, boundary clarity, and connection integrity based on a preset upper limit to form a candidate sample sequence. Each equivalent structure candidate sample in the candidate sample sequence maintains a structure template consistency relationship and a region source distinction relationship with the target region sample, and establishes a one-to-one corresponding candidate retrieval record with the target region sample so that the anchor correspondence table construction can be continued in the future.
[0022] In this embodiment S1, the anchor grid correspondence table is a correspondence table obtained by recording the pairing relationship between the boundary positions, connection positions, and placeholder positions between the target region sample and the equivalent structure candidate sample. It is used to represent the substitution correspondence basis between the target region sample and the equivalent structure candidate sample. The data structure of the anchor grid correspondence table includes target position identifier, candidate position identifier, position type identifier, and position pairing relationship. The specific method for constructing the anchor grid correspondence table based on the target region sample and the equivalent structure candidate sample is as follows: extract the boundary positions, connection positions, and placeholder positions in the target region sample and the equivalent structure candidate sample respectively, establish position pairing relationships according to the principle of consistent position type, and write each position pairing relationship into the anchor grid correspondence table. Each position pairing relationship in the anchor grid correspondence table is used to limit the corresponding position constraints when the equivalent structure candidate sample is mapped to the target region sample.
[0023] In this embodiment S1, the anchor grid correspondence table is a correspondence table formed for the positional pairing relationship between the target region sample and the equivalent structure candidate sample. This correspondence table is not a general index record, but a structured record result formed after performing classification extraction, similar pairing, and table entry writing on the boundary positions, connection positions, and occupancy positions that can participate in the positional correspondence in the two types of samples. The boundary position is used to characterize the key position point or key position segment of the contour boundary in the local area, the connection position is used to characterize the intersection position of the structural connection relationship in the local area, and the occupancy position is used to characterize the spatial occupancy position of the graphic unit or target shape in the local area. Each correspondence record in the anchor grid correspondence table is used to describe the pairing relationship between a position in the target region sample and a corresponding position in the equivalent structure candidate sample, so that the target region sample and the equivalent structure candidate sample form a recordable and verifiable relationship in the current step. The anchor grid correspondence table is a table that records the positional pairing relationships between the target region sample and the equivalent structure candidate sample that can be used for substitution mapping. The construction of the anchor grid correspondence table does not adopt the overall image direct alignment method, but first identifies the boundary positions, connection positions and occupancy positions in the target region sample and the equivalent structure candidate sample, and then forms anchor grid record items based on the pairing of similar positions. The boundary position refers to the position where the contour boundary in the region sample changes direction, the connection relationship changes or the edge terminates. The connection position refers to the point where two or more structural boundaries in the region sample connect, intersect or break. The occupancy position refers to the position where the graphic unit or local structure occupies the center or the boundary of the region sample. Using these three types of positions as the basis for anchor grid construction, the subsequent substitution mapping can simultaneously constrain the boundary shape, connection relationship and occupancy state.
[0024] In this embodiment S1, the anchor grid correspondence table is a correspondence table formed for the positional pairing relationship between the target region sample and the equivalent structure candidate sample. This correspondence table is not a general index record, but a structured record result formed after performing classification extraction, similar pairing, and table entry writing on the boundary positions, connection positions, and occupancy positions that can participate in positional correspondence in the two types of samples. The boundary position is used to characterize the key position point or key position segment of the contour boundary in the local area, the connection position is used to characterize the intersection position of the structural connection relationship in the local area, and the occupancy position is used to characterize the spatial occupancy position of the graphic unit or target shape in the local area. Each correspondence record in the anchor grid correspondence table is used to describe the pairing relationship between a position in the target region sample and a corresponding position in the equivalent structure candidate sample, so that the target region sample and the equivalent structure candidate sample form a recordable pair in the current step. The anchor grid correspondence table provides a searchable and callable location correspondence structure. The location pairings in the anchor grid correspondence table can be constructed using either an item-by-item writing method or a batch writing method based on location sets. Regardless of the writing method, the same type of location pairing between the target region sample and the equivalent structure candidate sample remains unchanged. After the anchor grid correspondence table is established, each boundary position, each connection position, and each placeholder position in the target region sample has a corresponding pairing position in the equivalent structure candidate sample, thus forming a corresponding record chain between the current position and the candidate position. In this embodiment, the anchor grid correspondence table serves as a fixed record of location correspondences, ensuring that the boundary position correspondences, connection position correspondences, and placeholder position correspondences between the target region sample and the equivalent structure candidate sample are all determined in the form of table entries, and maintaining a one-to-one association between the location pairings and the sample number.
[0025] In this embodiment S1, the extraction of boundary positions can be achieved using contour tracking algorithms, corner detection algorithms, or edge inflection point extraction algorithms. The extraction of connection positions can be achieved using skeleton extraction algorithms, intersection point detection algorithms, or endpoint recognition algorithms. The extraction of occupant positions can be achieved using connected region center extraction algorithms, region bounding box center extraction algorithms, or centroid extraction algorithms. After the position extraction is completed, the boundary positions, connection positions, and occupant positions in the target region sample and the equivalent structure candidate sample are classified and encoded to form a set of boundary positions, a set of connection positions, and a set of occupant positions. The principle of consistent position type means that boundary positions are only paired with other boundary positions, connection positions are only paired with other connection positions, and occupant positions are only paired with other occupant positions. This principle ensures that different types of position constraints do not intersect, thereby maintaining clear position-corresponding boundaries in the subsequent mapping process. The data structure of the anchor grid correspondence table includes target location identifiers, candidate location identifiers, location type identifiers, and location pairing relationships. The target location identifier is used to mark a specific location object in the target region sample; the candidate location identifier is used to mark a specific location object in the equivalent structure candidate sample; the location type identifier is used to mark whether the location object belongs to a boundary location, a connecting location, or a placeholder location; and the location pairing relationship is used to record the pairing correspondence between the target location identifier and the candidate location identifier. The target location identifier can be generated by combining the target region sample number and the location sequence number; the candidate location identifier can be generated by combining the candidate sample number and the location sequence number; the location type identifier can be generated using type encoding or type enumeration; and the location pairing relationship can be generated using a one-to-one pairing record method. This ensures that each record in the anchor grid correspondence table clearly represents the correspondence between a target location and a candidate location.
[0026] In this embodiment S1, when constructing the anchor grid correspondence table based on the target region sample and the equivalent structure candidate sample, the position sets of the same type of positions in the two types of samples are first aligned, and then position pairing relationships are established according to position order, position proximity, or position number consistency. After the boundary position set, connection position set, and occupancy position set form pairing results, each type of pairing result is written into the anchor grid correspondence table to form a complete anchor grid correspondence relationship. The boundary position pairing relationship between the target region sample and the equivalent structure candidate sample is used to limit the boundary contour mapping position, the connection position pairing relationship is used to limit the connection state mapping position, and the occupancy position pairing relationship is used to limit the spatial occupancy mapping position. After the anchor grid correspondence table is established, the corresponding position constraints when the equivalent structure candidate sample is mapped to the target region sample are given by the position pairing relationships in the anchor grid correspondence table. The corresponding position constraints include that the boundary position is only mapped to the corresponding boundary position, the connection position is only mapped to the corresponding connection position, and the occupancy position is only mapped to the corresponding occupancy position. The location is determined while maintaining the established pairing relationship between the target location identifier and the candidate location identifier. The basis for mapping the equivalent structure candidate sample to the target region sample is the corresponding position constraint recorded in the anchor grid correspondence table. The mapping process can be implemented by coordinate alignment based on the position pairing relationship or by local geometric transformation based on the position pairing relationship. When using the coordinate alignment method, a coordinate alignment relationship is established based on the target location identifier and the candidate location identifier, and the structure where the candidate location is located is shifted to the coordinate region where the target location is located. When using the local geometric transformation method, the local transformation parameters are determined based on multiple position pairing relationships, and the corresponding structure in the equivalent structure candidate sample is mapped to the target region sample. Regardless of the mapping method used, the location type identifier and position pairing relationship in the anchor grid correspondence table are maintained as constraints, so that the mapping process does not deviate from the established correspondence relationship of the boundary position, connection position and occupancy position, thereby forming the basic position correspondence conditions required for the subsequent substitution result generation.
[0027] In this embodiment S2, the substitution result is the positional correspondence state result formed after mapping the equivalent structure candidate sample to the target region sample according to the anchor correspondence table, which is used to characterize the substitution matching state between the equivalent structure candidate sample and the target region sample; the boundary misalignment amount is a value obtained by quantifying the degree of offset between the target region sample and the equivalent structure candidate sample at the boundary position; the connection break amount is a value obtained by quantifying the degree of continuity mismatch between the target region sample and the equivalent structure candidate sample at the connection position; the occupancy conflict amount is a value obtained by quantifying the degree of overlap mismatch between the target region sample and the equivalent structure candidate sample at the occupancy position; the blocking value is a substitution mismatch judgment value obtained by performing a summary processing on the boundary misalignment amount, the connection break amount and the occupancy conflict amount, which is used to characterize the overall mismatch degree of the substitution result at the corresponding position; the boundary misalignment amount, the connection break amount and the occupancy conflict amount together serve as the basis for generating the blocking value.
[0028] In this embodiment S2, after the anchor grid correspondence table is established, the equivalent structure candidate samples are mapped to the target region sample according to the position pairing relationship recorded in the anchor grid correspondence table, forming a substitution result. The substitution result is not a simple image overlay result, but a positional correspondence state result formed by the equivalent structure candidate samples at the corresponding positions in the target region sample. This positional correspondence state result retains the alignment information of the boundary position, connection position, and occupancy position. The mapping process can be implemented using a coordinate alignment method based on position pairing relationship, a local rigid transformation method, or a local affine transformation method. When using the coordinate alignment method, a position coordinate mapping relationship is established based on the target position identifier and the candidate position identifier, and the candidate structure translation is performed. When using the local rigid transformation method, the rotation and translation parameters are determined based on multiple position pairing relationships in the same anchor grid correspondence table. When using the local affine transformation method, the local deformation parameters are determined based on multiple position pairing relationships. After the mapping is completed, the candidate boundaries, candidate connections, and candidate occupancy in the equivalent structure candidate samples fall into the corresponding position regions in the target region sample, thereby... The substitution results are generated and can be used for subsequent mismatch calculations. Boundary misalignment, connection breakage, and occupational conflict are structural quantities obtained by quantifying different types of positional mismatch states in the substitution results. Among them, the boundary misalignment is used to characterize the degree of offset between the target region sample and the equivalent structure candidate sample at the boundary position. This degree of offset can be calculated based on the distance difference, contour deviation difference, and edge coincidence difference between the target boundary and the candidate boundary. The connection breakage is used to characterize the degree of disconnection between the target region sample and the equivalent structure candidate sample at the connection position. This degree of disconnection can be calculated based on the distance of the connection endpoints, the length of the interruption of the continuous connection segment, and the number of gaps in the connection relationship. The occupational conflict is used to characterize the degree of overlap and conflict between the target region sample and the equivalent structure candidate sample at the occupation position. This degree of conflict can be calculated based on the offset of the occupation center, the overlap ratio of the occupation area, and the intrusion range of the occupation boundary. The boundary misalignment, connection breakage, and occupational conflict correspond to boundary mismatch, connection mismatch, and occupational mismatch respectively under the same positional pairing relationship, and together constitute the basic input for the subsequent blocking value generation.
[0029] In this embodiment S2, the calculation of boundary misalignment is based on the boundary position pairing relationship in the anchor grid correspondence table. For each pairing relationship, the contour direction, edge landing point, and boundary extension range of the target boundary position and candidate boundary position are extracted, and position offset calculation and contour difference calculation are performed to obtain the boundary misalignment. The calculation of connection breakage is based on the connection position pairing relationship in the anchor grid correspondence table. For each pairing relationship, the connection endpoint, connection segment length, and connection continuity state of the target connection position and candidate connection position are extracted, and the degree of breakage calculation and continuity deviation calculation are performed to obtain the connection breakage. The calculation of occupancy conflict is based on the occupancy position pairing relationship in the anchor grid correspondence table. For each pairing relationship, the occupancy center, occupancy range, and occupancy edge of the target occupancy position and candidate occupancy position are extracted, and the degree of overlap calculation and intrusion range calculation are performed to obtain the occupancy conflict. The calculation of the three quantities maintains the correspondence between the same target position identifier and the same candidate position identifier, thereby ensuring that the boundary mismatch, connection mismatch, and occupancy mismatch maintain an alignable calculation basis under the same substitution result position.
[0030] In this embodiment S2, the blocking value is a substitution mismatch degree value obtained by summarizing the boundary misalignment, connection breakage, and occupation conflict. It is used to characterize the overall mismatch intensity of the substitution result at the corresponding position. The summarization can be implemented by weighted summation, hierarchical cumulative value generation, or rule mapping value generation. When using the weighted summation method, preset weights are configured for the boundary misalignment, connection breakage, and occupation conflict, and a comprehensive value is calculated. When using the hierarchical cumulative value generation method, the three types of quantities are mapped to mismatch levels and then hierarchical accumulation is performed. When using the rule mapping value generation method, the corresponding position is mapped to the blocking value interval according to the combination state of the three types of quantities. The blocking value is different from a single mismatch. The blocking value is used to reflect the comprehensive mismatch state of the same position at the boundary, connection, and occupation levels. Therefore, once the blocking value is determined, it can be used as the overall mismatch intensity of the substitution result at the corresponding position. A unified criterion for determining whether a location falls within the blocking range; the calculation of the blocking value can be performed line by line according to the location pairing records in the anchor grid correspondence table, with each location pairing record forming a blocking value at the corresponding location; when multiple adjacent locations in the target region sample simultaneously have high boundary misalignment, high connection breakage, or high occupation conflict, the blocking values at the corresponding locations will exhibit a continuous spatial distribution; the recording method for blocking values can adopt a location number association method, that is, storing the blocking value at each location in a one-to-one correspondence with the target location identifier and the candidate location identifier, so that the subsequent blocking edge construction stage can directly locate the corresponding location based on the comparison result between the blocking value and the preset blocking threshold; through the above processing, the local mismatch state in the substitution result no longer remains at the level of a single image difference, but is uniformly converted into a numerical substitution mismatch representation result that can be used for subsequent blocking edge generation.
[0031] In this embodiment S2, the substitution blocking edge is constructed based on the blocking value through threshold determination, and the data structure of the substitution blocking edge is a binary edge structure. The specific method for constructing the substitution blocking edge based on the blocking value through threshold determination is as follows: an edge-type marking relationship is established for the corresponding positions where the blocking value is greater than the preset blocking threshold to form a substitution blocking edge; the substitution blocking chain is constructed based on the substitution blocking edge through chain aggregation, and the data structure of the substitution blocking chain is a chain aggregation structure; wherein, the adjacency relationship between the substitution blocking edges is that the corresponding positions of two substitution blocking edges satisfy the relationship of boundary adjacency, connection adjacency, or occupancy adjacency in the target area sample, and the transitive relationship is that multiple substitution blocking edges form an extended connection based on continuous adjacency; the set of adjacent substitution blocking edges is identified based on the adjacency relationship, and continuous aggregation is performed on the set of adjacent substitution blocking edges based on the transitive relationship to generate the substitution blocking chain.
[0032] In this embodiment S2, the substitution blocking edge is constructed based on the comparison result between the blocking value and the preset blocking threshold. The substitution blocking edge corresponds to the blocking relationship record formed by one or more adjacent positions in the target region sample after substitution. When the blocking value at a certain position is greater than the preset blocking threshold, the position is marked as a blocking position, and a side-based marking relationship is established between the blocking position and its corresponding candidate position, thereby forming the substitution blocking edge. The data structure of the substitution blocking edge adopts a side-based relationship recording method. This side-based relationship recording method is not a normal image pixel marking, but a structured expression of the blocking relationship between a target position and a candidate position, which can simultaneously maintain the position correspondence and the blocking judgment result. After the substitution blocking edge is constructed, each edge can clearly indicate that a corresponding position has reached the blocking state after substitution mapping, thereby providing a basis for subsequent blocking edge aggregation. The generation of combined blocking chains provides basic record units. When constructing substitute blocking edges, the system first traverses each position pairing record in the anchor grid correspondence table, reads the blocking value corresponding to the position pairing record, and then compares the blocking value with the preset blocking threshold. If the blocking value is greater than the preset blocking threshold, the relationship between the current target position and the current candidate position is written with a blocking marker, and a substitute blocking edge is formed. If the blocking value does not reach the preset blocking threshold, the current position does not enter the blocking edge set. The preset blocking threshold can be a globally unified threshold or a classification threshold set according to the position type. The boundary position, connection position, and occupancy position can correspond to different threshold ranges to ensure that the blocking edge construction process of different types of positions is consistent with their mismatch sensitivity. After this processing, the blocking positions in the target area sample are converted into a set of substitute blocking edges with edge relationships.
[0033] In this embodiment S2, the substitution blocking chain is constructed based on the substitution blocking edges through chain aggregation. The substitution blocking chain is used to characterize the continuous connection state between multiple blocking positions in space and relation. The data structure of the substitution blocking chain adopts a chain relation recording method, which is an ordered relation structure formed by continuously connecting multiple substitution blocking edges according to adjacency and transitivity. Among them, the adjacency relationship refers to the relationship that the corresponding positions of two substitution blocking edges satisfy the boundary adjacency, connection adjacency, or occupational adjacency in the target area sample. Boundary adjacency means that the boundary positions corresponding to the two substitution blocking edges are continuously connected in the contour direction. Connection adjacency means that the connection positions corresponding to the two substitution blocking edges are adjacent at the beginning and end in the connection path. Occupational adjacency means that the occupational positions corresponding to the two substitution blocking edges are directly adjacent in the spatial occupation range. Through the adjacency relationship The identification of the substitution blocking edges can merge discrete blocking edges into the same continuous relation segment; the transitive relation refers to the relationship that multiple substitution blocking edges, although not necessarily directly adjacent to each other, can form a continuous connection path through intermediate blocking edges; the determination of the transitive relation can be achieved by edge-by-edge traversal connection method or by connectivity search method based on adjacency matrix. When there is a continuous connection path consisting of several intermediate blocking edges between one substitution blocking edge and another substitution blocking edge, it is determined that the two satisfy the transitive relation; in the chain aggregation process, an initial set of adjacent blocking edges is first formed according to the adjacency relation, and then each initial set of adjacent blocking edges is expanded and aggregated according to the transitive relation, so that blocking edges that are continuous in space and transitive in relation enter the same substitution blocking chain; this process enables the substitution blocking chain to reflect the continuous expansion state of multiple blocking positions from local adjacency to overall connectivity.
[0034] In this embodiment S2, the construction of the substitution blocking chain can be achieved by sequential connection, connected component expansion, or graph connected traversal. When using sequential connection, the substitution blocking edges are checked one by one according to the positional order in the target region sample. Blocking edges that satisfy the adjacency relationship or the transitive relationship through the intermediate edge are included in the same chain. When using connected component expansion, any substitution blocking edge is taken as the starting edge and expanded to all edges that satisfy the adjacency and transitive relationships until no new connectable edges appear, forming a complete substitution blocking chain. When using graph connected traversal, the substitution blocking edges are recorded as edge nodes, and the adjacency and transitive relationships are used as the connection basis to perform connected traversal, resulting in multiple chain relationship results. The substitution blocking chains formed under different construction methods all maintain the existence of barriers between blocking edges within the same chain. Under the constraint of continuity, the calculation of subsequent chain coverage, chain penetration, and chain aggregation is based on the real chain-like blocking structure. The substitution blocking edge and the substitution blocking chain maintain a progressive relationship. The substitution blocking edge is the recorded result of local blocking position, and the substitution blocking chain is the overall blocking relationship formed by the continuous aggregation of multiple local blocking positions. The substitution blocking edge is used to reflect whether a single corresponding position has entered the blocking state, and the substitution blocking chain is used to reflect whether multiple blocking positions form a continuous abnormal distribution. By constructing the substitution blocking edge first and then the substitution blocking chain, the discrete substitution mismatch positions in the target region sample are gradually transformed into a chain-like mismatch structure that can be used for subsequent discrimination calculation, so that the subsequent blocking chain discrimination value generation stage can perform discrimination processing based on both local blocking positions and the overall chain-like distribution relationship.
[0035] In this embodiment S3, the blocking chain discrimination value is a judgment value obtained by comprehensively characterizing the degree of blocking of the substitution blocking chain in the target area sample, and is used as the discrimination basis for generating sample category identifiers; the chain coverage, chain penetration, and chain aggregation are calculated based on the substitution blocking chain, specifically: the chain coverage is determined based on the coverage range of the substitution blocking chain in the target area sample, the chain penetration is determined based on the extension span of the substitution blocking chain in the target area sample, and the chain aggregation is determined based on the concentrated distribution of the substitution blocking edge in the substitution blocking chain; wherein, the chain coverage is the degree of blocking of the substitution blocking chain in the target area sample, the chain penetration is determined based on the extension span of the substitution blocking chain in the target area sample, and the chain aggregation is determined based on the degree of concentrated distribution of the substitution blocking edge in the substitution blocking chain; wherein, the chain coverage is the degree of blocking of the substitution blocking chain in the target area sample, the chain penetration is determined based on the extension span of the substitution blocking chain, the chain penetration is determined based on the degree of concentrated distribution of the substitution blocking edge in the substitution blocking chain, and the chain aggregation is determined based on the degree of concentrated distribution of the substitution blocking edge in the substitution blocking chain. The blocking chain is defined as the proportion of the coverage area of the blocking chain in the target area sample to the total range of the target area sample. The chain penetration is the proportion of the extension range of the substitution blocking chain in the target area sample to the total span of the target area sample in the corresponding direction. The chain aggregation is the degree of concentration of the substitution blocking edge in the substitution blocking chain. The specific method for generating the blocking chain discrimination value is as follows: the chain coverage, chain penetration, and chain aggregation are summarized, and the blocking chain discrimination value is determined based on the summary results. The blocking chain discrimination value corresponds to the coverage expansion state, extension penetration state, and concentration distribution state of the substitution blocking chain.
[0036] In this embodiment S3, after the substitution blocking chain is formed, chain feature extraction processing is performed on the distribution state of each substitution blocking chain in the target region sample. The chain feature extraction processing includes chain coverage extraction, chain penetration extraction, and chain aggregation extraction. The blocking chain discrimination value is a comprehensive judgment value formed based on the above three types of chain features. The chain coverage is used to characterize the effective coverage area occupied by the substitution blocking chain in the target region sample. The chain penetration is used to characterize the continuous extension degree of the substitution blocking chain along the main extension direction of the region. The chain aggregation degree is used to characterize the concentrated distribution degree of the substitution blocking edges constituting the substitution blocking chain in space. The blocking chain discrimination value is not a repeated expression of the mismatch result at a single location, but a comprehensive discrimination result formed for the overall distribution state of the entire substitution blocking chain. It is used to convert the local blocking relationship at discrete locations into an overall category discrimination basis for sample training.
[0037] In this embodiment S3, the chain penetration calculation is based on the extension path of the substitution blocking chain in the target region sample. First, the chain extension path is extracted according to the connection order of each substitution blocking edge in the chain. Then, the extension span is determined according to the start and end positions of the chain extension path. Subsequently, the extension span is compared with the region span of the target region sample in the same extension direction to form the chain penetration. The extraction of the extension path can be implemented by sequential traversal or by connected path search. When using sequential traversal, the path length is accumulated edge by edge according to the adjacency and transmission order between the substitution blocking edges. When using connected path search, the path length is accumulated starting from the chain head position. All reachable blocking edges are searched for paths, and the maximum continuous extension range is recorded. Chain penetration reflects the connectivity of the substitution blocking chain in the target region sample. When the length of the area traversed by the substitution blocking chain increases and forms a longer continuous distribution, the chain penetration increases accordingly. The calculation of chain clustering is based on the spatial density of the substitution blocking edges in the substitution blocking chain. First, the positional distribution of all substitution blocking edges constituting the substitution blocking chain in the target region sample is statistically analyzed. Then, the chain clustering is determined based on the distance between adjacent blocking edges, the local clustering range, and the number of concentrated segments. The calculation of chain clustering can be achieved using the neighbor distance statistical method or the connected segment density statistical method. When using the proximity distance statistical method, the interval distance between adjacent substitution blocking edges is calculated one by one, and the clustering degree is formed based on the interval distribution. When using the connected segment density statistical method, the regional density of substitution blocking edges is statistically analyzed, and high-density segments with concentrated blocking edge distribution are identified. Chain clustering reflects whether the blocking edges within the substitution blocking chain are concentrated in a finite area. When the blocking edges form a continuous and dense distribution within a small area, the chain clustering degree increases accordingly. The generation of the blocking chain discrimination value is performed by summarizing chain coverage, chain penetration, and chain clustering as inputs. The summarizing process can be implemented using a weighted accumulation method or a hierarchical mapping method. When using the weighted accumulation method, the values are respectively chain coverage, chain penetration, and chain clustering. Coverage, chain penetration, and chain aggregation are configured with preset weights to form a comprehensive value. When using a level mapping method, the three chain features are first mapped to their corresponding levels, and then the blocking chain discrimination value range is determined based on the level combination result. Once the blocking chain discrimination value is formed, it is compared with a preset discrimination threshold. If the blocking chain discrimination value reaches the discrimination threshold, the current target region sample is recorded in the real defect training sample category. If the blocking chain discrimination value does not reach the discrimination threshold, the current target region sample is recorded in the pseudo-anomaly training sample category. Through the above processing, the coverage expansion state, path penetration state, and local aggregation state of the substitute blocking chain are uniformly transformed into discrimination criteria that can be directly used to distinguish training categories.
[0038] In this embodiment S3, the preset discrimination threshold is a discrimination threshold parameter used to distinguish between real defect training sample categories and pseudo-anomaly training sample categories. The preset discrimination threshold can be predetermined based on the distribution results of the blocking chain discrimination values of historical labeled samples, or it can be predetermined based on the sample statistical results in the initial training stage and remain fixed in the current training stage. The preset discrimination threshold and the blocking chain discrimination value are set with the same units, so that the comparison result between the blocking chain discrimination value and the preset threshold can be directly used as the basis for generating sample category identifiers. When the blocking chain discrimination value reaches the preset discrimination threshold, the current target area sample corresponds to the real defect training sample category. When the blocking chain discrimination value does not reach the preset threshold, the current target area sample corresponds to the pseudo-anomaly training sample category, thereby giving the sample category identifier generation process a clear discrimination boundary.
[0039] In this embodiment S3, both real defect training samples and pseudo-anomaly training samples are formed by classifying target region samples according to sample category identifiers. Real defect training samples are target region samples marked as real defect category by sample category identifiers, and pseudo-anomaly training samples are target region samples marked as pseudo-anomaly category by sample category identifiers. Real defect training samples and pseudo-anomaly training samples do not correspond to a new image acquisition process or a new region division process. Instead, they are two training states formed by target region samples after completing the blocking chain discrimination. The same target region sample corresponds to only one training state in the same discrimination process and maintains a unique mapping relationship with the current sample category identifier. This creates a one-to-one category classification structure between target region samples, sample category identifiers, real defect training samples, and pseudo-anomaly training samples.
[0040] In this embodiment S3, the sample category identifier is a category identifier obtained by marking the training category to which the target region sample belongs, including a true defect identifier bit and a pseudo-anomaly identifier bit. The true defect identifier bit is used to mark the target region sample as a true defect training sample based on the comparison result of the blocking chain discrimination value and the preset discrimination threshold, while the pseudo-anomaly identifier bit is used to mark the target region sample as a pseudo-anomaly training sample based on the comparison result of the blocking chain discrimination value and the preset discrimination threshold. The blocking chain position supervision map is a position supervision map obtained by marking the position distribution of substitution blocking chains in the target region sample, and is used as a wafer defect detection model. The location supervision is based on a two-dimensional location marker structure for the blocking chain location supervision map. The specific method for constructing the blocking chain location supervision map based on the substitution blocking chain is as follows: extract the location distribution range of the substitution blocking chain in the target area sample, perform location marking on the location distribution range, and form the blocking chain location supervision map. The training sample group is a training data set obtained by associating real defect training samples, pseudo-anomaly training samples, blocking chain location supervision map, and sample category identifiers, which is used as the training input for the wafer defect detection model. Each training data in the training sample group maintains the correspondence between the sample category identifier and the blocking chain location supervision map.
[0041] In this embodiment S3, the sample category identifier is the category labeling result formed after comparing the blocking chain discrimination value with the preset discrimination threshold. The sample category identifier includes a true defect identifier bit and a pseudo-anomaly identifier bit. The true defect identifier bit is used to indicate that the current target region sample belongs to the true defect training sample category, and the pseudo-anomaly identifier bit is used to indicate that the current target region sample belongs to the pseudo-anomaly training sample category. The true defect identifier bit and the pseudo-anomaly identifier bit maintain a mutually exclusive correspondence on the same target region sample, that is, only one category labeling result is written to the current sample in the same discrimination process. After the sample category identifier is formed, a one-to-one correspondence is established with the target region sample, and it is written into the current sample record as the category supervision basis in the subsequent training sample group, so that the target region sample has a clear training category boundary before entering the model training. The blocking chain position supervision map is based on the substitution blocking chain in the target region sample. The graphical labeling results formed by the position distribution are used to characterize the spatial placement status of the substitution blocking chain within the target area sample and serve as the position supervision input for the wafer defect detection model. The data structure of the blocking chain position supervision map adopts a graphical labeling recording method. Under this method, each position in the target area sample is assigned a corresponding labeling status according to whether it belongs to the coverage area of the substitution blocking chain. When constructing the blocking chain position supervision map, all blocking positions corresponding to the substitution blocking chain are first extracted, and then a position distribution area is formed based on the blocking positions. After that, graphical labeling is performed on each position within the position distribution area to generate the blocking chain position supervision map. When the substitution blocking chain consists of multiple interconnected substitution blocking edges, the position distribution areas corresponding to each substitution blocking edge are uniformly labeled according to the same substitution blocking chain, so that the blocking chain position supervision map can completely reflect the distribution range of the entire substitution blocking chain in the target area sample.
[0042] In this embodiment S3, the construction of the blocking chain position supervision map can be achieved by either position-by-position marking or region-filling marking. When using position-by-position marking, a position mark is written point by point for each blocking position covered by the substitution blocking chain. When using region-filling marking, connected region filling is performed on the position distribution area corresponding to the substitution blocking chain to form a continuous marked region. Both methods maintain the original spatial distribution boundary of the substitution blocking chain and ensure that the non-blocking chain positions and blocking chain positions in the target region sample are distinguishable in the supervision map. Through this processing, the blocking chain position supervision map can not only reflect the location range of the substitution blocking chain, but also reflect the continuous distribution characteristics and local clustering characteristics of the blocking chain in the target region sample, thereby enabling subsequent model training to simultaneously receive category monitoring. The monitoring information includes both location monitoring information and location monitoring information. The location monitoring map of the substitutional blocking chain is formed using a location marking method. This location marking method is a graphical representation that records whether each location in the target area sample belongs to the coverage of the substitutional blocking chain. Each location in the location monitoring map of the substitutional blocking chain corresponds one-to-one with the area coordinates in the target area sample. Locations that belong to the coverage of the substitutional blocking chain are marked as blocking chains, and locations that do not belong to the coverage of the substitutional blocking chain are marked as non-blocking chains, thus forming a complete location marking map. When the substitutional blocking chain covers multiple interconnected location segments, the corresponding multiple location segments in the location monitoring map of the substitutional blocking chain are continuously marked, so that the location monitoring map of the substitutional blocking chain can fully reflect the location distribution range, continuous extension range, and local aggregation range of the substitutional blocking chain in the target area sample.
[0043] In this embodiment S3, the training sample group is a training data set formed by performing sample association processing based on target region samples after the sample category identifier and the blocking chain position supervision map are formed. The training sample group is not a single image object, but a training record result obtained by uniformly associating the target region samples, the correspondence between real defect training samples or pseudo-anomaly training samples, the blocking chain position supervision map, and the sample category identifier. Each training record in the training sample group is one-to-one with a target region sample, and the category supervision result and position supervision result corresponding to the target region sample are retained at the same time. When forming the training sample group, the target region sample is first associated with the sample category identifier, then the same target region sample is associated with the blocking chain position supervision map, and finally the category association result and the position supervision association result are written into the same training record, thereby forming a complete training sample group. Training sample sets are training data sets formed after sample category labels and blocking chain location supervision maps are created, based on target region samples, and then sample association processing is performed. A training sample set is not a single image object, but rather a training record result obtained by uniformly associating target region samples, real defect training samples or pseudo-anomaly training samples, blocking chain location supervision maps, and sample category labels. Each training record in a training sample set maintains a one-to-one correspondence with a target region sample, while simultaneously retaining the category supervision results and location supervision results corresponding to that target region sample. When forming a training sample set, first, a sample category association is established between the target region sample and the sample category label; then, a location supervision association is established between the same target region sample and the blocking chain location supervision map; finally, the category association results and location supervision association results are written into the same training record, thus forming a complete training sample set.
[0044] In this embodiment S3, the training sample group consists of multiple training records, each corresponding to a target region sample. Each training record includes at least a target region sample identifier, a sample category identifier, and a blocking chain position supervision map identifier, and is associated through a unified sample index. When constructing the training sample group, a sample index is first generated based on the target region samples. Then, the sample category identifier and blocking chain position supervision map corresponding to the same sample index are written into the same training record. Finally, all training records are combined according to the sample index order to form the training sample group. When the training sample group is input into the wafer defect detection model, the target region samples, sample category identifiers, and blocking chain position supervision maps in each training record maintain a synchronous calling relationship, ensuring that each target region sample has a unique corresponding category during training. Supervision information and location supervision information; the blocking chain discrimination value is preferably generated using a fixed aggregation path, specifically: first, chain coverage, chain penetration, and chain aggregation are calculated separately, and then the chain coverage, chain penetration, and chain aggregation are weighted and aggregated according to preset weights to generate the blocking chain discrimination value; under this preferred path, the chain coverage is used to reflect the coverage strength of the substitution blocking chain in the target region sample, the chain penetration is used to reflect the extension strength of the substitution blocking chain in the target region sample, and the chain aggregation is used to reflect the concentration strength of the substitution blocking edge in the substitution blocking chain. The three together form the basis of the blocking chain discrimination value; by adopting a fixed aggregation path, the generation process of the blocking chain discrimination value remains consistent across different training samples, thereby ensuring that the discrimination rules for sample category identification remain consistent in the current embodiment.
[0045] In this embodiment S4, the training sample group serves as the training input for the wafer defect detection model. Each training record is set to correspond one-to-one with a target region sample, and is simultaneously associated with the sample category identifier and the blocking chain position supervision map. Before training begins, the training sample group undergoes sample reading, sample index verification, and supervision information alignment processing to ensure that the target region sample, sample category identifier, and blocking chain position supervision map maintain a synchronous correspondence within the same training record. After sample reading, further processing such as size unification, channel organization, and numerical normalization can be performed to ensure that different training records maintain consistency in input scale and numerical range. During training input, multiple training records are sequentially or randomly extracted from the training sample group according to a preset batch size to form the current training batch, while maintaining the index relationship between each target region sample and its corresponding sample category identifier and blocking chain position supervision map within the same training batch. The wafer defect detection model employs supervised deep learning. The network implementation includes at least a shared feature extraction path, a category prediction path, and a location prediction path. The shared feature extraction path extracts regional structural features from the target region samples. The category prediction path outputs the prediction result that the target region sample belongs to the category of real defect training samples or pseudo-anomaly training samples. The location prediction path outputs the location prediction result corresponding to the blocking chain location supervision map. The shared feature extraction path can be implemented using convolutional feature extraction, residual feature extraction, or self-attention feature extraction. The category prediction path can be implemented using fully connected classification or region category mapping. The location prediction path can be implemented using position-by-position labeling prediction or region masking prediction. In the current embodiment, after the target region sample is input into the network, it first passes through the shared feature extraction path to obtain a feature representation, and then enters the category prediction path and the location prediction path respectively, thereby simultaneously forming the category prediction result and the location prediction result.
[0046] In this embodiment S4, the sample category identifier is used to perform supervisory constraints on the category prediction results, and the blocking chain position supervision map is used to perform position constraints on the position prediction results. The true defect identifier and the pseudo-anomaly identifier in the sample category identifier correspond to the two training categories of the target region sample, respectively. During the category prediction process, the model performs bias calculation on the predicted category of the current target region sample based on the sample category identifier. The blocking chain position supervision map maintains a one-to-one positional correspondence with the target region sample. During the position prediction process, the model performs bias calculation on the prediction results of each position in the current target region sample based on the blocking chain position supervision map. Through the simultaneous action of category supervision and position supervision, the model not only learns the category boundary of the target region sample, but also learns the distribution position of the substitution blocking chain in the target region sample, thereby enabling category training and position training to be completed synchronously in the same training process. Model parameter updates are implemented through forward calculation and backward update. In the forward computation phase, the target region samples from the current training batch are input into the wafer defect detection model to obtain the category prediction results and the location prediction results in sequence. Then, the category bias and location bias are calculated based on the sample category identifier and the blocking chain location supervision map, respectively. The category bias is used to characterize the consistency between the category prediction results and the sample category identifier, and the location bias is used to characterize the consistency between the location prediction results and the blocking chain location supervision map. In the backward update phase, the training error of the current training batch is constructed based on the category bias and location bias, and the training error is backpropagated along the network parameter direction to correct the model parameters in the shared feature extraction path, category prediction path, and location prediction path layer by layer. The model parameter update can be implemented by gradient descent update, adaptive gradient update, or gradient update with driving terms. In the current embodiment, it is preferred to use backpropagation combined with adaptive gradient update to complete the parameter correction.
[0047] In this embodiment S4, batch balancing control can be performed on the real defect training sample categories and pseudo-anomaly training sample categories during training to avoid the category prediction shift caused by the excessive proportion of a certain category in the training batch. Batch balancing control can be achieved by extracting training records according to a preset ratio after counting the number of categories in the current training sample group, or by resampling the categories with a smaller number. When the blocking chain coverage area in the blocking chain position supervision map corresponding to the target region sample is large, the position prediction path plays a strong position constraint role in the current training batch. When the blocking chain coverage area corresponding to the target region sample is small, the category prediction path and the position prediction path are still updated together to ensure that the model has a stable learning ability for both local chain anomalies and the overall category boundary. Throughout the training process, the order of organizing the training batches, the order of reading the sample category identifiers, and the order of calling the blocking chain position supervision map are all consistent with the training batch. The training record index remains consistent; the training of the wafer defect detection model can be performed in iterative rounds. In a single training round, multiple training batches are input sequentially and the corresponding parameters are updated. After multiple training rounds are completed, the model parameters are checked for convergence. The convergence check can be performed based on the changes in class bias, position bias, or comprehensive training error in consecutive training rounds. When the comprehensive training error in consecutive training rounds meets the preset stability condition, the current model parameter update process is stopped, and the trained wafer defect detection model is obtained. The trained wafer defect detection model saves all updated model parameters in the shared feature extraction path, class prediction path, and position prediction path, and maintains the ability to output class prediction results and position prediction results for input target area samples. The model parameters generated after training can be directly used as calling parameters in the subsequent wafer defect identification stage to complete the identification of real defects and chain anomaly locations.
[0048] In this embodiment S4, both category supervision and location supervision during the training process revolve around the fixed correspondence between the target region sample, the sample category identifier, and the blocking chain location supervision map. There is no cross-reference between category supervision information and location supervision information in any training record. For the same target region sample, the category prediction result always corresponds to the same set of real defect identifier bits and pseudo-anomaly identifier bits, and the location prediction result always corresponds to the same blocking chain location supervision map. This ensures that the model receives category supervision and location supervision synchronously based on the same sample in each parameter update. By maintaining the unique mapping relationship of training records within the training sample group, the model parameter update process can stably inherit the correspondence constraint relationship between the target region sample, the substitution blocking chain, the sample category identifier, and the blocking chain location supervision map formed in the previous steps. This enables the trained wafer defect detection model to have both category discrimination ability and chain location recognition ability.
[0049] Example 2: A training system for a wafer defect detection model proposed in this invention is applied to a training method for a wafer defect detection model proposed in Example 1. The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement the training method for a wafer defect detection model in Example 1.
[0050] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited thereto. Various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of the present invention.
Claims
1. A training method for a wafer defect detection model, characterized in that, Includes the following steps: S1. Obtain training image data, perform region segmentation and structure indexing processing on the training image data, generate target region samples and retrieve equivalent structure candidate samples, and construct an anchor grid correspondence table based on the target region samples and equivalent structure candidate samples. Among them, the equivalent structure candidate sample is a region sample with the same structural template identifier as the target region sample but a different region source identifier; the anchor grid correspondence table is a correspondence table that records the positional correspondence between the target region sample and the equivalent structure candidate sample; S2. Based on the anchor grid correspondence table, the equivalent structure candidate samples are mapped to the target region samples to obtain the substitution results. The boundary misalignment, connection breakage and occupation conflict of the substitution results are calculated to obtain the blocking value. Substitution blocking edges are constructed, and substitution blocking chains are generated based on the adjacency and transmission relationships between the substitution blocking edges. Among them, the blocking value is the value that represents the degree of substitution mismatch at the corresponding position; the substitution blocking edge is the edge obtained by marking the corresponding position in the substitution result where the blocking value is greater than the preset blocking threshold; the substitution blocking chain is a chain structure obtained by aggregating the interconnected substitution blocking edges. S3. Calculate chain coverage, chain penetration and chain aggregation based on substitution blocking chains, generate blocking chain discrimination values, compare the blocking chain discrimination values with preset discrimination thresholds to generate sample category labels, and divide the target area samples into real defect training samples and pseudo-anomaly training samples according to the sample category labels. Construct a blocking chain position supervision map based on substitution blocking chains, and construct training sample groups based on real defect training samples, pseudo-anomaly training samples, blocking chain position supervision map and sample category labels. Among them, the sample category identifiers include real defect identifiers and pseudo-anomaly identifiers; the blocking chain location supervision map is a supervision map obtained by marking the location distribution of substitution blocking chains in the target area samples; S4. Input the training sample group into the wafer defect detection model, train the wafer defect detection model based on the sample category identifier and the blocking chain position supervision map, and update the model parameters.
2. The training method for a wafer defect detection model according to claim 1, characterized in that: In S1, the target region sample is a region sample formed by dividing the training image data into regions according to a preset region scale and then processing it with a structure index, and is used as the target input object for substitution verification. Equivalent structure candidate samples are regional samples determined based on the target region samples according to the retrieval rules that the structural template identifiers are consistent but the regional source identifiers are different. They are used as substitute reference objects for the target region samples. The specific rule method for retrieving equivalent structure candidate samples is as follows: extract the structural template identifier and regional source identifier of each regional sample after the region is divided, and determine the regional samples with the same structural template identifier and different regional source identifiers as equivalent structure candidate samples. The target region samples and equivalent structure candidate samples maintain a consistent structural template relationship and a region source distinction relationship.
3. The training method for a wafer defect detection model according to claim 2, characterized in that: In S1, the anchor grid correspondence table is a correspondence table that records the pairing relationships between the boundary positions, connection positions, and occupant positions of the target region sample and the equivalent structure candidate sample. It is used to represent the substitution correspondence basis between the target region sample and the equivalent structure candidate sample. The data structure of the anchor grid correspondence table includes target position identifier, candidate position identifier, position type identifier, and position pairing relationship. The specific method for constructing the anchor grid correspondence table based on the target region sample and the equivalent structure candidate sample is as follows: extract the boundary positions, connection positions, and occupant positions from the target region sample and the equivalent structure candidate sample respectively, establish position pairing relationships according to the principle of consistent position type, and write each position pairing relationship into the anchor grid correspondence table. The pairing relationships between positions in the anchor grid correspondence table are used to limit the corresponding position constraints when the candidate sample of the equivalent structure is mapped to the target region sample.
4. The training method for a wafer defect detection model according to claim 3, characterized in that: In S2, the substitution result is the positional correspondence state result formed after mapping the equivalent structure candidate sample to the target region sample according to the anchor correspondence table, which is used to characterize the substitution matching state between the equivalent structure candidate sample and the target region sample; the boundary misalignment amount is a value obtained by quantifying the degree of offset between the target region sample and the equivalent structure candidate sample at the boundary position; the connection break amount is a value obtained by quantifying the degree of continuity mismatch between the target region sample and the equivalent structure candidate sample at the connection position; the occupancy conflict amount is a value obtained by quantifying the degree of overlap mismatch between the target region sample and the equivalent structure candidate sample at the occupancy position; the blocking value is a substitution mismatch judgment value obtained by performing a summary processing on the boundary misalignment amount, connection break amount and occupancy conflict amount, which is used to characterize the overall mismatch degree of the substitution result at the corresponding position.
5. The training method for a wafer defect detection model according to claim 4, characterized in that: In step S2, the substitution blocking edge is constructed based on the blocking value through threshold determination, and the data structure of the substitution blocking edge is a binary edge structure. The specific method for constructing the substitution blocking edge based on the blocking value through threshold determination is to establish an edge-type marking relationship for the corresponding position where the blocking value is greater than the preset blocking threshold, thereby forming a substitution blocking edge. The substitution blocking chain is constructed based on the substitution blocking edge through chain aggregation, and the data structure of the substitution blocking chain is a chain aggregation structure. Among them, the adjacency relationship between substitution blocking edges is that the corresponding positions of two substitution blocking edges satisfy the relationship of boundary adjacency, connection adjacency, or occupancy adjacency in the target area sample. The transitive relationship is that multiple substitution blocking edges form an extended connection based on continuous adjacency. The set of adjacent substitution blocking edges is identified based on the adjacency relationship, and continuous aggregation is performed on the set of adjacent substitution blocking edges based on the transitive relationship to generate the substitution blocking chain.
6. The training method for a wafer defect detection model according to claim 5, characterized in that: In step S3, the blocking chain discrimination value is a judgment value obtained by comprehensively characterizing the degree of blocking by the substitution blocking chain in the target area sample, and is used as the basis for generating sample category identifiers; the chain coverage, chain penetration, and chain aggregation are calculated based on the substitution blocking chain, specifically: the chain coverage is determined based on the coverage range of the substitution blocking chain in the target area sample, the chain penetration is determined based on the extension span of the substitution blocking chain in the target area sample, and the chain aggregation is determined based on the degree of concentrated distribution of the substitution blocking edges in the substitution blocking chain; wherein, the chain coverage is the degree of blocking by the substitution blocking chain. The chain coverage is the proportion of the target region sample's coverage to the total range of the target region sample. The chain penetration is the proportion of the extension range of the substitution blocking chain in the target region sample to the total span of the target region sample in the corresponding direction. The chain aggregation is the degree of concentration of the substitution blocking edge in the substitution blocking chain. The specific method for generating the blocking chain discrimination value is as follows: the chain coverage, chain penetration, and chain aggregation are summarized, and the blocking chain discrimination value is determined based on the summary results. The blocking chain discrimination value corresponds to the coverage expansion state, extension penetration state, and concentration distribution state of the substitution blocking chain.
7. The training method for a wafer defect detection model according to claim 6, characterized in that: In S3, the sample category identifier is a category identifier obtained by marking the training category to which the target region sample belongs, including a true defect identifier bit and a pseudo-anomaly identifier bit. The true defect identifier bit is used to mark the target region sample as a true defect training sample based on the comparison result of the blocking chain discrimination value and the preset discrimination threshold, while the pseudo-anomaly identifier bit is used to mark the target region sample as a pseudo-anomaly training sample based on the comparison result of the blocking chain discrimination value and the preset discrimination threshold. The blocking chain position supervision map is a position supervision map obtained by marking the position distribution of the substitution blocking chain in the target region sample, used as the position supervision basis for the wafer defect detection model. The data structure of the blocking chain position supervision map is a two-dimensional position marking structure. The specific method for constructing the blocking chain position supervision map based on the substitution blocking chain is as follows: extract the position distribution range of the substitution blocking chain in the target region sample, perform position marking on the position distribution range, and form the blocking chain position supervision map. The training sample group is a training data set obtained by associating the true defect training samples, pseudo-anomaly training samples, blocking chain position supervision map, and sample category identifier, used as the training input for the wafer defect detection model.
8. A training system for a wafer defect detection model, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor executes a computer program to implement the training method for the wafer defect detection model as described in any one of claims 1-7.