PCB board glue coating area detection method, system and storage medium
Through the improved DeepLabV3+ neural network combining semantic segmentation and horizontal set segmentation, the problems of traditional manual detection are solved, and the precise detection of the glue coating area of the PCB board is realized, improving the detection accuracy and efficiency.
Patent Information
- Application Number
- CN202411557742.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-04
AI Technical Summary
Traditional artificial visual inspection is used for PCB board glue quality inspection, which has problems such as inefficiency, fatigue and high cost, and is difficult to meet the requirements of modern industrial production for high efficiency and high precision.
The improved DeepLabV3+ neural network combines semantic segmentation and horizontal set segmentation to achieve accurate detection of the glue coating area of PCB board. The improved hollow space pyramid pooling module and the convolution improved attention module are used to extract multi-scale features, and the deep learning model provides better initial conditions, horizontal set function optimization and adjustment of boundaries to achieve the final segmentation goal.
Accurate detection of the glue coating area of PCB board, improve the accuracy and robustness of the detection, reduce the possibility of over-segment or under-segment, improve the detection efficiency, and meet the high efficiency and high precision of modern industrial production. Require.
Smart Images

Figure CN119048523B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of automatic detection, and the invention relates to a method, a system and a storage medium for detecting a glue coating area of a PCB board. Background Art
[0002] With the rapid development of the electronics manufacturing industry, the quality of printed circuit boards (PCBs), as the core components of electronic products, directly affects the performance and reliability of the entire device. In order to enhance the durability, protection and moisture resistance of PCBs, coating with conformal coating has become an indispensable part of the PCB manufacturing process. Therefore, the effectiveness of conformal coating directly affects the overall performance of PCBs. This makes the gluing inspection of PCBs an indispensable part of the industry. Traditional gluing quality inspection mainly relies on manual visual inspection, which has many problems such as low efficiency, easy fatigue, and high cost, and it is difficult to meet the strict requirements of modern industrial production for high efficiency and high precision. Therefore, there is an urgent need for highly intelligent automatic detection methods to improve the shortcomings of traditional manual detection. Summary of the invention
[0003] The purpose of the present invention is to provide a method, system and storage medium for detecting the glue coating area of a PCB board. The semantic segmentation of the glue coating area is realized by an improved DeepLabV3+ neural network. A combination of semantic segmentation and level set segmentation is adopted to achieve the task of accurate segmentation of the image, and an accurate glue coating area can be obtained, thereby achieving the purpose of intelligent detection of the glue coating area.
[0004] The technical solution to achieve the purpose of the present invention is:
[0005] A method for detecting a glue coating area of a PCB board comprises the following steps:
[0006] S01: Acquire an image containing a PCB board and perform preprocessing;
[0007] S02: Use the improved DeepLabV3+ neural network to process the image to obtain preliminary segmentation results and initial contours; the improved DeepLabV3+ neural network improves the encoder of the DeepLabV3+ neural network, and the encoder part adopts an improved dilated spatial pyramid pooling module, which includes a convolution layer, multiple dilated convolution layers and a pooling layer. The output and input of the convolution layer are fused channel by channel and then input into the previous dilated convolution layer. The output and input of the previous dilated convolution layer are fused channel by channel and then input into the next dilated convolution layer. The features are fused with the shallow features after the dilated convolution.
[0008] S03: Use the initial contour as the initial edge of the level set function, optimize and adjust the boundary through the level set function, and obtain the final segmentation target.
[0009] In the preferred technical solution, the encoder part of the improved DeepLabV3+ neural network in step S02 uses the backbone network to perform multi-scale feature extraction, and then fuses the feature maps of the improved void space pyramid pooling module and the convolution improved attention module, and then extracts features through the convolution module to obtain the feature map of the encoding part. The decoder part upsamples the feature map of the encoding part by 4 times and then fuses the features with the backbone network after convolution processing. The fused features are convolved and upsampled four times to the original input image size to complete the model prediction.
[0010] In the preferred technical solution, the convolution improved attention module includes an improved atrous spatial pyramid pooling module, and the output of the improved atrous spatial pyramid pooling module is fused channel by channel with the input, and then the output is output after element-by-element multiplication between the convolution module and the input of the improved atrous spatial pyramid pooling module.
[0011] In the preferred technical solution, the improved atrous spatial pyramid pooling module has 4 atrous convolutional layers, and the expansion rates are 4, 8, 12 and 16 respectively.
[0012] In the preferred technical solution, the pre-processing method in step S01 includes:
[0013] Locate the PCB board through the landmark points, segment the PCB board image from the acquired image and transform it to a resolution consistent with the target template;
[0014] Correct the distortion of PCB board images;
[0015] Perform affine transformation or perspective transformation on the distortion-corrected PCB board image to achieve matching with the glue-coated area in the standard template.
[0016] In the preferred technical solution, the method of optimizing and adjusting the boundary by the level set function in step S03 includes:
[0017] Construct an energy function and transform the image segmentation task into an energy minimization problem through the energy function. The energy function is:
[0018]
[0019] Where C is a closed curve on the image, inside(C) and outside(C) are the area inside and outside the curve, and C1 and C2 are the average values of the pixels inside and outside the curve. and are the two parts of the energy function, which are used to quantify the difference between the inside and outside of the closed curve, Indicates that the image is at position The grayscale value or pixel value.
[0020] Supplementing the regularization terms on edge length and area yields the following energy functional:
[0021]
[0022] in, and They are the control edge length terms and the area term The weight parameter, and For internal area energy and external area energy The weight of
[0023] Introducing the level set function , with the target area For the peak, is the image area to be segmented, the background area is a valley, and its contour line with a relief of 0 is the edge , to replace the evolution curve:
[0024]
[0025] Introducing the step function :
[0026]
[0027] Substituting into the energy functional we get:
[0028]
[0029]
[0030]
[0031]
[0032] The edge is adjusted and fitted by repeatedly iterating the level set function to obtain the final segmentation target.
[0033] The present invention also discloses a PCB board glue coating area detection system, comprising:
[0034] An image preprocessing module is used to obtain an image containing a PCB board and perform preprocessing;
[0035] The glued area semantic segmentation module uses the improved DeepLabV3+ neural network to process the image and obtain the preliminary segmentation result and the initial contour; the improved DeepLabV3+ neural network improves the encoder of the DeepLabV3+ neural network, and the encoder part adopts the improved void space pyramid pooling module, which includes a convolution layer, multiple void convolution layers and a pooling layer. The output and input of the convolution layer are fused channel by channel and then input into the previous void convolution layer. The output and input of the previous void convolution layer are fused channel by channel and then input into the next void convolution layer. The features are fused with the shallow features after the void convolution.
[0036] The glued area optimization module takes the initial contour as the initial edge of the level set function, optimizes and adjusts the boundary through the level set function, and obtains the final segmentation target.
[0037] In the preferred technical solution, the encoder part of the improved DeepLabV3+ neural network in the glued area semantic segmentation module uses the backbone network for multi-scale feature extraction, and then fuses the feature maps of the improved void space pyramid pooling module and the convolution improved attention module, and then extracts features through the convolution module to obtain the feature map of the encoding part. The decoder part upsamples the feature map of the encoding part by 4 times and then fuses the features with the backbone network after convolution processing. The fused features are convolved and upsampled four times to the original input image size to complete the model prediction.
[0038] In the preferred technical solution, the convolution improved attention module includes an improved atrous spatial pyramid pooling module, and the output of the improved atrous spatial pyramid pooling module is fused channel by channel with the input, and then the output is output after element-by-element multiplication between the convolution module and the input of the improved atrous spatial pyramid pooling module.
[0039] The present invention further discloses a computer storage medium on which a computer program is stored. When the computer program is executed, the above-mentioned PCB board glue coating area detection method is implemented.
[0040] Compared with the prior art, the present invention has the following significant advantages:
[0041] The combination of semantic segmentation and level set segmentation is used to achieve the task of accurate image segmentation. First, the image is processed using the improved DeepLabV3+ model to obtain preliminary segmentation results and initial contours. The improved atrous pyramid pooling (IASPP) is designed to help expand the receptive field. Through the fusion of feature layers, the common use of information between each branch is achieved. The enhanced feature layer of IASPP also achieves interdependence, which helps to provide a wider receptive field for the model and better utilize the input information. The initial contour obtained here is used as the initial edge of the level set function, and the boundary is optimized and adjusted through the level set algorithm to achieve the final segmentation goal. Compared with the traditional level set segmentation method, this method of combining deep learning and level set segmentation reduces the possibility of over-segmentation or under-segmentation and improves the accuracy and robustness of segmentation. Since the deep learning model can provide better initial conditions, the level set function can often converge to the final segmentation result faster, thereby improving the efficiency of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a flow chart of a method for detecting the glue coating area of a PCB board in a preferred embodiment;
[0043] Figure 2 This is a diagram of the improved DeepLabV3+ neural network architecture of this embodiment;
[0044] Figure 3 Schematic diagram of improving the atrous spatial pyramid pooling module;
[0045] Figure 4 Schematic diagram of improving the attention module for convolution;
[0046] Figure 5 These are images collected under normal lighting;
[0047] Figure 6 This is an image collected under ultraviolet light;
[0048] Figure 7 is the template image;
[0049] Figure 8 This is the extracted image of the PCB board;
[0050] Fig. 9 Image comparison before and after image preprocessing;
[0051] Fig.10 This is a schematic diagram of the automated inspection process for the PCB board glue coating area inspection system. DETAILED DESCRIPTION
[0052] The principle of the present invention is: a combination of semantic segmentation and level set segmentation is used to achieve the task of accurate image segmentation. First, the image is processed using the improved DeepLabV3+ model to obtain preliminary segmentation results and initial contours. The improved atrous pyramid pool (IASPP) is designed to help expand the receptive field. Through the fusion of feature layers, the common use of information between each branch is achieved. The enhanced feature layer of IASPP also achieves interdependence, which helps to provide a wider receptive field for the model and better utilize the input information. The deep learning model can provide better initial conditions, and the level set function can often converge to the final segmentation result faster, thereby improving the efficiency of the algorithm.
[0053] Embodiment 1:
[0054] like Figure 1 As shown, a method for detecting the glue coating area of a PCB board comprises the following steps:
[0055] S01: Acquire an image containing a PCB board and perform preprocessing;
[0056] S02: Use the improved DeepLabV3+ neural network to process the image and obtain preliminary segmentation results and initial contours; the improved DeepLabV3+ neural network improves the encoder of the DeepLabV3+ neural network, such as Figure 3 As shown, the encoder part adopts an improved atrous spatial pyramid pooling module, which includes a convolution layer, multiple atrous convolution layers and a pooling layer. The output and input of the convolution layer are fused channel by channel and then input into the previous atrous convolution layer. The output and input of the previous atrous convolution layer are fused channel by channel and then input into the next atrous convolution layer. The features are fused with the shallow features after the atrous convolution.
[0057] S03: Use the initial contour as the initial edge of the level set function, optimize and adjust the boundary through the level set function, and obtain the final segmentation target.
[0058] In a preferred embodiment, the pre-processing method in step S01 includes:
[0059] Locate the PCB board through the landmark points, segment the PCB board image from the acquired image and transform it to a resolution consistent with the target template;
[0060] Correct the distortion of PCB board images;
[0061] Perform affine transformation or perspective transformation on the distortion-corrected PCB board image to achieve matching with the glue-coated area in the standard template.
[0062] In a preferred embodiment, Figure 2As shown, the encoder part of the improved DeepLabV3+ neural network in step S02 uses the backbone network for multi-scale feature extraction, and then fuses the feature maps of the improved void space pyramid pooling module and the convolution improved attention module, and then extracts features through the convolution module to obtain the feature map of the encoding part. The decoder part upsamples the feature map of the encoding part by 4 times and then fuses the features with the backbone network after convolution processing. The fused features are convolved and upsampled four times to the original input image size to complete the model prediction.
[0063] In a preferred embodiment, Figure 4 As shown, the convolution improved attention module includes an improved atrous spatial pyramid pooling module. The output of the improved atrous spatial pyramid pooling module is fused channel by channel with the input, and then the output is output after element-by-element multiplication between the convolution module and the input of the improved atrous spatial pyramid pooling module.
[0064] In a preferred embodiment, the method of optimizing and adjusting the boundary by the level set function in step S03 includes:
[0065] Construct an energy function and transform the image segmentation task into an energy minimization problem through the energy function. The energy function is:
[0066]
[0067] Where C is a closed curve on the image, inside(C) and outside(C) are the areas inside and outside the curve, and C1 and C2 are the average values of the pixels inside and outside the curve. and are the two parts of the energy function, which are used to quantify the difference between the inside and outside of the closed curve, Indicates that the image is at position The grayscale value or pixel value.
[0068] Supplementing the regularization terms on edge length and area yields the following energy functional:
[0069]
[0070] in, and They are the control edge length terms and the area term The weight parameter, and For internal area energy and external area energy The weight of
[0071] Introducing the level set function , with the target area For the peak, is the image area to be segmented, the background area is a valley, and its contour line with a relief of 0 is the edge , to replace the evolution curve, and perform segmentation, boundary detection and other operations through the evolution of this function:
[0072]
[0073] Introducing the step function :
[0074]
[0075] Substituting into the energy functional we get:
[0076]
[0077]
[0078]
[0079]
[0080] The edge is adjusted and fitted by repeatedly iterating the level set function to obtain the final segmentation target.
[0081] In another embodiment, a computer storage medium stores a computer program, and when the computer program is executed, the above-mentioned PCB board glue coating area detection method is implemented. The above detection method is adopted and will not be described in detail here.
[0082] In another embodiment, a PCB board glue coating area detection system includes:
[0083] An image preprocessing module is used to obtain an image containing a PCB board and perform preprocessing;
[0084] The glued area semantic segmentation module uses the improved DeepLabV3+ neural network to process the image and obtain the preliminary segmentation result and the initial contour; the improved DeepLabV3+ neural network improves the encoder of the DeepLabV3+ neural network, and the encoder part adopts the improved void space pyramid pooling module, which includes a convolution layer, multiple void convolution layers and a pooling layer. The output and input of the convolution layer are fused channel by channel and then input into the previous void convolution layer. The output and input of the previous void convolution layer are fused channel by channel and then input into the next void convolution layer. The features are fused with the shallow features after the void convolution.
[0085] The glued area optimization module takes the initial contour as the initial edge of the level set function, optimizes and adjusts the boundary through the level set function, and obtains the final segmentation target.
[0086] Specifically, the working process of the PCB board glue coating area detection system is described as follows by taking a preferred embodiment as an example:
[0087] like Fig.10 As shown, the following steps are included:
[0088] 1. Use an industrial camera to obtain images of PCB boards and perform preprocessing.
[0089] 2. Use the improved DeepLabV3+ neural network to perform semantic segmentation on the image and preliminarily identify the glue-coated area.
[0090] 3. The output of the neural network is used as the initial contour of the level set algorithm to further optimize the recognition of the glued area.
[0091] 4. Display test results through the user interface, and manage test records and configuration information.
[0092] 1. Obtain images of PCB boards through industrial cameras and perform preprocessing
[0093] PCB board image acquisition includes PCB board area acquisition, extraction and correction. In order to effectively obtain the glue coating area, the PCB board must first be segmented from the captured image and transformed to a resolution consistent with the target template to accurately calculate the effective coverage and deviation. In this system, the PCB board area extraction uses a template matching algorithm to locate the PCB board through the landmark points, and then segment the PCB board from the acquired image.
[0094] Template matching algorithm uses the grayscale statistics of images to measure the similarity between images. Among them, cross-correlation registration is the most basic registration method based on grayscale statistics. In cross-correlation registration, the position with the largest cross-correlation coefficient is considered to be the corresponding position in the reference image and the image to be matched. Suppose the standard reference image , the size is , image to be matched , the size is .
[0095] The calculation formula of the mutual correlation coefficient R is as follows:
[0096]
[0097] In the formula and Respectively and The mean of .
[0098] After the PCB board is obtained from the image, it needs to be corrected, including image de-distortion processing and affine transformation processing for the purpose of de-distortion.
[0099] Image distortion correction includes radial distortion and tangential distortion. Radial distortion originates from the inherent optical properties of the convex lens or concave lens combination used in real lenses, which causes the real coordinate points to shift along the radial direction of the image plane. In contrast, tangential distortion deforms the image pixels along the tangent direction, such as transforming a rectangular image into a trapezoid. Based on the Taylor series definition, and taking into account that the lens will not produce distortion at the distortion center, and the symmetric characteristics of radial distortion along the distortion center, the mathematical model of radial distortion is:
[0100]
[0101] In the formula, r is the ideal distance from the pixel to the origin, (x, y) is the original coordinate of the distorted point in the image, that is, , ( , ) are the coordinates of the image after correction; k, k2,…, kn represent the unknown coefficients of radial distortion.
[0102] The radial distortion can be calibrated by Zhang Zhengyou to obtain coefficients k, k2,…, kn, and the image correction task can be completed. After correction, the PCB board needs to be affine transformed or perspective transformed to match the glue-coated area in the standard template, and then determine whether the glue is accurately coated.
[0103] Affine transformation includes translation, rotation, scaling, etc., and then the transformed image is mapped back to the original coordinate system.
[0104] The perspective transformation method maps the original image into a three-dimensional space, then transforms it in this three-dimensional space, and finally uses the perspective effect to project the three-dimensional scene onto a two-dimensional image. It can be expressed as a homogeneous transformation matrix multiplied by the homogeneous coordinates of the point in the camera coordinate system.
[0105] System implementation:
[0106] First, read the images taken by the camera into the system. The system will read three images at this time, which are images under normal lighting, such as Figure 5 As shown, the image under UV light (such as Figure 6 ) and the template image (as shown Figure 7 as shown).
[0107] The UV image and the image under normal light are respectively imported into the lens distortion correction function. The image will be corrected according to the camera internal and external parameter matrix read. The corrected image will be slightly deformed to eliminate the influence of the lens. The corrected image will be segmented by the designated ROI area, such as Figure 8 As shown, the area where the PCB board is located is extracted to reduce the amount of calculation for subsequent processing.
[0108] The same operation will be performed on the image under UV light. At this time, the mark point template is input again, and the system will identify the mark point in the specified area according to the configuration settings and obtain the mark point position.
[0109] After obtaining the position, the image is transformed by affine transformation or perspective transformation according to the number of identified points to transform the PCB board into the specified shape. The resolution of the transformed image is consistent with the template image and the corresponding pixels will correspond one to one, such as Fig. 9 shown.
[0110] 2. Use the improved DeepLabV3+ neural network to perform semantic segmentation on the image and preliminarily identify the glue-coated area.
[0111] Based on deeplabV3+, the backbone network (DCNN) uses MobileNetv2 for preliminary multi-scale feature extraction, and then fuses the feature maps of the improved atrous space pyramid pooling module (IASPP) and the convolutional improved attention-based spatial pyramid pooling module (CIASPP). Then, the features are extracted through 1×1 convolution (Conv1×1) to finally obtain the feature map of the encoding part. The decoder part upsamples the feature map by 4 times and then fuses the feature map with the backbone network (MobileNetv2) through 1×1 convolution (Conv1×1). The fused features are convolved (Conv1×1) and four times upsampled to the original input image size to complete the model prediction.
[0112] MobileNet v2 uses reverse residual blocks, and the number of network channels in the reverse residual blocks increases first and then decreases. The use of standard convolutional layers in classic residual networks will face a huge amount of calculation when involving 3x3conv, while MobileNetv2 can increase the number of channels first after using reverse residual blocks to obtain more features; at the same time, when encountering 3x3conv, since they are all depth-separable convolutions, the amount of calculation can be guaranteed not to be too large.
[0113] like Figure 3As shown in the figure, IASPP includes 4 atrous convolutions (ACs). IASPP fuses the feature layer in the original ASPP structure with the shallow features after atrous convolution to expand the receptive field of model learning. The original convolution in this module is rewritten as a depth-wise separable convolution with a dilation rate to reduce the computational burden. Compared with the original dilation rates of 6, 12, and 18, since large strides will destroy the extraction of small targets, the dilation rates are adjusted to 4, 8, 12, and 16, and the dilation rate step size is reduced to minimize the features lost by small targets.
[0114] Figure 3 Here r represents the dilation rate, and ⊕ represents channel-by-channel fusion.
[0115] like Figure 4 As shown in Figure 1, this paper uses the IASPP module as the multi-branch deep convolution of the CIASPP module. The fused feature map in CIASPP is weighted (i.e., element-by-element multiplication) with the first input feature map through a 1×1 convolution (Conv1×1) and then output. is an element-by-element matrix multiplication operation.
[0116] The neural network designed in the previous article is used to build the network. After the construction is completed, the actual data set is used for training. The image processing method is used to create a training data set, which is the image of the PCB board under ultraviolet light.
[0117] The PCB board images are processed by threshold segmentation and image software to obtain and save the label image of the data set. The background pixels in the label image are 0, and the pixels in the glue area are 1.
[0118] After the data set is created, the designed network is trained using the data set. In this process, the mixed precision training technology is used to accelerate the training of deep neural networks. After continuous training, the error of the neural network on the test set is less than 5%.
[0119] The ultraviolet light image used for the test is imported into the trained neural network for recognition, and the recognized image is compared with the original image.
[0120] Third, the output of the neural network is used as the initial contour of the level set algorithm to further optimize the recognition of the glue-coated area.
[0121] The key to the level set algorithm is to construct an energy function, which transforms the image segmentation task into an energy minimization problem. The function is composed of multiple factors that affect the segmentation result, including the characteristics of the image, the shape of the segmentation boundary, and the smoothness of the segmented area.
[0122] This system uses the Chan-Vese model, and the region-based active contour model represented by it aims to evolve a specific region with the target curve as the boundary.
[0123] Energy term:
[0124]
[0125] Define the energy terms as above, let C be a closed curve on the image, inside(C) and outside(C) be the area inside and outside the curve, C1 and C2 be the average values of the pixels inside and outside the curve, and are the two parts of the energy function, Indicates that the image is at position Grayscale value or pixel value. At this time, assuming that there are only two pixel values in the image, the target area and the background, at this time, if and only if the closed curve is the edge of the image, the pixel value of the point inside the curve is the same as the average value of the curve, and the equation takes the minimum value of 0.
[0126] After adding regularization items about edge length and area, the energy functional is obtained in the following form:
[0127]
[0128] in, 、 They represent the weight parameters for controlling edge length and area respectively. The choice of these parameters directly affects the model's preference for edges and areas. and The weights used for internal and external energy terms, respectively, further adjust the influencing factors of the energy functional.
[0129] Introducing the level set function , with the target area is the peak, background area is a valley, and its contour line with a relief of 0 is the edge , in order to replace the evolution curve, segmentation, boundary detection and other operations are performed through the evolution of this function.
[0130]
[0131] Introducing the step function :
[0132]
[0133] After entering the energy functional, we get:
[0134]
[0135]
[0136]
[0137]
[0138] The edge is adjusted and fitted by repeatedly iterating the level set function to obtain the final segmentation target.
[0139] The detection results are displayed through the user interface, and the test records and configuration information are managed. The image area is screened by combining the secondary information, which will greatly improve the accuracy of the recognition results.
[0140] After obtaining the final recognition image, the saved template information will be read to extract and analyze each area of the image. Since the recognition image has a one-to-one correspondence with the template image, each area on the recognition image will be taken out to count the presence and proportion of the glued area, and the recognition result will be returned.
[0141] In this system, a combination of semantic segmentation and level set segmentation is used to achieve accurate image segmentation tasks. First, the image is processed using the improved DeepLabV3+ model to obtain preliminary segmentation results and initial contours. The initial contours obtained here are used as the initial edges of the level set function, and the boundaries are optimized and adjusted through the level set algorithm to achieve the final segmentation goal. Compared with the traditional level set segmentation method, this method that combines deep learning and level set segmentation reduces the possibility of over-segmentation or under-segmentation. Since the deep learning model can provide better initial conditions, the level set function can often converge to the final segmentation result faster, thereby improving the efficiency of the algorithm.
[0142] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications made without departing from the spirit and principles of the present invention shall be equivalent replacement modes and shall be included in the protection scope of the present invention.
Claims
1. A method for detecting the glue coating area of a PCB board, characterized in that: The following steps are involved: S01: Acquire an image containing a PCB board and perform preprocessing; S02: Use the improved DeepLabV3+ neural network to process the image and obtain the preliminary segmentation results and initial contours; The improved DeepLabV3+ neural network improves the encoder of the DeepLabV3+ neural network. The encoder part adopts an improved dilated space pyramid pooling module. The improved dilated space pyramid pooling module includes a convolution layer, multiple dilated convolution layers and a pooling layer. The output and input of the convolution layer are fused channel by channel and then input into the previous dilated convolution layer. The output and input of the previous dilated convolution layer are fused channel by channel and then input into the next dilated convolution layer. The features are fused with shallow features after dilated convolution. The encoder part of the improved DeepLabV3+ neural network uses a backbone network to extract multi-scale features, and then fuses the feature maps of the improved dilated space pyramid pooling module and the convolution improved attention module, and then extracts features through the convolution module to obtain the feature map of the encoding part. The decoder part upsamples the feature map of the encoding part and fuses the features with the backbone network after convolution processing. The fused features are convolved and upsampled to the original input image size to complete the model prediction. The convolution improved attention module includes an improved dilated space pyramid pooling module. S03: Use the initial contour as the initial edge of the level set function, optimize and adjust the boundary through the level set function, and obtain the final segmentation target.
2. The method for detecting the glue coating area of a PCB board according to claim 1, characterized in that: The output of the improved atrous spatial pyramid pooling module of the convolution improved attention module is fused with the input channel by channel, and then the output is output after element-by-element multiplication between the convolution module and the input of the improved atrous spatial pyramid pooling module.
3. The method for detecting the glue coating area of a PCB board according to claim 1, characterized in that: The improved atrous spatial pyramid pooling module has four atrous convolutional layers, and the dilation rates are 4, 8, 12, and 16, respectively.
4. The method for detecting the glue coating area of a PCB board according to claim 1, characterized in that: Step S01: the pre-processing method comprises: Locate the PCB board through the landmark points, segment the PCB board image from the acquired image and transform it to a resolution consistent with the target template; Correct the distortion of PCB board images; Perform affine transformation or perspective transformation on the distortion-corrected PCB board image to achieve matching with the glue-coated area in the standard template.
5. The method for detecting the glue coating area of a PCB board according to claim 1, characterized in that: The method of optimizing and adjusting the boundary by the level set function in step S03 includes: Construct an energy function and transform the image segmentation task into an energy minimization problem through the energy function. The energy function is: ; Where C is a closed curve on the image, inside(C) and outside(C) are the area inside and outside the curve, and C1 and C2 are the average values of the pixels inside and outside the curve. and are the two parts of the energy function, which are used to quantify the difference between the inside and outside of the closed curve, Indicates that the image is at position Grayscale value or pixel value; Supplementing the regularization terms on edge length and area yields the following energy functional: ; in, and They are the control edge length terms and the area term The weight parameter, and For internal area energy and external area energy The weight of Introducing the level set function , with the target area For the peak, is the image area to be segmented, the background area is a valley, and its contour line with a relief of 0 is the edge , to replace the evolution curve: ; Introducing the step function : ; Substituting into the energy functional we get: ; ; ; ; The edge is adjusted and fitted by repeatedly iterating the level set function to obtain the final segmentation target.
6. A PCB board glue coating area detection system, characterized in that: include: An image preprocessing module is used to obtain an image containing a PCB board and perform preprocessing; The glue-coated area semantic segmentation module uses the improved DeepLabV3+ neural network to process the image and obtain the preliminary segmentation results and initial contours; The improved DeepLabV3+ neural network improves the encoder of the DeepLabV3+ neural network. The encoder part adopts an improved dilated space pyramid pooling module. The improved dilated space pyramid pooling module includes a convolution layer, multiple dilated convolution layers and a pooling layer. The output and input of the convolution layer are fused channel by channel and then input into the previous dilated convolution layer. The output and input of the previous dilated convolution layer are fused channel by channel and then input into the next dilated convolution layer. The features are fused with shallow features after dilated convolution. The encoder part of the improved DeepLabV3+ neural network uses a backbone network to extract multi-scale features, and then fuses the feature maps of the improved dilated space pyramid pooling module and the convolution improved attention module, and then extracts features through the convolution module to obtain the feature map of the encoding part. The decoder part upsamples the feature map of the encoding part and fuses the features with the backbone network after convolution processing. The fused features are convolved and upsampled to the original input image size to complete the model prediction. The convolution improved attention module includes an improved dilated space pyramid pooling module. The glued area optimization module takes the initial contour as the initial edge of the level set function, optimizes and adjusts the boundary through the level set function, and obtains the final segmentation target.
7. The PCB board glue coating area detection system according to claim 6, characterized in that: The output of the improved atrous spatial pyramid pooling module of the convolution improved attention module is fused with the input channel by channel, and then the output is output after element-by-element multiplication between the convolution module and the input of the improved atrous spatial pyramid pooling module.
8. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the method for detecting the glue coating area of a PCB board according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Nematode image segmentation method and system based on deep learning and iterative feature fusion
CN115830316A
Timber area segmentation method and system and storage medium
CN117853725A