Circuit board defect location method based on defect type guidance

Through a multi-task learning method guided by defect types, a circuit board defect location model including a comprehensive encoder, segmentation decoder and classification decoder is constructed, which solves the problem of insufficient accuracy and efficiency of circuit board defect location in the existing technology and achieves High-precision circuit board defect identification.

CN118537338BActive Publication Date: 2024-10-15SOUTH CHINA NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411002884.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-10-15
Estimated Expiration
2044-07-25

Smart Images

  • Figure CN118537338B_ABST
    Figure CN118537338B_ABST
Patent Text Reader

Abstract

The present invention discloses a defect location method for a circuit board based on defect type guidance, the method comprising: constructing a defect location model, including a comprehensive encoder, a segmentation decoder, and a classification decoder; inputting a circuit board image into the comprehensive encoder to obtain a multi-scale comprehensive feature map; inputting the multi-scale comprehensive feature map into the segmentation decoder to obtain a defect location heat map; calculating local perception features based on the defect location heat map and the multi-scale comprehensive feature map and inputting the classification decoder to obtain a defect type probability vector; calculating a loss function based on the defect location heat map and the defect type probability vector, and optimizing the defect location model; and using the trained defect location model to locate circuit board defects. The present invention innovatively utilizes the idea of ​​multi-task learning, and uses the objective functions of defect location and classification to optimize the defect location model, so that it can extract features that are more discriminative of defect types, and achieve high-precision circuit board defect location.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of deep learning and computer vision, and in particular to a circuit board defect locating method based on defect type guidance. Background Art

[0002] Circuit board defect location technology is a technology that detects and identifies defects or fault points on electronic circuit boards. This technology is essential to ensure the reliability and performance of electronic equipment. In the electronics manufacturing industry, circuit boards are the heart of all electronic equipment, and their performance directly affects the stability and efficiency of the entire equipment. Therefore, efficiently and accurately locating defects on circuit boards has extremely high economic value and practical significance for improving product quality, reducing production costs, and avoiding later repairs. Circuit board defect location can not only help manufacturers discover problems in advance and prevent defective products from entering the market, but also quickly and accurately diagnose faults during product maintenance, greatly improving maintenance efficiency and service quality.

[0003] At present, the detection and location methods of circuit board defects mainly include visual inspection and electrical testing. Visual inspection relies on manual or automated optical systems, while electrical testing relies on technologies such as functional testing and simulation testing. However, these traditional methods often show limitations when dealing with complex or tiny defects, especially when dealing with high-density or multi-layer circuit boards, and their accuracy and efficiency often fail to meet the high standards of modern electronic manufacturing. With the advancement of machine vision and machine learning technologies, automated defect location methods based on these advanced technologies have begun to receive attention. These methods analyze the image data or electrical signals of the circuit board and use algorithms to automatically identify abnormal patterns, which not only improves the accuracy of detection, but also significantly improves the processing speed. Despite the use of advanced technologies, existing circuit board defect location methods still face some challenges, such as the need for high-precision identification and the complexity of large-scale data processing. How to design high-performance circuit board defect location algorithms is still a problem that the industry and academia need to overcome. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention discloses a circuit board defect location method based on defect type guidance. The defect type of the circuit board has a strong correlation with the defect area, and the known defect type can often greatly simplify the task of circuit board defect location. Experienced electronic engineers can quickly locate several possible defect points based on the defect type. Based on the above inspiration, the method innovatively utilizes the idea of ​​multi-task learning, and uses the objective functions of defect location and classification to optimize the defect location model, so that it can extract features with defect type discriminability and achieve high-precision circuit board defect location.

[0005] The object of the present invention is to achieve a circuit board defect location method based on defect type guidance through the following technical solution, the method comprising:

[0006] Step 1, construct a defect localization model, including a comprehensive encoder, a segmentation decoder, and a classification decoder;

[0007] Step 2, input the circuit board image into the comprehensive encoder to obtain a multi-scale comprehensive feature map;

[0008] Step 3: Input the multi-scale comprehensive feature map into the segmentation decoder to obtain the defect location heat map;

[0009] Step 4: Calculate the local perception features based on the defect location heat map and the multi-scale comprehensive feature map;

[0010] Step 5: Input the local perception features into the classification decoder to obtain the defect type probability vector;

[0011] Step 6, calculating the loss function according to the defect location heat map and the defect type probability vector, and optimizing the defect location model according to the loss function;

[0012] Step 7: Use the trained defect localization model to locate circuit board defects.

[0013] The step of inputting the circuit board image into the integrated encoder to obtain the integrated feature map comprises the following steps:

[0014] After scaling the circuit board image, input it into the U-Net encoder to obtain a multi-scale comprehensive feature map, which is expressed as:

[0015]

[0016] in, represents a multi-scale comprehensive feature map, Indicates a circuit board picture, is the scaling function, Indicates the circuit board picture Scale to height , width 3-channel image, and is a preset hyperparameter, indicating the size of the image, represents the U-Net encoder, Indicates Feature maps of different scales, is a preset hyperparameter, indicating the The number of feature channels of the feature map at each scale.

[0017] The step of inputting the multi-scale comprehensive feature map into the segmentation decoder to obtain the defect location heat map comprises the following steps:

[0018] Input the multi-scale comprehensive feature map into the U-Net decoder to obtain the defect location heat map, which is expressed as:

[0019]

[0020] in, represents the multi-scale comprehensive feature map, is the defect location heat map, represents the U-Net decoder, is the activation function, and is a preset hyperparameter, indicating the size of the image.

[0021] The method of calculating the local perception feature map based on the defect location heat map and the multi-scale comprehensive feature map includes the following steps:

[0022] Step 401, after scaling the defect location heat map, multiply it by elements with the feature maps of each scale to obtain the weighted feature maps of each scale, expressed as:

[0023] ;

[0024] in, Indicates The weighted feature map of scales, Indicates Feature maps of different scales, is a preset hyperparameter, indicating the The number of feature channels of the feature map at each scale, is the defect location heat map, is the scaling function, Indicates the defect location heat map Scale to height , width Pictures, represents element-wise multiplication, and is a preset hyperparameter;

[0025] Step 402, summing up the weighted feature maps of each scale to obtain the weighted features of each scale, expressed as:

[0026]

[0027] in, Indicates The weighted features of the scale, Indicates The weighted feature map of scales, express The element at row j and column k, and is a preset hyperparameter;

[0028] Step 403, concatenate the weighted features of each scale and input them into the fully connected layer to obtain the local perception feature, which is expressed as:

[0029] ;

[0030] in, represents the local perception feature, Indicates The weighted features of the scale, is a preset hyperparameter, indicating the The number of feature channels of the feature map at each scale, and is a learnable parameter, is the activation function.

[0031] The method of inputting the local perception features into the classification decoder to obtain the defect type probability vector comprises the following steps:

[0032] The local perception features are input into the fully connected layer to obtain the defect type probability vector, which is expressed as:

[0033]

[0034] in, represents the defect type probability vector, Indicates the number of defect type categories, represents the local perception feature, and is a learnable parameter, is the activation function.

[0035] The calculation of the loss function based on the defect location heat map and the defect type probability vector and the optimization of the defect location model based on the loss function include the following steps:

[0036] Step 601, calculate the segmentation loss function, the expression is:

[0037]

[0038] in, represents the segmentation loss function, is the defect location heat map, and is a preset hyperparameter, indicating the size of the image, express The element in row i and column j, represents the segmentation annotation graph, express The element in the i-th row and j-th column, if the pixel point corresponding to the i-th row and j-th column belongs to the defective area of ​​the circuit board, ,otherwise, ;

[0039] Step 602, calculate the classification loss function, the expression is:

[0040]

[0041] in, is the classification loss function, is the defect type probability vector, express The i-th element, Indicates the number of defect type categories, is the defect category label. If the circuit board defect type is the i-th defect, ,otherwise, ;

[0042] Step 603, calculate the final loss function, the expression is:

[0043]

[0044] in, is the loss function, represents the segmentation loss function, is the classification loss function, is a hyperparameter used to balance and .

[0045] Compared with the existing methods, the advantages of the method of the present invention are: the present technology provides a circuit board defect location method based on defect type guidance, the present method innovatively uses the idea of ​​multi-task learning, and uses the objective functions of defect location and classification to optimize the defect location model, so that it can extract features with defect type discriminability and achieve high-precision circuit board defect location. Compared with the existing methods, the present method adopts the idea of ​​multi-task learning, enhances the feature discriminability of the defect location model, and achieves higher-precision circuit board defect location. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A schematic diagram of a flow chart of an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0049] In this embodiment, it is assumed that we want to develop an automatic circuit board defect location system, and the core algorithm of the system uses the circuit board defect location method based on defect type guidance proposed by the present invention.

[0050] Therefore, if Figure 1 As shown, a circuit board defect location method based on defect type guidance includes:

[0051] Step 1, construct a defect localization model, including a comprehensive encoder, a segmentation decoder, and a classification decoder;

[0052] Step 2, input the circuit board image into the comprehensive encoder to obtain a multi-scale comprehensive feature map;

[0053] Step 3: Input the multi-scale comprehensive feature map into the segmentation decoder to obtain the defect location heat map;

[0054] Step 4: Calculate the local perception features based on the defect location heat map and the multi-scale comprehensive feature map;

[0055] Step 5: Input the local perception features into the classification decoder to obtain the defect type probability vector;

[0056] Step 6, calculating the loss function according to the defect location heat map and the defect type probability vector, and optimizing the defect location model according to the loss function;

[0057] Step 7: Use the trained defect localization model to locate circuit board defects.

[0058] The step of inputting the circuit board image into the integrated encoder to obtain the integrated feature map comprises the following steps:

[0059] After scaling the circuit board image, input it into the U-Net encoder to obtain a multi-scale comprehensive feature map, which is expressed as:

[0060]

[0061] in, represents a multi-scale comprehensive feature map, Indicates a circuit board picture, is the scaling function, Indicates the circuit board picture Scale to height , width 3-channel image, and is a preset hyperparameter, indicating the size of the image, represents the U-Net encoder, Indicates Feature maps of different scales, is a preset hyperparameter, indicating the The number of feature channels of the feature map at each scale.

[0062] Image resizing is a common operation in image processing, which is used to change the size of an image. The most commonly used image resizing algorithms are nearest neighbor interpolation and bilinear interpolation.

[0063] Nearest neighbor interpolation is one of the simplest scaling algorithms. Its basic principle is to find the closest source image pixel and directly copy its value for each pixel position in the target image. The algorithm steps are: 1) Calculate the corresponding position of each pixel in the target image in the source image. This is usually achieved by a scaling factor, that is, the target position multiplied by (source image size / target image size). 2) For each target pixel position, find the coordinates of the closest source image pixel (usually calculated by rounding). 3) Directly copy the color value of the nearest source pixel to the target pixel. Its advantages are simple and fast calculations, and its disadvantages are that the image may appear jagged and pixelated, especially in the enlargement operation.

[0064] Bilinear interpolation is more complex than nearest neighbor interpolation and provides a smoother image resetting effect. It calculates the value of the target pixel by taking a weighted average of the four nearest source pixels, with the weight based on the distance between the target pixel position and the source pixel position. The algorithm steps are: 1) Calculate the floating point coordinate position of each pixel in the target image in the source image. 2) Determine the four nearest integer pixel positions around this coordinate. 3) Calculate the weight based on the relative distance from the target pixel position to the four source pixel positions. The weight is inversely proportional to the distance, and the closer the distance, the greater the weight. 4) Calculate the value of the target pixel using a weighted average. Its advantage is that it can provide a smoother visual effect than nearest neighbor interpolation when the image is enlarged or reduced. The disadvantage is that the amount of calculation is larger than the nearest neighbor interpolation, especially when processing large images.

[0065] The step of inputting the multi-scale comprehensive feature map into the segmentation decoder to obtain the defect location heat map comprises the following steps:

[0066] Input the multi-scale comprehensive feature map into the U-Net decoder to obtain the defect location heat map, which is expressed as:

[0067]

[0068] in, represents the multi-scale comprehensive feature map, is the defect location heat map, represents the U-Net decoder, is the activation function, and is a preset hyperparameter, indicating the size of the image.

[0069] U-Net is a well-known convolutional neural network (CNN) architecture, which is mainly used for image segmentation tasks, especially medical image segmentation. This model was first proposed in 2015. The design concept of U-Net is to make full use of the limited amount of image data, improve performance through data enhancement, and accurately classify images at the pixel level.

[0070] The structure of U-Net is U-shaped, consisting of a contracting path (encoder) and an expanding path (decoder). The encoder gradually reduces the spatial dimensions through convolutional layers and pooling layers to capture the image content; the decoder gradually restores the spatial dimensions and detailed information of the image through upsampling and convolutional layers. The skip connection between the encoder and decoder can directly connect the feature map of the encoder stage with the corresponding feature map of the decoder stage. This design helps to recover fine details in the output.

[0071] The method of calculating the local perception feature map based on the defect location heat map and the multi-scale comprehensive feature map includes the following steps:

[0072] Step 401, after scaling the defect location heat map, multiply it by elements with the feature maps of each scale to obtain the weighted feature maps of each scale, expressed as:

[0073]

[0074] in, Indicates The weighted feature map of scales, Indicates Feature maps of different scales, is a preset hyperparameter, indicating the The number of feature channels of the feature map at each scale, is the defect location heat map, is the scaling function, Indicates the defect location heat map Scale to height , width Pictures, represents element-wise multiplication, and is a preset hyperparameter;

[0075] Step 402, summing up the weighted feature maps of each scale to obtain the weighted features of each scale, expressed as:

[0076]

[0077] in, Indicates The weighted features of the scale, Indicates The weighted feature map of scales, express The element at row j and column k, and is a preset hyperparameter;

[0078] Step 403, concatenate the weighted features of each scale and input them into the fully connected layer to obtain the local perception feature, which is expressed as:

[0079]

[0080] in, represents the local perception feature, Indicates The weighted features of the scale, is a preset hyperparameter, indicating the The number of feature channels of the feature map at each scale, and is a learnable parameter, is the activation function.

[0081] The method of inputting the local perception features into the classification decoder to obtain the defect type probability vector comprises the following steps:

[0082] The local perception features are input into the fully connected layer to obtain the defect type probability vector, which is expressed as:

[0083]

[0084] in, represents the defect type probability vector, Indicates the number of defect type categories, represents the local perception feature, and is a learnable parameter, is the activation function.

[0085] The calculation of the loss function based on the defect location heat map and the defect type probability vector and the optimization of the defect location model based on the loss function include the following steps:

[0086] Step 601, calculate the segmentation loss function, the expression is:

[0087]

[0088] in, represents the segmentation loss function, is the defect location heat map, and is a preset hyperparameter, indicating the size of the image, express The element in row i and column j, represents the segmentation annotation graph, express The element in the i-th row and j-th column, if the pixel point corresponding to the i-th row and j-th column belongs to the defective area of ​​the circuit board, ,otherwise, ;

[0089] Step 602, calculate the classification loss function, the expression is:

[0090]

[0091] in, is the classification loss function, is the defect type probability vector, express The i-th element, Indicates the number of defect type categories, is the defect category label. If the circuit board defect type is the i-th defect, ,otherwise, ;

[0092] Step 603, calculate the final loss function, the expression is:

[0093]

[0094] in, is the loss function, represents the segmentation loss function, is the classification loss function, is a hyperparameter used to balance and .

[0095] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

Claims

1. A circuit board defect location method based on defect type guidance, characterized in that: The method comprises: Step 1, construct a defect localization model, including a comprehensive encoder, a segmentation decoder, and a classification decoder; Step 2, input the circuit board image into the comprehensive encoder to obtain a multi-scale comprehensive feature map; Step 3: Input the multi-scale comprehensive feature map into the segmentation decoder to obtain the defect location heat map; Step 4: Calculate the local perception features based on the defect location heat map and the multi-scale comprehensive feature map; Step 5: Input the local perception features into the classification decoder to obtain the defect type probability vector; Step 6, calculating the loss function according to the defect location heat map and the defect type probability vector, and optimizing the defect location model according to the loss function; Step 7, using the trained defect location model to locate circuit board defects; The step of inputting the circuit board image into the integrated encoder to obtain the integrated feature map comprises the following steps: After scaling the circuit board image, input it into the U-Net encoder to obtain a multi-scale comprehensive feature map, which is expressed as: ; in, represents a multi-scale comprehensive feature map, Indicates a circuit board picture, is the scaling function, Indicates the circuit board picture Scale to height , width 3-channel image, and is a preset hyperparameter, indicating the size of the image, represents the U-Net encoder, Indicates Feature maps of different scales, is a preset hyperparameter, indicating the The number of feature channels of the feature map at each scale; The step of inputting the multi-scale comprehensive feature map into the segmentation decoder to obtain the defect location heat map comprises the following steps: Input the multi-scale comprehensive feature map into the U-Net decoder to obtain the defect location heat map, which is expressed as: ; in, is the defect location heat map, represents the U-Net decoder, is the activation function; The method of calculating the local perception feature map based on the defect location heat map and the multi-scale comprehensive feature map includes the following steps: Step 401, after scaling the defect location heat map, multiply it by elements with the feature maps of each scale to obtain the weighted feature maps of each scale, expressed as: ; in, Indicates The weighted feature map of scales, is the scaling function, Indicates the defect location heat map Scale to height , width Pictures, It means element-wise multiplication; Step 402, summing up the weighted feature maps of each scale to obtain the weighted features of each scale, expressed as: ; in, Indicates The weighted features of the scale, express The element at row j and column k; Step 403, concatenate the weighted features of each scale and input them into the fully connected layer to obtain the local perception feature, which is expressed as: ; in, represents the local perception feature, and is a learnable parameter, is the activation function.

2. The circuit board defect location method based on defect type guidance according to claim 1 is characterized in that: The method of inputting the local perception features into the classification decoder to obtain the defect type probability vector comprises the following steps: The local perception features are input into the fully connected layer to obtain the defect type probability vector, which is expressed as: ; in, represents the defect type probability vector, Indicates the number of defect type categories, and is a learnable parameter.

3. The circuit board defect location method based on defect type guidance according to claim 2 is characterized in that: The calculation of the loss function based on the defect location heat map and the defect type probability vector and the optimization of the defect location model based on the loss function include the following steps: Step 601, calculate the segmentation loss function, the expression is: ; in, represents the segmentation loss function, express The element in row i and column j, represents the segmentation annotation graph, express The element in the i-th row and j-th column, if the pixel point corresponding to the i-th row and j-th column belongs to the defective area of ​​the circuit board, ,otherwise, ; Step 602, calculate the classification loss function, the expression is: ; in, is the classification loss function, is the defect type probability vector, express The i-th element, is the defect category label. If the circuit board defect type is the i-th defect, ,otherwise, ; Step 603, calculate the final loss function, the expression is: ; in, is the loss function, represents the segmentation loss function, is the classification loss function, is a hyperparameter used to balance and .