PCB defect detection method based on coordinate attention mechanism
By introducing coordinate attention mechanism and feature aggregation module in PCB defect detection, the problem of loss of small target characteristic information in deep convolution is solved, the accuracy of detection and segmentation accuracy are improved, and more accurate defect detection is achieved.
Patent Information
- Application Number
- CN202411289526.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In PCB defect detection, the characteristic information of small objects is lost during deep convolution, resulting in low detection accuracy and segmentation accuracy. The differences in the characteristics of the advanced abstract features trained by ImageNet and the industrial environment lead to difficulty in detection.
Using defect detection method based on coordinate attention mechanism, the network and feature aggregation module are pre-trained to acquire and weight different levels of features to reduce the loss of feature information, and use memory banks to match features during detection to ensure that the tiny target features are at various scales. overlay of retention and global context information.
The accuracy and defect segmentation accuracy of PCB defect detection are improved, and the deviation area information of the defect local feature set and positive sample feature can be calculated more accurately, which enhances the detection reliability.
Smart Images

Figure CN119107316A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of PCB defect detection, and in particular to a PCB defect detection method based on a coordinate attention mechanism. Background Art
[0002] Anomaly detection tasks play an important role in industrial manufacturing, medical diagnosis, and security monitoring. Especially in the electronics manufacturing industry, ensuring the quality of printed circuit boards (PCBs) is not only a key step to improve product reliability, but also a necessary measure to prevent high costs caused by product failures. In recent years, the rapid development of deep learning technology has greatly promoted the progress in the field of image recognition. Algorithms such as the YOLO series and Detection Transformer (DETR) are widely used in PCB target detection tasks due to their excellent performance in processing speed and accuracy. These algorithms are mainly based on supervised learning and rely on a large amount of labeled data for training, so that they can identify and locate defects on PCBs.
[0003] The prior art discloses the application of unsupervised learning algorithms in PCB defect detection. By using a pre-trained convolutional neural network (CNN) to extract features from images and analyze the distribution differences between positive and negative samples in the feature space, the defect location can be detected. However, there are differences between the high-level abstract features obtained by ImageNet training and the features required in industrial environments, which makes it difficult to fully utilize high-level features for accurate matching and detection during testing. In addition, during the deep convolution process, a large amount of feature details of small targets on the PCB are lost, and neighborhood perception is also difficult to retain sufficient defect information, resulting in a decrease in the calculated feature deviation distance, and failure to be effectively identified as a defect. How to reduce the loss of characteristic information of small targets during the deep convolution process is a problem that needs to be studied at present. Summary of the invention
[0004] The purpose of the present invention is to overcome the problems existing in the prior art and provide a PCB defect detection method based on a coordinate attention mechanism. During PCB defect detection, the present invention improves the PCB defect detection accuracy and defect segmentation precision by reducing the loss of characteristic information of small targets in the deep convolution process.
[0005] In order to achieve the above object, the present invention provides a PCB defect detection method based on a coordinate attention mechanism, comprising:
[0006] Obtain a positive sample data set, where the positive sample data set includes multiple defect-free PCB images;
[0007] Inputting the positive sample data set into a defect detection model and outputting a plurality of local neighborhood feature sets, wherein the defect detection model includes a pre-trained network, a coordinate attention module and a feature aggregation module;
[0008] Screening duplicate items from the multiple local neighborhood feature sets, obtaining the screened local neighborhood feature set and storing it in a memory bank;
[0009] Inputting the PCB image to be inspected into the defect detection model, and outputting multiple local feature sets;
[0010] Acquire the first local neighborhood feature set closest to each local feature set from the memory bank;
[0011] Calculate a local anomaly score based on each local feature set and the corresponding first local neighborhood feature set;
[0012] Get a global anomaly score map based on all local anomaly scores;
[0013] The abnormal region is determined according to the global abnormal score map and the abnormal threshold, and the abnormal region is segmented to complete the detection.
[0014] Furthermore, obtaining the multiple local neighborhood feature sets specifically includes the following steps:
[0015] Inputting the positive sample data set into the pre-trained network, extracting features from each defect-free PCB image, and obtaining at least four layers of feature maps for each image;
[0016] Inputting the third layer feature map and the fourth layer feature map of each image into the coordinate attention module to obtain a first weighted feature map corresponding to the third layer feature map and a second weighted feature map corresponding to the fourth layer feature map;
[0017] The first weighted feature map, the second weighted feature map, and the second layer feature map are input into the feature aggregation module to obtain multiple local neighborhood feature sets.
[0018] Furthermore, the step of inputting the first weighted feature map, the second weighted feature map, and the second layer feature map into the feature aggregation module to obtain a plurality of local neighborhood feature sets specifically includes:
[0019] Calculating magnifications of the first weighted feature map and the second weighted feature map based on the second layer feature map;
[0020] Enlarging the first weighted feature map and the second weighted feature map to the same size as the second feature map based on the magnification factor;
[0021] The enlarged first weighted feature map, the enlarged second weighted feature map and the second layer feature map are aggregated to obtain multiple local neighborhood feature sets.
[0022] Further, the magnification of the first weighted feature map and the second weighted feature map is calculated based on the second layer feature map, and the calculation method is as follows:
[0023]
[0024] Among them, P2 is the second layer feature map, a(P2) is the side length of the second layer feature map, r i To i Zoom in to a multiple of P2.
[0025] Furthermore, the defect detection model is based on the PatchCore algorithm.
[0026] Furthermore, a core subsampling method is used to filter duplicate items from the multiple local neighborhood feature sets, and the filtered local neighborhood feature sets are obtained and stored in a memory bank.
[0027] Furthermore, the local anomaly score is calculated according to each local feature set and the corresponding first local neighborhood feature set, and the calculation method is as follows:
[0028] s=||m test,* -m * ||2
[0029] Among them, is the abnormal score, m test,* is the local feature set, m * is the corresponding first local neighborhood feature set.
[0030] Furthermore, obtaining a global anomaly score map based on all local anomaly scores includes:
[0031] All local anomaly scores are rearranged according to the spatial positions of all blocks to obtain a segmentation matrix diagram;
[0032] Amplifying the segmentation matrix diagram to obtain a resolution matching the PCB image to be detected;
[0033] The upsampled segmentation matrix image is smoothed using a Gaussian blur function to obtain a global anomaly score image.
[0034] Furthermore, the method of enlarging the segmentation matrix diagram includes one or more of nearest neighbor interpolation, bilinear interpolation and bicubic interpolation.
[0035] Furthermore, the abnormal area is determined according to the global abnormal score map and the abnormal threshold, and the abnormal area is segmented to complete the detection, which specifically includes: comparing each pixel of the global abnormal score map with the abnormal threshold, marking the pixels greater than the abnormal threshold as abnormal, and finally segmenting the abnormal area, wherein the comparison formula is as follows:
[0036]
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] The present invention adds a coordinate attention mechanism to the defect detection model, weights the spatial coordinate position information of small targets in the PCB, and uses a feature aggregation module to aggregate features at different levels during upsampling, thereby ensuring that the features of the small targets are fully retained at all scales. The features are then superimposed with the second-layer feature map containing more global context information, so that when the local feature set with the minimum distance is subsequently detected, the local neighborhood feature set contains more local features. When detecting the PCB, the regional information where the defect local feature set deviates from the positive sample feature can be accurately calculated, thereby improving the accuracy of defect detection and the precision of defect segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a flow chart of a PCB defect detection method based on a coordinate attention mechanism according to Embodiment 1 of the present invention;
[0040] Figure 2 This is a network structure diagram of a PCB defect detection method based on a coordinate attention mechanism according to Embodiment 1 of the present invention;
[0041] Figure 3 is a structural diagram of a coordinate attention module according to Embodiment 1 of the present invention;
[0042] Figure 4 This is a diagram of the dynamic upsampling process of Example 1 of the present invention. DETAILED DESCRIPTION
[0043] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0044] In the description of the present invention, it should be noted that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.
[0045] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0046] Furthermore, in the description of the present invention, unless otherwise specified, “plurality” means two or more.
[0047] Example 1
[0048] like Figure 1 , 2 As shown, a PCB defect detection method based on a coordinate attention mechanism according to a preferred embodiment of an embodiment of the present invention includes:
[0049] S1: Obtain a positive sample data set, which contains multiple defect-free PCB images;
[0050] In a feasible embodiment, in order to optimize the selection of positive samples, when collecting data sets, first ensure the clarity of the image so as to show the details of the PCB board in detail; secondly, select defect-free PCB pictures with rich morphology and background semantics to avoid selecting overly similar pictures. Although, in the PCB inspection scene, due to the fixation of the lens, lighting method and transport conveyor belt, the pictures are often very similar. However, there are still subtle differences between different PCB boards, such as tiny open and short circuits and different concave and convex areas. The defect detection model including the coordinate attention mechanism proposed in this embodiment can accurately capture these features, so it is necessary to select semantically rich pictures to enhance the training effect of the model.
[0051] S2: Inputting the positive sample data set into the defect detection model and outputting multiple local neighborhood feature sets, wherein the defect detection model includes a pre-trained network, a coordinate attention module and a feature aggregation module;
[0052] In a feasible embodiment, S2 specifically includes:
[0053] S2.1: Input the positive sample data set into the pre-trained network, extract features for each defect-free PCB image, and obtain at least four layers of feature maps for each image;
[0054] It should be noted that the pre-trained network of this embodiment uses a Wide_ResNet_50 feature extraction network pre-trained with the ImageNet dataset to extract features from positive samples; the Wide_ResNet_50 network will generate four layers of feature maps of different sizes, which gradually become more complex from low to high layers. Low-level feature maps capture simple features such as edges and textures, while high-level feature maps capture more complex shapes, objects, and semantic information. The multiple convolutional layers and residual blocks in the network structure enable the feature maps to contain multi-scale information, which helps to detect and identify objects of different sizes and shapes.
[0055] S2.2: Input the third-layer feature map and the fourth-layer feature map of each region into the coordinate attention module to obtain a first weighted feature map corresponding to the third-layer feature map and a second weighted feature map corresponding to the fourth-layer feature map;
[0056] Specifically, the output feature maps of the third and fourth layers are used as inputs and the pooling kernels (H, 1) and (1, W) are used to encode the horizontal and vertical features, that is, the output of the c-th dimension feature is:
[0057]
[0058] Among them, x c is the input feature, ∑ 0≤i≤W x c (h,j) accumulates all elements in its h-th row, and finally Calculate the average, that is, the overall It is expressed as the accumulation and averaging of the horizontal axis direction. Similarly, To accumulate and average the vertical coordinates, the corresponding value is Figure 3 X Avg Pool and Y Avg Pool in;
[0059] Then use 1×1 convolution and nonlinear activation to and Connect the merged features head to tail for feature transformation:
[0060] f=δ(F1([z h ,z w ]))
[0061] Where [·] is the array concatenation operation, and δ is a nonlinear activation function, corresponding to Figure 3 The Concat+Conv2d and Batch Norm+Non-linear parts;
[0062] Split f into two independent features f h ∈R C / r×H and f w ∈R C / r×W, respectively perform 1×1Conv2d convolution and Sigmoid activation function for characterization, ensure the same height and width size as the original input, and obtain the weight matrix. In the final stage of processing, the feature map and the weight matrix are multiplied element-wise, and a multiplication weighting mechanism is introduced to generate a feature map with significant attention weights in the height and width directions. This process is dynamic upsampling. The specific process is shown in Figure 4 , the specific expression is:
[0063] y c (i,j)=x c (i,j)×σ(F h (f h )×σ(F w (f w )
[0064] In the formula, y c (i,j) is the output feature, x c (i,j) is the input feature. It can be understood that if x c (i,j) is the third-layer feature map, then y c (i,j) is the first weighted feature map, if x c (i,j) is the fourth layer feature map, then y c (i, j) is the second weighted feature map σ is the Sigmoid activation function, F h With F w It is a 1×1 convolution in the height and width directions;
[0065] S2.3: Input the first weighted feature map, the second weighted feature map and the second layer feature map into a feature aggregation module to obtain multiple local neighborhood feature sets.
[0066] In a feasible embodiment, S2.3 specifically includes:
[0067] S2.3.1: Calculate the magnification of the first weighted feature map and the second weighted feature map based on the second layer feature map;
[0068] It should be noted that the calculation method of magnification is as follows:
[0069]
[0070] Among them, P2 is the second layer feature map, a(P2) is the side length of the second layer feature map, r i To i Zoom in to a multiple of P2.
[0071] S2.3.2: Based on the magnification factor, the first weighted feature map and the second weighted feature map are enlarged to the same size as the second feature map; specifically, according to the above formula, the magnification factors r3 and r4 of P3 and P4 are calculated respectively, and the C channels corresponding to a single pixel in P3 and P4 are reshaped into a 1×C vector, multiplied with the C×N matrix to obtain a 1×N vector, and then reshaped into r×r×N / r 2 The enlarged sub-pixel blocks are arranged and combined into a feature map of the same size as P2, where P2, P3, and P4 refer to the second, third, and fourth layer feature maps respectively.
[0072] S2.3.3: Aggregate the enlarged first weighted feature map, the enlarged second weighted feature map and the second layer feature map to obtain multiple local neighborhood feature sets.
[0073] The enlarged first weighted feature map, the enlarged second weighted feature map and P2 are superimposed, and then the features are aggregated according to the position to obtain the local feature set P(i, j).
[0074] S3: Filter duplicate items from multiple local neighborhood feature sets, obtain the filtered local neighborhood feature set and store it in a memory bank;
[0075] In a feasible embodiment, a core subsampling method is used to filter duplicate items from the multiple local neighborhood feature sets, obtain the filtered local neighborhood feature set and store it in a memory bank. The core subsampling method is specifically: a subset M is selected from a large-scale local feature set memory bank M. c It can effectively represent the feature distribution of the original memory bank. In the process of selecting local feature sets, the maximum distance between any two sets in the selected local feature sets is as small as possible, that is, the distance between each pair of selected local feature sets is calculated and the maximum value is determined. The optimization process aims to reduce this maximum distance to ensure that the local feature sets are more evenly distributed in the feature space. The formula is as follows:
[0076]
[0077] Among them, M is the local feature set library before sampling, M c is the local feature set library after sampling, M c * Represents the set of local features being filtered.
[0078] S4: Input the PCB image to be inspected into the defect detection model and output multiple local feature sets;
[0079] In a feasible embodiment, the image of the PCB to be inspected can be obtained by a high-resolution industrial camera or other professional photographic equipment, and the obtained image of the PCB to be inspected is input into the defect detection model. The process of obtaining multiple local feature sets is consistent with S2 and will not be repeated here.
[0080] S5: Obtain the first local neighborhood feature set closest to each local feature set from the memory bank;
[0081] In a feasible embodiment, for each local feature set m in the test image test , calculate the Euclidean distance between it and each normal local feature set m in the memory library, take the set with the smallest distance and pair it with the local feature set of the test image to obtain the local feature set m of the test image test,* and the local feature set m closest to it in the memory library (bank) * , as follows:
[0082]
[0083] S6: Calculate a local anomaly score according to each local feature set and the corresponding first local neighborhood feature set;
[0084] In a feasible embodiment, S6 is specifically as follows: recalculate the local feature set m in the test image test,* and the local feature set m in the memory bank * The Euclidean distance of each local feature in is recorded, and the maximum distance is recorded as the local feature set m test,* With m * The anomaly score S, S represents the degree of abnormality of the local feature set in the test image. If this score is high, it means that the features of this area in the test image are very different from those in the normal feature library, and thus it is considered abnormal. The anomaly score is calculated as follows:
[0085] s=||m test,* -m * ||2
[0086] Among them, is the abnormal score, m test,* is the local feature set, m * is the corresponding first local neighborhood feature set.
[0087] S7: Obtain a global anomaly score map based on all local anomaly scores;
[0088] In a feasible embodiment, S7 includes:
[0089] All local anomaly scores are rearranged according to the spatial positions of all blocks to obtain a segmentation matrix diagram;
[0090] The segmentation matrix image is enlarged to obtain a resolution matching the PCB image to be detected. It is understood that the enlargement method includes one or more of nearest neighbor interpolation, bilinear interpolation and bicubic interpolation;
[0091] The upsampled segmentation matrix image is smoothed using a Gaussian blur function to obtain a global anomaly score image, where the width of the Gaussian blur function is 4.
[0092] S8: Determine the abnormal area according to the global abnormal score map and the abnormal threshold, and segment the abnormal area to complete the detection.
[0093] In a feasible embodiment, S8 specifically includes: comparing each pixel of the global anomaly score map with the anomaly threshold, marking pixels greater than the anomaly threshold as abnormal, and finally segmenting the abnormal area, wherein the comparison formula is as follows:
[0094]
[0095] Example 2
[0096] In order to verify the performance of the PCB defect detection method based on the coordinate attention mechanism proposed in Example 1, this example uses two public PCB datasets for verification, namely PKU-Market-PCB and DeepPCB. Due to the diversity of categories, the image sizes of PKU-Market-PCB are different, and the sizes of all images are standardized to 960×960. The number of positive sample images is 20, the number of negative sample images is 693, and the image size of DeepPCB is 640×640, which contains paired data of defect-free template images and defective images, with a total of 1500 pairs. The defect-free template images are regarded as positive samples, and the defective images are regarded as negative samples.
[0097] The method (Ours) highlighted in this embodiment is compared with the reconstruction-based method and the representation-based method, wherein the compared algorithms include: Fastflow algorithm, PaDiM algorithm, PatchCore algorithm, Reverse_distillation algorithm, Stfpm algorithm; the comparison indicators include: Pixel-AUROC and Pixel_F1 Score; Pixel-AUROC: used to evaluate the performance of the classifier at different thresholds, and the quality of the segmentation result is measured by calculating the AUROC at the pixel level. Pixel-F1 Score: used to comprehensively evaluate the precision and recall rate of the classifier, and the quality of the segmentation result is measured by calculating the F1 score at the pixel level.
[0098] It can be seen from Table 1 (based on the PKU-Market-PCB dataset) and Table 2 (based on the DeepPCB dataset) that the method (our) proposed in this embodiment has the highest indicators on the two public PCB datasets (PKU-Market-PCB dataset and DeepPCB dataset), indicating that the method proposed in this embodiment achieves the best effect in unsupervised PCB defect segmentation.
[0099] Table 1
[0100] Method Fastflow PaDiM PatchCore Reverse_distillation Stfpm Ours Pixel-AUROC 65.6 62.2 88.3 86.2 77.4 97.5 pixel_F1Score 27.8 25.3 42.8 38.4 324 64.1
[0101] Table 2
[0102] Method Fastflow PaDiM PatchCore Reverse_distillation Stfpm Ours Pixel-AUROC 94 92.1 96.7 96.3 95.2 97.5 pixel_F1Score 42.4 35.9 57.1 49.2 39.5 58.7
[0103] Example 3
[0104] This embodiment provides a computer-readable storage medium, on which is stored a computer program for a PCB defect detection method based on a coordinate attention mechanism. When the computer program for a PCB defect detection method based on a coordinate attention mechanism is processed, the steps of the PCB defect detection method based on a coordinate attention mechanism are implemented.
[0105] In summary, the embodiment of the present invention provides a PCB defect detection method based on a coordinate attention mechanism, which adds a coordinate attention mechanism to the defect detection model, weights the spatial coordinate position information of the small target in the PCB, and uses a feature aggregation module to aggregate features at different levels during upsampling to ensure that the features of the small target are fully retained at all scales, and then performs feature superposition with the second-layer feature map containing more global context information, so that when the local feature set with the minimum distance is subsequently detected, the local neighborhood feature set contains more local features. When detecting PCBs, the regional information of the defect local feature set deviating from the positive sample feature can be accurately calculated, thereby improving the accuracy of defect detection and the accuracy of defect segmentation. .
[0106] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and substitutions can be made without departing from the technical principles of the present invention. These improvements and substitutions should also be regarded as the scope of protection of the present invention.
Claims
1. A PCB defect detection method based on coordinate attention mechanism, characterized in that: The method comprises the following steps: Obtain a positive sample data set, where the positive sample data set includes multiple defect-free PCB images; Inputting the positive sample data set into a defect detection model and outputting a plurality of local neighborhood feature sets, wherein the defect detection model includes a pre-trained network, a coordinate attention module and a feature aggregation module; Screening duplicate items from the multiple local neighborhood feature sets, obtaining the screened local neighborhood feature set and storing it in a memory bank; Inputting the PCB image to be inspected into the defect detection model, and outputting multiple local feature sets; Acquire the first local neighborhood feature set closest to each local feature set from the memory bank; Calculate a local anomaly score based on each local feature set and the corresponding first local neighborhood feature set; Get a global anomaly score map based on all local anomaly scores; The abnormal region is determined according to the global abnormal score map and the abnormal threshold, and the abnormal region is segmented to complete the detection.
2. According to claim 1, a PCB defect detection method based on coordinate attention mechanism is characterized in that: Acquiring the multiple local neighborhood feature sets specifically includes the following steps: Inputting the positive sample data set into the pre-trained network, extracting features from each defect-free PCB image, and obtaining at least four layers of feature maps for each image; Inputting the third layer feature map and the fourth layer feature map of each image into the coordinate attention module to obtain a first weighted feature map corresponding to the third layer feature map and a second weighted feature map corresponding to the fourth layer feature map; The first weighted feature map, the second weighted feature map, and the second layer feature map are input into the feature aggregation module to obtain multiple local neighborhood feature sets.
3. A PCB defect detection method based on coordinate attention mechanism according to claim 2, characterized in that: The step of inputting the first weighted feature map, the second weighted feature map, and the second layer feature map into the feature aggregation module to obtain a plurality of local neighborhood feature sets specifically includes: Calculating magnifications of the first weighted feature map and the second weighted feature map based on the second layer feature map; Enlarging the first weighted feature map and the second weighted feature map to the same size as the second feature map based on the magnification factor; The enlarged first weighted feature map, the enlarged second weighted feature map and the second layer feature map are aggregated to obtain multiple local neighborhood feature sets.
4. A PCB defect detection method based on coordinate attention mechanism according to claim 3, characterized in that: The magnification of the first weighted feature map and the second weighted feature map is calculated based on the second layer feature map, and the calculation method is as follows: Among them, P2 is the second layer feature map, a(P2) is the side length of the second layer feature map, r i To i Zoom in to a multiple of P2.
5. A PCB defect detection method based on coordinate attention mechanism according to claim 1, characterized in that: The defect detection model is based on the PatchCore algorithm.
6. A PCB defect detection method based on coordinate attention mechanism according to claim 1, characterized in that: A core subsampling method is used to filter duplicate items from the multiple local neighborhood feature sets, and a filtered local neighborhood feature set is obtained and stored in a memory bank.
7. A PCB defect detection method based on coordinate attention mechanism according to claim 1, characterized in that: The local anomaly score is calculated according to each local feature set and the corresponding first local neighborhood feature set, and the calculation method is as follows: s=||m test,* -m * ||2 Among them, is the abnormal score, m test,* is the local feature set, m * is the corresponding first local neighborhood feature set.
8. A PCB defect detection method based on coordinate attention mechanism according to claim 1, characterized in that: The obtaining of a global anomaly score map based on all local anomaly scores includes: All local anomaly scores are rearranged according to the spatial positions of all blocks to obtain a segmentation matrix diagram; Amplifying the segmentation matrix diagram to obtain a resolution matching the PCB image to be detected; The upsampled segmentation matrix image is smoothed using a Gaussian blur function to obtain a global anomaly score image.
9. A PCB defect detection method based on coordinate attention mechanism according to claim 8, characterized in that: The method of enlarging the segmentation matrix diagram includes one or more of nearest neighbor interpolation, bilinear interpolation and bicubic interpolation.
10. A PCB defect detection method based on a coordinate attention mechanism according to any one of claims 1 to 8, characterized in that: The abnormal area is determined according to the global anomaly score map and the anomaly threshold, and the abnormal area is segmented to complete the detection, which specifically includes: comparing each pixel of the global anomaly score map with the anomaly threshold, marking pixels greater than the anomaly threshold as abnormal, and finally segmenting the abnormal area, wherein the comparison formula is as follows:
Citation Information
Patent Citations
Industrial product anomaly detection method based on self-supervised puzzle module
CN115861306A
Surface defect determination method and surface defect inspection device
JP2019032268A
Cited By
Stress detection method for integrated circuit chip
CN119845459A
PCB production defect detection method and system based on image analysis
CN120070375A
A PCB production defect detection method and system based on image analysis
CN120070375B
PCB surface defect detection method and system based on double-layer SAM model collaboration
CN120747085A
PCB surface defect detection method and system based on double-layer SAM model cooperation
CN120747085B
