A wafer defect detection method based on the vision transformer model
By employing a wafer defect detection method based on the Vision Transformer model, and utilizing the absolute difference method and the improved multi-head self-attention mechanism p-MHA, the false detection and false negative detection problems in existing wafer defect detection technologies are solved, thereby improving detection accuracy and reliability.
Patent Information
- Application Number
- CN202411970942.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-12-30
AI Technical Summary
Existing wafer defect detection methods are prone to false positives and false negatives when faced with complex and diverse defect morphologies, and convolutional neural networks have difficulty fully capturing complex defect features in high-resolution, large-size wafer image detection.
A wafer defect detection method based on the Vision Transformer model is adopted. By acquiring top views from both normal and defective perspectives, the absolute difference method is used to locate the defect. Furthermore, an L-ViT structure and an improved multi-head self-attention mechanism p-MHA are constructed to enhance defect feature extraction and model accuracy.
This improved the accuracy and reliability of wafer defect detection, reduced the false negative and false positive rates, provided a more solid data foundation, and laid the groundwork for subsequent defect analysis and processing.
Smart Images

Figure CN119991571B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of semiconductor manufacturing and computer vision technology, and in particular relates to a wafer defect detection method based on the visiontransformer model. Background Technology
[0002] In semiconductor manufacturing, the wafer serves as the fundamental carrier for integrated circuit (IC) production, and its quality and integrity are crucial to the performance and stability of subsequent devices. Due to the complexity of wafer manufacturing and its susceptibility to external environmental influences, wafer surfaces are prone to various defects such as cracks, scratches, and contamination. These defects can cause circuit failures or performance degradation in subsequent processes; therefore, detecting and identifying surface defects during wafer manufacturing and processing is essential. However, with the increase in wafer size and the diversification of defect types, wafer defect detection is facing higher precision requirements and more complex challenges.
[0003] Traditional wafer defect detection methods largely rely on image processing and manual feature extraction algorithms. These methods typically depend on extensive experience and hand-designed features, making them prone to false positives and false negatives when dealing with complex and diverse defect morphologies. In recent years, the rapid development of deep learning in computer vision has brought new opportunities to wafer defect detection. Convolutional Neural Networks (CNNs), in particular, have shown excellent performance in image classification and object detection and are increasingly being applied to wafer defect detection tasks. However, CNNs have limitations in handling global dependencies and subtle features in images, especially in the detection of high-resolution, large-size wafer images, where they struggle to fully capture complex defect features.
[0004] The Vision Transformer (ViT) model is an emerging deep learning model, initially developed from the Transformer model in natural language processing. It utilizes a self-attention mechanism to effectively model the global features of an image. The ViT model divides the input image into a series of patches and captures the relationships between these patches through self-attention, thereby learning deep information about the image on a global scale. This characteristic makes ViT particularly suitable for high-resolution, complex image processing tasks, and it exhibits higher accuracy and flexibility in handling irregular and subtle defect features. Therefore, applying the ViT model to wafer defect detection can improve the model's detection accuracy and reduce the false negative and false positive rates.
[0005] The present invention not only makes up for the shortcomings of the prior art, but also provides an effective solution for quality control in the semiconductor manufacturing process. Summary of the Invention
[0006] The purpose of this invention is to overcome the aforementioned deficiencies in the prior art and provide a wafer defect detection method based on the Vision Transformer model. This method acquires top views of the wafer from both normal and defective perspectives and uses the absolute difference method to locate the defect. Upsampling of the located region amplifies the defect features, facilitating model learning. The proposed L-ViT structure transforms the absolute difference data into a vector sequence, which is combined with the defective perspective vector sequence to highlight defect features. The newly proposed p-MHA multi-head self-attention mechanism adds a correlation formula between Q and V to enhance the connection between the absolute difference sequence and the defect sequence, while reducing data volume and model complexity. To solve the above technical problems, this invention adopts the following technical solutions:
[0007] A wafer defect detection method based on the vision transformer model includes the following steps:
[0008] Step S1: Acquire top views of the wafer from a normal perspective and top views from a defective perspective, and convert both to the same image format and size. Use bilinear interpolation algorithm to consider the information of the four pixels around the target pixel to ensure that each pixel can correspond one-to-one.
[0009] Step S2: Compare the pixels at the same coordinate positions in the two images obtained in Step S1. Determine the threshold d based on the characteristics of the wafer image, noise, and minimum defect size. Traverse the pixels of the image, obtain their RGB values, and calculate the absolute difference between the pixels and the surrounding pixels in the nine-grid neighborhood in each channel. Once the absolute difference of a pixel in at least one channel exceeds the threshold, it is marked as a suspected defect point. Then, detect the defect size under 5x5 pixels as expected, determine the extended area with the point as the center, and mark the pixels in the area as defect locations through binary image marking.
[0010] Step S3: Process the pixels at the defect location, and use a centroid-based matching method to extract the target location and target information of the defect location; acquire images of the wafer from a normal viewing angle, perform data preprocessing on the images, and use matrix similarity calculation to find the position of the defect location in the normal viewing angle and fuse it with the location of the defect feature.
[0011] Step S4: Construct an L-Vit structure based on vision transformer. First, extract the location information of defects in the wafer image and encode it into a vector sequence. The sequence contains key data such as defect center coordinates and bounding box parameters. Then, perform preprocessing, use normalization to adjust the numerical range, use a smoothing algorithm to reduce noise interference, and finally integrate the processed vector sequence into the vision transformer architecture.
[0012] Step S5: Use the improved multi-head self-attention mechanism p-MHA to calculate the defect features. First, the correlation between the current position and the actual position is obtained through interactive calculation of the fusion sequence. Then, p-MHA preprocesses q and v before attention calculation, filters out the interference of noise and irrelevant information through interaction at key positions, and finally determines the position of q.
[0013] Further, in step S1, the bilinear interpolation algorithm is used. Given the four adjacent pixel values I x1,y1 , I x1,y2 , I x2,y1 , I x2,y2 in the original image, where x1, x2 and y1, y2 are the positions of the four pixels in the original image, and x1 < x2 and y1 < y2, and the target position is (x, y), which is located between the four known pixel points. The formula is:
[0014]
[0015]
[0016] Then, through vertical interpolation, interpolation is performed in the y-axis direction:
[0017]
[0018] Finally, the obtained I x,y is the interpolation result of the target position (x, y).
[0019] Further, in step S2, for the pixel points at the same coordinate position in two pictures, the absolute differences in each color channel are calculated respectively; the defect positions are located by collecting the top views of the normal perspective and the defective perspective of the wafer body and using the absolute difference method:
[0020] (R def (x, y), G def (x, y), B def (x, y))
[0021] (R ref (x, y), G ref (x, y), B ref (x, y))
[0022] d R (x, y) = |R def (x, y) - R ref (x, y)|
[0023] Where R def (x, y) is the red pixel point of the top view of the wafer body collected from the normal perspective, G def(x, y) represents the green pixels in the top view of the wafer from a normal viewing angle, B def (x, y) represents the red and blue pixels of the top view of the wafer from a normal viewing angle, R ref (x, y) represents the red pixels in the top view of the wafer with defects, G def (x, y) represents the red pixels in the top view of the wafer with defects, B def (x, y) represents the blue pixels in the top view of the wafer with defects, and d R (x, y) represents the absolute difference between corresponding pixels in a top view taken from a normal viewing angle of the wafer and a top view taken from a defective viewing angle. The defect location is determined by the following criteria:
[0024]
[0025] Furthermore, in step S3, the target location and target information of the defect location are obtained using a centroid-based matching method, and the specific steps are as follows:
[0026] Step S3-1: Calculate the centroid coordinates of the defect location using a weighted average method. The centroid coordinates are calculated by calculating the weighted average of the pixels in the x and y directions, with the weight being the grayscale value of each pixel. The calculation formula is as follows:
[0027]
[0028]
[0029] Where I(x, y) is the gray value of the pixel with coordinates (x, y), and ∑ represents the summation of pixels within the entire defect location area;
[0030] Step S3-2: Obtain the information of the defect-free comparison image, traverse each point in the defect-free comparison image or traverse each region through a sliding window, and calculate the Euclidean distance d between each point and the centroid coordinates of the defect location; the formula for calculating the Euclidean distance is:
[0031]
[0032] Where (x1, y1) are the centroid coordinates of the defect area, and (x2, y2) are the coordinates of the point or area to be compared in the comparison photo;
[0033] Step S3-3: Use the particle swarm optimization algorithm to find the point or region with the smallest distance to determine the corresponding position of the defect in the defect-free control image. The objective function is the mean square error f, and the formula is:
[0034]
[0035] Where, P = (p x p y Let f be the particle position to be optimized, and T(i,j) and D(P+(i,j)) be the pixel values at position (i,j) in the defect-free image and the defective image, respectively. The point with the smallest distance is found based on the minimum value of f to determine the defect position and the corresponding position in the defect-free control image.
[0036] Furthermore, in step S4, the L-Vit structure based on the vision transformer adds a vector sequence of defect locations to the Vit structure. This enhances the defect features by incorporating the preprocessed sequence. Let P = (x p y p () represents the coordinates of the defect location, where the coordinates are the center coordinates or other representative location coordinates, F ij W represents the feature vector at position (i, j) in the image feature map. pos The position guidance weight matrix, position guidance score S ij The calculation is as follows:
[0037]
[0038] Where, ||(i,j)-P|| 2 The squared Euclidean distance between the image feature location and the defect location is calculated, where γ is a hyperparameter controlling the influence of distance. Based on this location guidance score, the features are weighted and summed to obtain the location-guided feature vector F. guided :
[0039]
[0040] Through the location feature vector F guided This allows features located near the defect to receive more attention and emphasis.
[0041] Furthermore, in step S5, the improved multi-head self-attention mechanism p-MHA first processes the fused sequence for q and v before inputting the three parameters q, k, and v. By interacting with the current position q and the actual position v, the position of q is determined more accurately. p-MHA preprocesses q and v before attention calculation and only interacts at key positions to accurately determine the position of q.
[0042] Furthermore, the steps of the improved multi-head self-attention mechanism p-MHA in step S5 are as follows:
[0043] Step S5-1: For the input query (q), (k), and value (v), the multi-head attention mechanism first performs a linear transformation on them to obtain different head versions q, k, and v. For each head i, there will be a corresponding linear transformation matrix W.qi W ki W vi Make:
[0044] q i =q*W qi
[0045] k i =k*W ki
[0046] v i =v*W vi
[0047] Where i = 1, 2, 3, ..., h;
[0048] Step S5-2: Calculate the attention score for each head i, where the attention score represents the query q. i With key k j The degree of correlation between them; the formula for calculating attention score is:
[0049]
[0050] Where d k is the dimension of key k. The softmax function is used to normalize the scores to a probability distribution form, such that the sum of all possible association scores is 1.
[0051] Step S5-3: Calculate the output o for each head i based on the attention score. i This involves a weighted sum of the attention score and its corresponding value v, using the following formula:
[0052]
[0053] Compared with the prior art, the present invention, employing the above technical solution, has the following beneficial effects:
[0054] (1) The present invention provides a wafer defect detection method based on a vision transformer model, which acquires a top view of the wafer from a normal perspective and a top view from a defective perspective, and locates the defect position using the absolute difference method. By upsampling the located area, the features of the defect are magnified, which is more conducive to model learning.
[0055] (2) The present invention provides a wafer defect detection method based on the vision transformer model, and proposes an L-Vit structure. This structure transforms the data after absolute difference processing into a vector sequence and combines it with the vector sequence of the defect perspective, which further highlights the characteristics of the defect.
[0056] (3) The present invention provides a wafer defect detection method based on the vision transformer model, and proposes a new multi-head self-attention mechanism p-MHA, which reduces the amount of data in the multi-head attention mechanism and the amount of data in the model.
[0057] (4) The present invention provides a wafer defect detection method based on the vision transformer model, and proposes a new multi-head self-attention mechanism p-MHA, which enables the model to focus on key information closely related to the defect when calculating defect features, greatly improving the accuracy and reliability of wafer defect detection, and providing a solid data foundation for subsequent defect analysis and processing.
[0058] (5) The present invention provides a wafer defect detection method based on the vision transformer model, which uses a bilinear interpolation algorithm. When the wafer image is scaled, it can make the color and brightness transition of the image more natural and smooth. Attached Figure Description
[0059] Figure 1 This is a flowchart illustrating the detection process of a wafer defect detection method based on the Vision Transformer model according to the present invention.
[0060] Figure 2 This invention proposes a novel L-Vit structure based on visiontransformer (vit); Detailed Implementation
[0061] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0062] Example:
[0063] like Figure 1 As shown, a wafer defect detection method based on the Vision Transformer model includes the following steps:
[0064] Step S1: Acquire top views of the wafer from a normal perspective and top views from a defective perspective, and convert both to the same image format and size. Use bilinear interpolation algorithm to consider the information of the four pixels around the target pixel to ensure that each pixel can correspond one-to-one.
[0065] Step S2: Compare the pixel points at the same coordinate positions in the two images obtained in Step S1. Comprehensively determine the threshold d1 based on the characteristics of the wafer image, noise, and the minimum defect size. Traverse the pixels of the image, obtain their RGB values, and calculate the absolute differences of the pixels in the surrounding nine-grid neighborhood in each channel. Once the absolute difference of at least one channel of a certain pixel exceeds the threshold, it is marked as a suspected defect point. Then, according to the expected detection of the defect size under 5x5 pixels, determine the expansion area centered on this point, and mark the pixels in the area as the defect positions through binary image marking;
[0066] Step S3: Process the pixel points at the defect positions, and use the method based on centroid matching to extract the target positions and target information at the defect positions; Collect the images of the normal view of the wafer body, perform data preprocessing on the images, and find the positions where the defect positions should be in the normal view through matrix similarity calculation for fusion, and fuse the features with the positions with defective features;
[0067] Step S4: Construct the L-Vit structure based on vision transformer. First, extract the position information of the defects in the wafer body image, encode it into a vector sequence, and the sequence contains key data such as the defect center coordinates and bounding box parameters. Then, perform preprocessing, adjust the numerical range using normalization operations, and reduce noise interference using smoothing algorithms. Finally, integrate the processed vector sequence into the vision transformer architecture;
[0068] Step S5: Calculate the defect features using the improved multi-head self-attention mechanism p-MHA. First, the fused sequence undergoes interactive calculation to obtain the correlation between the current position and the actual position. Then, p-MHA preprocesses q and v before attention calculation, filters the interference of noise and irrelevant information through interaction at key positions, and finally determines the position of q.
[0069] Further, in Step S1, the bilinear interpolation algorithm is used. Given four adjacent pixel values I x1,y1 ,I x1,y2 ,I x2,y1 ,I x2,y2 in the original image, where x1, x2 and y1, y2 are the positions of the four pixels in the original image, and x1 < x2 and y1 < y2, the target position is (x, y), and this position is between the four known pixel points. The formula is:
[0070]
[0071]
[0072] Then, through vertical interpolation, perform interpolation in the y-axis direction:
[0073]
[0074] The final I x,y It is the interpolation result of the target position (x, y).
[0075] Furthermore, in step S2, for pixels at the same coordinate positions in the two images, the absolute difference in each color channel is calculated; by acquiring a top view of the wafer from a normal perspective and a top view from a defective perspective, the defect location is located using the absolute difference method.
[0076] (R def (x, y), G def (x, y), B def (x, y))
[0077] (R ref (x, y), G ref (x, y), B ref (x, y))
[0078] d R (x, y) = |R def (x, y)-R ref (x, y)|
[0079] Where R def (x, y) represents the red pixels in the top view of the wafer from a normal viewing angle, G def (x, y) represents the green pixels in the top view of the wafer from a normal viewing angle, B def (x, y) represents the red and blue pixels of the top view of the wafer from a normal viewing angle, R ref (x, y) represents the red pixels in the top view of the wafer with defects, G def (x, y) represents the red pixels in the top view of the wafer with defects, B def (x, y) represents the blue pixels in the top view of the wafer with defects, and d R (x, y) represents the absolute difference between corresponding pixels in a top view taken from a normal viewing angle of the wafer and a top view taken from a defective viewing angle. The defect location is determined by the following criteria:
[0080]
[0081] Furthermore, in step S3, the target location and target information of the defect location are obtained using a centroid-based matching method, and the specific steps are as follows:
[0082] Step S3-1: Calculate the centroid coordinates of the defect location using a weighted average method. The centroid coordinates are calculated by calculating the weighted average of the pixels in the x and y directions, with the weight being the grayscale value of each pixel. The calculation formula is as follows:
[0083]
[0084]
[0085] Where I(x, y) is the gray value of the pixel with coordinates (x, y), and ∑ represents the summation of pixels within the entire defect location area;
[0086] Step S3-2: Obtain the information of the defect-free comparison image, traverse each point in the defect-free comparison image or traverse each region through a sliding window, and calculate the Euclidean distance d between each point and the centroid coordinates of the defect location; the formula for calculating the Euclidean distance is:
[0087]
[0088] Where (x1, y1) are the centroid coordinates of the defect area, and (x2, y2) are the coordinates of the point or area to be compared in the comparison photo;
[0089] Step S3-3: Use the particle swarm optimization algorithm to find the point or region with the smallest distance to determine the corresponding position of the defect in the defect-free control image. The objective function is the mean square error f, and the formula is:
[0090]
[0091] Where, P = (p x p y Let f be the particle position to be optimized, and T(i,j) and D(P+(i,j)) be the pixel values at position (i,j) in the defect-free image and the defective image, respectively. The point with the smallest distance is found based on the minimum value of f to determine the defect position and the corresponding position in the defect-free control image.
[0092] Furthermore, in step S4, the L-Vit structure based on the vision transformer adds a vector sequence of defect locations to the Vit structure. This enhances the defect features by incorporating the preprocessed sequence. Let P = (x p y p () represents the coordinates of the defect location, where the coordinates are the center coordinates or other representative location coordinates, F ij W represents the feature vector at position (i, j) in the image feature map. pos The position guidance weight matrix, position guidance score S ij The calculation is as follows:
[0093]
[0094] Where,‖(i,j)-P‖ 2The squared Euclidean distance between the image feature location and the defect location is calculated, where γ is a hyperparameter controlling the influence of distance. Based on this location guidance score, the features are weighted and summed to obtain the location-guided feature vector F. guided :
[0095]
[0096] Through the location feature vector F guided This allows features located near the defect to receive more attention and emphasis.
[0097] Furthermore, in step S5, the improved multi-head self-attention mechanism p-MHA first processes the fused sequence for q and v before inputting the three parameters q, k, and v. By interacting with the current position q and the actual position v, the position of q is determined more accurately. p-MHA preprocesses q and v before attention calculation and only interacts at key positions to accurately determine the position of q.
[0098] Furthermore, the steps of the improved multi-head self-attention mechanism p-MHA in step S5 are as follows:
[0099] Step S5-1: For the input query (q), (k), and value (v), the multi-head attention mechanism first performs a linear transformation on them to obtain different head versions q, k, and v. For each head i, there will be a corresponding linear transformation matrix W. qi W ki W vi Make:
[0100] q i =q*W qi
[0101] k i =k*W ki
[0102] v i =v*W vi
[0103] Where i = 1, 2, 3, ..., h;
[0104] Step S5-2: Calculate the attention score for each head i, where the attention score represents the query q. i With key k j The degree of correlation between them; the formula for calculating attention score is:
[0105]
[0106] Where d kis the dimension of key k. The softmax function is used to normalize the scores to a probability distribution form, such that the sum of all possible association scores is 1.
[0107] Step S5-3: Calculate the output o for each head i based on the attention score. i This involves a weighted sum of the attention score and its corresponding value v, using the following formula:
[0108]
Claims
1. A wafer defect detection method based on a vision transformer model, comprising the following steps: Step S1: Acquire top views of the wafer from a normal perspective and top views from a defective perspective, and convert both to the same image format and size. Use bilinear interpolation algorithm to consider the information of the four pixels around the target pixel to ensure that each pixel can correspond one-to-one. Step S2: Compare the pixels at the same coordinate positions in the two images obtained in Step S1, and determine the threshold based on the characteristics of the wafer image, noise, and minimum defect size. The image pixels are traversed, their RGB values are obtained, and the absolute difference between the pixels and the surrounding 3x3 grid pixels in each channel is calculated. Once the absolute difference of a pixel in at least one channel exceeds the threshold, it is marked as a suspected defect point. Then, the defect size under 5x5 pixels is detected as expected, and the expansion area is determined with the suspected defect point as the center. The pixels in the area are marked as defect locations by binary image marking. Step S3: Process the pixels at the defect location, and use a centroid-based matching method to extract the target location and target information of the defect location; acquire images of the wafer from a normal viewing angle, perform data preprocessing on the images, and use matrix similarity calculation to find the position of the defect location in the normal viewing angle and fuse it with the location of the defect feature. Step S4: Construct an L-Vit structure based on vision transformer. First, extract the location information of defects in the wafer image and encode it into a vector sequence. The sequence contains key data such as the defect center coordinates and bounding box parameters. Then, perform preprocessing, use normalization to adjust the numerical range, use a smoothing algorithm to reduce noise interference, and finally integrate the processed vector sequence into the vision transformer architecture. Step S5: The improved multi-head self-attention mechanism p-MHA is used to calculate the defect features. First, the correlation between the current position and the actual position is obtained through interactive calculation of the fused sequence. Then, p-MHA preprocesses q and v before attention calculation, and interactively filters noise and irrelevant information at key positions. Finally, the position of q is determined.
2. The wafer defect detection method based on the vision transformer model according to claim 1, characterized in that, Step S1 uses a bilinear interpolation algorithm, given the values of four adjacent pixels in the original image. ,in and These are the positions of four pixels in the original image, and and The target location is The formula for this position, which is located between four known pixels, is: , Next, vertical interpolation is performed, using interpolation along the y-axis: , The final result The target location The interpolation result.
3. The wafer defect detection method based on the vision transformer model according to claim 1, characterized in that, Step S2: For pixels at the same coordinates in the two images, calculate the absolute difference in each color channel; locate the defect by acquiring a top view of the wafer from a normal perspective and a top view from a defective perspective, and using the absolute difference method. , in To capture the red pixels in a top view of the wafer from a normal perspective, To capture the green pixels in a top view of the wafer from a normal viewing angle, To capture the red and blue pixels in a top view of the wafer from a normal perspective, To capture the red pixels of a top-view image of a wafer with defects, To capture the red pixels in a top-view image of a wafer with defects, To capture the blue pixels in a top-view image of a wafer with defects, To determine the defect location by acquiring the absolute difference between corresponding pixels in a top view from a normal viewing angle and a top view from a defective viewing angle, the following criteria are used: 。 4. The wafer defect detection method based on the vision transformer model according to claim 1, characterized in that, In step S3, the target location and target information of the defect location are obtained using a centroid-based matching method, and the specific steps are as follows: Step S3-1: Calculate the centroid coordinates of the defect location using a weighted average method. The centroid coordinates are calculated by calculating the weighted average of the pixels in the x and y directions, with the weight being the grayscale value of each pixel. The calculation formula is as follows: , in It is the grayscale value of the pixel with coordinates (x, y). This represents the summation of pixels over the entire area of the defect location; Step S3-2: Obtain the information of the defect-free control image. Traverse each point in the defect-free control image or traverse each region through a sliding window, and calculate the Euclidean distance between them and the centroid coordinates of the defect location. The formula for calculating the Euclidean distance is: ,in The coordinates of the centroid of the defect region are... The coordinates of the points or areas to be compared in the reference photograph; Step S3-3: Use the particle swarm optimization algorithm to find the point or region with the smallest distance to determine the corresponding position of the defect in the defect-free control image. The objective function is the mean square error. The formula is: ,in, The particle position to be optimized. and Defect-free and defective images are located at [locations]. The pixel value at that location is used to find the point with the smallest distance based on the minimum value of f, thus determining the defect location and its corresponding position in the defect-free comparison image.
5. The wafer defect detection method based on the vision transformer model according to claim 1, characterized in that, In step S4, the L-Vit structure based on the vision transformer adds a vector sequence of defect locations to the Vit structure. This enhances the defect features by incorporating a pre-processed sequence. Let... The coordinates represent the location of the defect; these coordinates can be the center coordinates or other representative location coordinates. Let (i,j) represent the feature vector at position (i,j) in the image feature map. Position-guided weight matrix, position-guided score The calculation is as follows: ,in, Calculate the squared Euclidean distance between the image feature location and the defect location. To control the hyperparameters that influence the degree of distance influence, the features are weighted and summed based on the position guidance score to obtain the position-guided feature vector. : Through location feature vectors This allows features located near the defect to receive more attention and emphasis.
6. The wafer defect detection method based on the vision transformer model according to claim 1, characterized in that, In step S5, the improved multi-head self-attention mechanism p-MHA first processes the fused sequence for q and v before inputting the three parameters q, k, and v. By interacting with the current position q and the actual position v, the position of q is determined more accurately. p-MHA preprocesses q and v before attention calculation and only interacts at key positions to accurately determine the position of q.
7. The wafer defect detection method based on the vision transformer model according to claim 1, characterized in that, The steps of the improved multi-head self-attention mechanism p-MHA in step S5 are as follows: Step S5-1: For the input query q, k, and value v, the multi-head attention mechanism first performs a linear transformation on them to obtain different head versions of q, k, and v. For each head i, there will be a corresponding linear transformation matrix. Make: , in, ; Step S5-2: Calculate the attention score for each head i. The attention score represents the query... AND key The degree of correlation between them; the formula for calculating attention score is: , in is the dimension of key k. The softmax function is used to normalize the scores to a probability distribution form, such that the sum of all possible association scores is 1. Step S5-3: Calculate the output for each head i based on the attention score. This involves a weighted sum of the attention score and its corresponding value v, using the following formula: .
Citation Information
Patent Citations
Transform-based wafer defect detection method and system
CN115311203A
Transform-based flexible circuit board defect detection method
CN118887209A