A PCB board defect detection method and visual sorting method
Through deep learning technology, the backbone feature extraction networks S-Backbone and Neck network are used to detect defects on PCB board images, solving the problems of low detection efficiency and low accuracy in the prior art, and achieving efficient and accurate defect recognition and automatic sorting.
Patent Information
- Application Number
- CN202411364203.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-28
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-09-28
AI Technical Summary
The prior art has problems in PCB board defect detection with low detection efficiency and low detection accuracy, especially because the defects are small in the image and are similar to the non-defective part, which makes detection difficult.
The backbone feature extraction network S-Backbone, Neck network and head head are used to detect defects on PCB board images through deep learning technology. The specific steps include obtaining the defect image of the PCB board, performing preliminary feature extraction through S-Backbone, then using the M-ELAN module and the ConvNext-Block module for efficient feature extraction, and further extracting and integrating features through the Res-Block module and the C2f module. Finally, the M-FPN module is used to fuse the feature map, and then processed by the CA module and input it to the head head for prediction.
It improves the efficiency and accuracy of PCB board defect detection, can effectively identify small target defects, reduces the dependence of manual detection, and improves production efficiency and product quality.
Smart Images

Figure CN119273656B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a PCB board defect detection method and a visual sorting method, and belongs to the technical field of industrial product visual identification, mechanism design, defect labeling and product sorting. Background Art
[0002] The welding process of modern circuit boards, while promoting the gradual rise of automated welding, also makes its structure more sophisticated, thus promoting the widespread use of PCB boards in the fields of electronic computers, military, aerospace, wireless communications and other industries that require large-scale circuit integration. However, the manufacturing process of circuit boards belongs to the category of precision manufacturing. During the printing process of circuit boards, errors such as environmental factors, manual operation, and equipment operation will cause unpredictable defects, which will ultimately affect the strength and function of the welded circuit boards. In addition, the various defects of the circuit board occupy small pixels in the image, and some defects are very similar to the non-defective parts of the circuit board surface, so they are difficult to distinguish, which makes the visual detection of circuit board defects challenging. Therefore, the real-time detection of industrial products needs to find a balance between the detection accuracy and detection speed of the model and the model weight file, so as to improve production efficiency while reducing production costs. Summary of the invention
[0003] The present invention provides a PCB board defect detection method, which introduces a backbone feature extraction network S-Backbone, a Neck network, and a head to perform defect detection on a PCB board image; further provides a PCB board defect visual sorting method, which is used to realize PCB automatic sorting according to the result of the PCB board defect detection method.
[0004] The technical solution of the present invention is:
[0005] According to a first aspect of the present invention, a PCB board defect detection method is provided, comprising: acquiring a PCB board defect image; using the PCB board defect image as an input of a backbone feature extraction network S-Backbone to derive four effective feature layers through the backbone feature extraction network S-Backbone; the backbone feature extraction network S-Backbone is used to perform preliminary downsampling using a Focus module; then using an M-ELAN module to perform efficient feature extraction; then, using a ConvNext-Block module to obtain global information; and then, using four consecutive Res-Block modules to further perform feature extraction. In the next step, a more detailed feature extraction is performed to ensure the gradient flow and deepen the network depth through residual connection, so as to induce the first, second and third effective feature layers; finally, the C2f module is used to realize efficient feature extraction and integration, and the features of different levels and scales are fused to induce the fourth effective feature layer; four effective feature layers are derived from the backbone feature extraction network S-Backbone as the input of the Neck network, and the four effective feature layers of different depths are input into the M-FPN module to be fused into three effective feature maps suitable for large, medium and small targets, and then the feature maps are processed by the CA module and input into the head Head for prediction to obtain prediction information.
[0006] Furthermore, the M-ELAN module uses the ELAN module as a framework, and replaces the two convolutional layers in the ELAN module with two 2×2 maximum pooling layers; the Res-Block module is used to obtain the first branch and the second branch containing the same feature information after the input feature undergoes 1×1 convolution CBS1: the first branch is subjected to feature splitting by the Split operation, and the first feature obtained by the splitting is Figure 1 After 3×3 convolution CBS2, the third branch and the fourth branch containing the same feature information are obtained. The output of the third branch after 3×3 convolution CBS3 is spliced with the fourth branch in the channel dimension to obtain the first splicing result; the output of the first splicing result after 1×1 convolution CBS4 is spliced with the second branch to obtain the second splicing result; and then a 2×2 maximum pooling layer is used to downsample the second splicing result by 2 times to obtain the output.
[0007] Furthermore, the Neck network fuses four effective feature layers of different depths into three effective feature maps suitable for large, medium and small targets through an M-FPN module based on a feature pyramid network FPN; the M-FPN module replaces the SPP module in the feature pyramid network FPN with a C-SPP module; the C-SPP module specifically: uses the output of the third effective feature layer F3 after a 1×1 convolution as the input of the C-SPP module; the output of the C-SPP module after a 1×1 convolution is divided into the second feature map by a split operation Figure 1 , Second feature Figure 2 ; Second feature Figure 2 Used for the second feature Figure 1 Channel splicing is performed to obtain a third splicing result, which is used as the input of the SPP-Block; the output of the SPP-Block is spliced with the third splicing result to obtain a fourth splicing result; the output of the fourth splicing result after another 1×1 convolution is used as the output of the C-SPP module.
[0008] Furthermore, CIoU and Varifocalloss are used to supervise the model formed by the backbone feature extraction network S-Backbone, Neck network, and head during the training process; CIoU is mainly responsible for approximating the position and size of the predicted target box and the actual marked real box to obtain the predicted target box closest to the real box; Varifocalloss mainly deals with the problem of imbalance between positive and negative samples in training data to ensure that the network can efficiently learn the features of positive samples.
[0009] Furthermore, the backbone feature extraction network S-Backbone, Neck network, and head Head are constructed as a PCB-YOLO deep learning detection model; the PCB-YOLO deep learning detection model is trained to generate a frozen model for detecting the surface welding defect image of the PCB board to be detected, and the steps of obtaining the frozen model are as follows:
[0010] Step 1, obtaining a public PCB board surface defect data set; collecting a PCB board surface welding defect data set; dividing the public PCB board surface defect data set into a first training set and a first verification set; dividing the collected PCB board surface welding defect data set into a second training set, a second verification set and a test set;
[0011] Step 2, calling the PCB-YOLO deep learning detection model; pre-training the PCB-YOLO deep learning detection model according to the first training set to obtain multiple first weight files; loading the first verification set to screen the multiple first weight files to obtain the pre-training optimal weights; using the second training set to perform intensive training on the PCB-YOLO deep learning detection model loaded with the pre-training optimal weights to obtain multiple second weight files; loading the second verification set to screen the multiple second weight files to obtain the intensive training optimal weights; using the PCB-YOLO deep learning detection model loaded with the intensive training optimal weights as a frozen model.
[0012] According to a second aspect of the present invention, a method for visually sorting defects of PCB boards is provided, which is used for a visually sorting production line for visually sorting defects of PCB boards. The visually sorting production line for visually sorting defects of PCB boards comprises a defect detection module 3, a conveyor belt module 4 and an automatic sorting module 5. The method for visually sorting defects of PCB boards comprises: starting the conveyor belt module 4 to supply a PCB board to be detected, and starting the image acquisition module in the defect detection module 3; when the PCB board to be detected passes through the defect detection module 3, the image acquisition module is triggered to acquire an image as a surface welding defect image of the PCB board to be detected, a controller in the defect detection module 3 calls a frozen model to perform visual real-time defect detection on the surface welding defect image of the PCB board to be detected, and judges whether there is a defect according to the result of the real-time detection of the target: if there is a defect, the automatic sorting module 5 is driven to perform sorting.
[0013] The beneficial effects of the present invention are as follows: the present invention effectively solves the problems of low efficiency and low detection accuracy of manual naked eye detection in the current PCB board defect detection, as well as the problems of complex background, difficulty in distinguishing foreground from background, random defect shape, area, and position in the traditional defect detection method. The method of the present invention uses deep learning for image processing, combines a defect labeling module and an automatic sorting module, outputs recognition and sorting results, separates unqualified products, effectively improves the detection efficiency of PCB board defects, and also improves the accuracy of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 is a flow chart of the present invention;
[0015] Figure 2 This is the PCB board size measurement result diagram;
[0016] Figure 3 This is the result diagram of automatically adjusting the object distance;
[0017] Figure 4 This is the defect map of PCB board;
[0018] Figure 5 Flowchart for constructing a PCB board defect image dataset;
[0019] Figure 6 Flowchart for model training and generation of frozen models;
[0020] Figure 7 This is the improved PCB-YOLO deep learning network model diagram;
[0021] Figure 8 This is the residual module structure diagram of the PCB-YOLO deep learning network model;
[0022] Fig. 9This is the ConvNextBlock module structure diagram of the PCB-YOLO deep learning network model;
[0023] Fig.10 This is the M-ELAN module structure diagram of the PCB-YOLO deep learning network model;
[0024] Fig.11 This is the CA attention module structure diagram of the PCB-YOLO deep learning network model;
[0025] Fig.12 This is the C-SPP module structure diagram of the PCB-YOLO deep learning network model;
[0026] Fig.13 To detect the effect diagram in real time;
[0027] Fig.14 Assembly drawing for production line;
[0028] Fig.15 This is the structural diagram of the automatic centering clamping module;
[0029] Fig.16 It is the motor installation and baffle structure diagram;
[0030] Fig.17 This is the structural diagram of the dimension measurement module;
[0031] Fig.18 It is the defect detection module diagram;
[0032] Fig.19 This is the structural diagram of the conveyor belt module;
[0033] Fig. 20 This is the overall structure diagram of the automatic sorting module;
[0034] Fig.21 This is a partial structural diagram of the automatic sorting module;
[0035] Fig. 22 It is the structure diagram of M-FPN;
[0036] Fig.23 The main ablation experiment results;
[0037] Fig.24 This is the result of ablation experiment;
[0038] The numbers in the figure are: automatic centering clamping module-1, dimension measurement module-2, defect detection module-3, conveyor belt module-4, automatic sorting module-5, stepper motor-6, torque limiter-7, synchronous belt driving shaft-8, active synchronous gear-9, motor mounting seat-10, driven synchronous gear mounting seat-11, support plate-12, synchronous belt driven shaft-13, driven synchronous gear-14, synchronous belt-15, synchronous belt pressure plate-16, horizontal slide moving plate-17, linear slider-18, linear guide-19, baffle moving block-20, baffle support rod-21, baffle-2 2. Groove photoelectric sensor-23, hard limit slider-24, light rod-26, mobile loading slider-27, upper fixed support-28, lower fixed support-29, adjusting screw-30, handwheel-31, crossbeam slide-33, longitudinal ball screw mechanism I-34, transverse slider-35, guide rail clamp-36, slider connecting plate-37, industrial camera I-38, camera bracket I-39, three-color ring light source I-40, measurement module photoelectric sensor I-41, measurement module photoelectric sensor II-42, measurement module photoelectric sensor III-43, measurement module sensor sheet-4 4. Longitudinal ball screw mechanism II-47, transverse ball screw mechanism-49, photoelectric sensor I-50, photoelectric sensor II-51, photoelectric sensor III-52, photoelectric sensor IV-53, photoelectric sensor V-54, photoelectric sensor VI-55, industrial camera II-56, camera bracket II-57, three-color ring light source II-58, ball slider-59, support plate-60, support beam-61, active shaft base-62, driven shaft base-63, active shaft-64, driven sprocket-65, active shaft roller-66, driven shaft-67, driven shaft roller Cylinder-68, motor support plate-69, stepper motor-70, driving sprocket-71, chain-72, transport conveyor belt-73, support beam-75, support beam-76, cylinder fixed seat-77, cylinder fixed shaft-78, conveyor belt fixed seat I-79, conveyor belt fixed seat II-80, sorting conveyor belt module-81, conveyor belt fixed shaft-82, rotating shaft fixed seat-83, conveyor belt rotating shaft-84, cylinder rotating block-85, guide rod cylinder-86, conveyor belt rotating block-87, good conveyor belt module-88, conveyor belt connecting plate-89 and defective conveyor belt module-90. DETAILED DESCRIPTION
[0039] The invention will be further described below in conjunction with the accompanying drawings and embodiments, but the content of the invention is not limited to the scope of the embodiments.
[0040] Example 1: Figure 1-24As shown, according to a first aspect of an embodiment of the present invention, a PCB board defect detection method is provided, comprising: acquiring a PCB board defect image; using the PCB board defect image as an input of a backbone feature extraction network S-Backbone to derive four effective feature layers through the backbone feature extraction network S-Backbone; the backbone feature extraction network S-Backbone is used to perform preliminary downsampling using a Focus module; then using an M-ELAN module to perform efficient feature extraction; then, using a ConvNext-Block module to obtain global information; and then, using four consecutive Res-Block modules to further perform more detailed feature extraction to obtain four effective feature layers through the backbone feature extraction network S-Backbone. The residual connection ensures the gradient flow and deepens the network depth to induce the first, second and third effective feature layers; finally, the C2f module is used to achieve efficient feature extraction and integration, and the features of different levels and scales are fused to induce the fourth effective feature layer; four effective feature layers are derived from the backbone feature extraction network S-Backbone as the input of the Neck network, and the four effective feature layers of different depths are input into the M-FPN module to be fused into three effective feature maps suitable for large, medium and small targets. The feature maps are then processed by the CA module and input into the head Head for prediction; the prediction information includes the type name of the predicted defect target, the type confidence, the coordinates of the target center point, and the height and width of the target box, such as Fig.13 The figure shows the real-time detection effect.
[0041] In order to solve the problem that too deep convolution layers are prone to feature loss when extracting features of small target defects in PCB, resulting in poor detection effect of the network for small targets, a new backbone structure S-Backbone is proposed; the specific improvements are as follows:
[0042] The M-ELAN module uses the ELAN module as a framework and replaces the two convolutional layers in the ELAN module with two 2×2 maximum pooling layers, so that a part of the background information can be better filtered when extracting defect features and the prominent defect information in the feature map can be retained; Figure 8 As shown in the figure, the Res-Block module is used to obtain the first branch and the second branch containing the same feature information after the input feature is subjected to 1×1 convolution CBS1: the first branch is subjected to feature splitting by Split operation, and the first feature obtained by splitting is Figure 1 After 3×3 convolution CBS2, the third branch and the fourth branch containing the same feature information are obtained. The output of the third branch after 3×3 convolution CBS3 is spliced with the fourth branch in the channel dimension to obtain the first splicing result; the output of the first splicing result after 1×1 convolution CBS4 is spliced with the second branch to obtain the second splicing result; and then a 2×2 maximum pooling layer is used to downsample the second splicing result by 2 times to obtain the output.
[0043] By applying the above technical solution, it can be seen that the M-ELAN module is as follows Fig.10 As shown in FIG, the ELAN module is used as the framework, and the two convolutional layers in the ELAN module are replaced by two 2×2 maximum pooling layers, so that a part of the background information can be better filtered when the defect feature is extracted, and the prominent defect information in the feature map is retained; the ConvNext-Block uses the inverted residual structure of the large 7×7 convolution kernel. The module structure is as follows Fig. 9 As shown in Figure 2, when performing surface defect extraction on PCB images using a shallow network, this module can increase the network's receptive field while obtaining richer contextual information, thereby enhancing the network's feature extraction capability. Figure 8 The Res-Block module shown replaces the residual module in the YOLOX-1 network, which is used to effectively reduce the amount of some parameters when the number of channels in the deep network increases, thereby ensuring the stability of network performance to the greatest extent; the C2f module is introduced after adopting four consecutive Res-Block modules, which can better extract and integrate feature information at a deeper level.
[0044] Furthermore, the Neck network fuses four effective feature layers of different depths into three effective feature maps suitable for large, medium and small targets through the M-FPN module based on the feature pyramid network FPN; considering that the network's receptive field is increased, the network's detection performance can be improved. The M-FPN module replaces the SPP module in the feature pyramid network FPN with a C-SPP module. The specific structure of the M-FPN module is as follows: Fig. 22 As shown; the C-SPP module, such as Fig.12 As shown in FIG. 1 , specifically, the output of the third effective feature layer F3 after a 1×1 convolution is used as the input of the C-SPP module; the output of the C-SPP module after a 1×1 convolution is divided into the second feature layer F3 by using the split operation. Figure 1 , Second feature Figure 2 ; Second feature Figure 2 Used for the second feature Figure 1 Channel splicing is performed to obtain a third splicing result, which is used as the input of the SPP-Block; the output of the SPP-Block is spliced with the third splicing result to obtain a fourth splicing result; the output of the fourth splicing result after another 1×1 convolution is used as the output of the C-SPP module.
[0045] It should be noted that the F1 feature layer is not selected in the original YOLOX-1 network, and the present invention introduces the first effective feature layer, namely the F1 feature layer. Although the F1 shallow feature contains more noise information and fewer semantic features, it also contains a large amount of position and detail information. These refined features provide rich detail information for the detection of small targets such as PCB surface defects. Therefore, adding the F1 shallow feature layer to the M-FPN feature pyramid for feature fusion makes up for the insufficient small target information contained in the other three feature layers. In order not to increase the amount of calculation too much, the M-FPN feature pyramid fuses four feature layers of different depths into three output layers suitable for large, medium and small targets. Introducing the CA attention mechanism such as Fig.11 As shown in the figure, the CA attention mechanism first decomposes the input feature map into feature maps in the horizontal and vertical directions, and applies the attention mechanism to the feature map in each direction. This module takes into account the channel information of the feature and the direction information related to the position, which can enhance PCB-YOLO's ability to extract and utilize circuit board surface defect information.
[0046] CIoU and Varifocalloss are used to supervise the PCB-YOLO deep learning detection model formed by the backbone feature extraction network S-Backbone, Neck network and Head during the training process; CIoU is mainly responsible for approximating the position and size of the predicted target box and the actual marked real box to obtain the predicted target box closest to the real box; Varifocalloss mainly deals with the imbalance problem of positive and negative samples in training data to ensure that the network can efficiently learn the features of positive samples.
[0047] It should be noted that the loss function used by YOLOX-l is not applicable in PCB defect detection. For example, when the intersection area between the predicted box and the true box is 0, the gradient of the IoU loss will be 0, making the network unable to be optimized; secondly, this loss cannot accurately estimate the actual overlap and aspect ratio between the true box and the predicted box in the PCB defect image. To address these problems, CIoU and binary cross entropy loss Varifocalloss are used as the loss function of PCB-YOLO. CIoU (Complete-IoU), known as the complete IoU loss, takes into account the overlapping area, center point distance and aspect ratio between the predicted target box and the true box, so as to ensure that the predicted target box of the PCB image can more realistically reflect the location and size of the defect target; the dynamically scaled binary cross entropy loss Varifocalloss is adopted to compensate for the fact that the binary cross entropy loss only considers the imbalance of positive and negative samples in the real situation;
[0048] Furthermore, the backbone feature extraction network S-Backbone, Neck network, and head Head are constructed as a PCB-YOLO deep learning detection model; the PCB-YOLO deep learning detection model is trained to generate a frozen model for detecting the surface welding defect image of the PCB board to be detected, and the steps of obtaining the frozen model are as follows:
[0049] Step 1, obtaining a public PCB board surface defect data set; collecting a PCB board surface welding defect data set; dividing the public PCB board surface defect data set into a first training set and a first verification set; dividing the collected PCB board surface welding defect data set into a second training set, a second verification set and a test set;
[0050] In an embodiment of the present invention, the public PCB board surface defect dataset used is PCB Defect-Augmented dataset, which includes 10668 600×600 PCB board surface defect images.
[0051] Further, the steps of processing the collected PCB board surface welding defect data set are as follows: Figure 5 As shown:
[0052] Step 1.1, collect PCB board surface welding defect images on site, use sliding shearing to collect PCB board surface welding defect images, set the sliding step size to 256, and the shearing image size to 1280×1280, and obtain 5177 PCB board images with defects;
[0053] Step 1.2, classify 5177 PCB images with surface soldering defects, of which 4192 images are used as the second training set, 466 images are used as the second validation set, and 519 images are used as the second test set;
[0054] Step 1.3, use LabelImg labeling software to label the training set images, validation set images and test set images; the labeling includes: the horizontal and vertical coordinates of the target information center position, the length and width of the bounding box and the defect category; when labeling, it is necessary to determine the PCB board defect category: the pad adhesion is named interconnect pad class, and the welding asymmetry is named dissymmetry, such as Figure 4 shown.
[0055] Step 1.4: Convert the marked PCB surface welding defect annotation information uniformly; that is, use a python script to convert the label file from .xml file format to .txt file format; through format conversion, the data can better adapt to the deep learning in the subsequent steps;
[0056] Step 1.5, put the results of the annotation conversion into the corresponding training set image folder, verification set image folder and test set image folder respectively, together forming a PCB board surface welding defect image dataset consisting of a training set, a verification set and a test set.
[0057] Step 2, call the PCB-YOLO deep learning detection model; pre-train the PCB-YOLO deep learning detection model according to the first training set to obtain multiple first weight files; load the first verification set to screen the multiple first weight files to obtain the optimal pre-training weights; use the second training set to perform reinforcement training on the PCB-YOLO deep learning detection model loaded with the optimal pre-training weights to obtain multiple second weight files; load the second verification set to screen the multiple second weight files to obtain the optimal weights for reinforcement training; use the PCB-YOLO deep learning detection model loaded with the optimal weights for reinforcement training as a frozen model; further, use the frozen model to detect the surface welding defects of the PCB board to be inspected. The specific training process is as follows: Figure 6 shown.
[0058] It should be noted that before formal training, the hyperparameters of the configuration file are modified, where the hyperparameters of the configuration file mainly include the learning rate, the number of extracted pictures, the number of iterations, and the weight decay coefficient, and the remaining hyperparameters are the default values; in this embodiment, the learning rate is 1e-4, the number of extracted pictures is 16, the number of iterations is 300, the weight decay coefficient is 0.937, the optimizer type used by the model is set to SGD, and the data enhancement of Mosaic data augmentation is used. The experimental model is run on a Windows 10 device with torch1.7.1 + torchvision0.8.2, which is equipped with a 12th Gen Intel(R)Core(TM) i7-12700F 2.10 GHz CPU, 32Gb memory and Nvidia GeForce RTX 4080 16Gb GPU. In this embodiment of the present invention, the Pytorch framework is used to pre-train the PCB-YOLO deep learning detection model, and according to the hyperparameter settings of the configuration file, 8 images in the training set are randomly selected in sequence to pre-train the PCB-YOLO deep learning detection model, and the weight of the PCB-YOLO deep learning detection model is updated until all samples of the entire training set are completely traversed as one iteration, and a weight file is saved at the same time, and the above method is repeated until the number of iterations is 300, and multiple pre-trained weight files are obtained. In the above, the validation set is called to evaluate the performance of each PCB-YOLO deep learning detection model loaded with different weight parameter files. The evaluation criteria are mainly evaluated through the average accuracy, frame rate, parameter quantity, and model size of the PCB-YOLO deep learning detection model, and the optimal weight parameter file is obtained by comprehensive screening; the optimal weight parameter file is loaded into the PCB-YOLO deep learning detection model to generate a frozen model, which is used as the final PCB-YOLO deep learning detection model for detection and can be called by all subsequent work lines;
[0059] Furthermore, the main innovative points of the PCB-YOLO deep learning detection model were effectively verified, and the mean average accuracy mAP was selected as the evaluation indicator of the accuracy of the PCB-YOLO deep learning detection model. The effectiveness of the method proposed in the PCB-YOLO deep learning detection model was verified in the S-Backbone network. The network combines M-ELAN, ConvNextBlock, Res-Block and C2f at the same time, and has achieved significant improvements compared with the original backbone of YOLOX-l. Since ConvNextBlock provides a larger convolution kernel receptive field, the algorithm's perception of small targets is significantly enhanced, and the semantic features obtained by gradually abstracting and encoding the PCB surface features using the optimized Res-Block are efficiently integrated by the C2f module, thereby effectively filtering out a large amount of noise and irrelevant background information on the PCB surface, enabling the network to learn high-quality feature information related to PCB surface defects and ultimately achieve optimal accuracy. M-ELAN is referred to as ME, ConvNextBlock is referred to as CB, and Res-Block is referred to as RB. The results are shown in the figure. Fig.23 As shown in the figure (in the figure, add ME means adding ME on the basis of YOLOX-1; add CB means adding CB on the basis of YOLOX-1; add RB means replacing the original residual module on the basis of YOLOX-1; add C2f means adding C2f on the basis of YOLOX-1; add ME,CB means adding ME,CB on the basis of YOLOX-1; add ME,CB,RB means adding ME,CB on the basis of YOLOX-1 and replacing the original residual module with RB; add ME,CB,RB,C2f means replacing the original backbone network with the S-Backbone network of the present invention on the basis of YOLOX-1), three evaluation indicators, namely mAP0.5, mAP0.75 and mAP0.5:0.95, reached 99.4%, 79.5% and 65.6% respectively. Although the use of ConvNextBlock and C2f on the original YOLOX-1 backbone network introduces additional parameter consumption, the accuracy is not significantly improved. Fig.23 The best performing backbone network architecture is named "add ME, CB, RB, C2f," as S-Backbone. The results show that S-Backbone effectively learns the background and foreground information of PCB surface defect features during feature extraction, and it can filter out irrelevant fine-grained noise information. In the progressive depth of the entire network, S-Backbone avoids feature loss and shows good feature encoding effect for PCB surface defect analysis.
[0060] Furthermore, the main innovations introduced in the PCB-YOLO deep learning detection model are fully verified, and the Varifocal Loss is abbreviated as VFL and the S-Backbone is abbreviated as SB; according to YOLOX-l, S-Backbone replaces the YOLOX-l backbone (i.e. Fig.24 A+SB), M-FPN replaces the original YOLOX-l neck (i.e. Fig.24 B+M-FPN in the middle means A+S-B+M-FPN), adding CA attention mechanism module (i.e. Fig.24 C+CA in the middle means A+S-B+M-FPN+CA), and CIOU is used to replace the original IOU loss + BCEWithLogitsLoss loss of YOLOX-l (i.e. Fig.24 D+CIOU in the figure means A+S-B+M-FPN+CA+CIOU), and using Varifocao Loss to replace the original BCEWithLogitsLoss loss of YOLOX-l (i.e. Fig.24 The ablation experiment was carried out in the order of A+S-B+M-FPN+CA+CIOU+VFL. The results are shown in Fig.24 As shown. It can be seen from the figure that S-Backbone effectively improves the accuracy of the network and reduces the model size. It surpasses the YOLOX-l algorithm by 1.1% on mAP0.5 and 9.3% on mAP0.5:0.95. S-Backbone has good performance and high robustness. After replacing M-FPN, the performance of PCB-YOLO is compromised. In M-FPN, only one residual structure is used to extract features, and the rest are convolutional layers used to adjust the size of the feature layer. Therefore, the performance of the FPN part is poor compared to YOLOX-l at this time. Considering that M-FPN has insufficient feature utilization, the present invention introduces the CA attention module. It can be seen from the experimental results that the CA attention module improves the performance of PCB-YOLO, but the reasoning speed is reduced. In the CA attention module, the operation of encoding position information by decomposing in the X direction and the Y direction requires the model to consume more time than usual during forward propagation, so the reasoning speed of the network is reduced. The introduction of CIoU and Varifocal Loss further increased the network’s mAP0.5 by 0.3%, reaching the final best accuracy of 99.6%, achieving a good balance between network accuracy and inference speed.
[0061] According to a second aspect of an embodiment of the present invention, a PCB board defect visual sorting production line is provided, such as Fig.14As shown, it includes an automatic centering clamping module 1, a dimension measuring module 2, a defect detection module 3, a conveyor belt module 4 and an automatic sorting module 5; wherein the automatic centering clamping module 1 is used to center and correct the PCB board to be detected; the dimension measuring module 2 is used to automatically measure the dimension information of the PCB board to be detected in the X direction and the Y direction; the defect detection module 3 automatically adjusts the object distance between the industrial camera and the PCB board to be detected according to the size of the PCB board to be detected so as to ensure that the PCB board to be detected in the captured image occupies the maximum effective area of the whole image, and uses the PCB-YOLO algorithm to perform visual defect detection on the real-time collected image; the conveyor belt module 4 is used to quickly transport the PCB board so as to improve the detection efficiency; the automatic sorting module 5 is used to sort the PCB boards according to the detection results of the defect detection module 3, and automatically sort the good PCB boards and the defective PCB boards so as to manage the PCB boards more finely.
[0062] Furthermore, if Fig.15 and 16As shown, the automatic centering clamping module 1 includes a stepper motor 6, a torque limiter 7, a synchronous belt driving shaft 8, an active synchronous gear 9, a motor mounting seat 10, a driven synchronous gear mounting seat 11, a support plate 12, a synchronous belt driven shaft 13, a driven synchronous gear 14, a synchronous belt 15, a synchronous belt pressure plate 16, a transverse slide rail moving plate 17, a linear slider 18, a linear guide 19, a baffle moving block 20, a baffle support rod 21, a baffle 22, a groove-type photoelectric sensor 23, and a hard limit slider 24; the driving shaft of the stepper motor 6 is connected to one end of the synchronous belt driving shaft 8 through the torque limiter 7, the active synchronous gear 9 is fixed to the synchronous belt driving shaft 8 through a key, and the other end of the synchronous belt driving shaft 8 is installed on the synchronous belt driving shaft 8 through a bearing. The motor mounting seat 10, the bottom of the motor mounting seat 10 and the driven synchronous gear mounting seat 11 are respectively connected to the support plate 12, the synchronous belt driven shaft 13 is installed on the driven synchronous gear mounting seat 11 through a bearing, the driven synchronous gear 14 is fixedly installed on the synchronous belt driven shaft 13 through a key, and the two ends of the synchronous belt driven shaft 13 are limited by shaft elastic retaining rings, the synchronous belt 15 is used to connect the active synchronous gear 9 and the driven synchronous gear 14, the synchronous belt pressure plate 16 is fixed to the synchronous belt 15 by bolts, and the bottom end of the synchronous belt pressure plate 16 is connected to the transverse slide rail moving plate 17 by screws, the two ends of the transverse slide rail moving plate 17 are connected to the linear slider 18, and the linear slider 18 is slidably matched with the linear guide 19, and the linear guide 19 is fixed to the support plate 12 by screws, the baffle moving block 20 is fixed to the bottom of the horizontal slide rail moving plate 17 by welding, one end of the baffle support rod 21 is connected to the horizontal slide rail moving plate 17 by bolts, and the other end of the baffle support rod 21 extends from the support plate 12 for welding and fixing with the baffle 22, the slot photoelectric sensor 23 is installed on the support plate 12 by screws, and the hard limit slider 24 is fixed to the linear guide 19 by screws; the principle of synchronous belt centering keeps the PCB board in the center position of the mechanical transmission system to prevent deviation and improve the transmission efficiency; in this transmission system, the synchronous belt 15 is used to transmit power and motion, and the synchronous belt usually has a tooth shape, which can ensure the toothed belt when matched with the synchronous gear. The tooth of the synchronous gear is tightly engaged; the slotted photoelectric sensor 23 realizes the soft limit function, and the hard limit slider 24 realizes the hard limit function. The two cooperate to better realize the movement of the two lateral slide rail moving plates 17 along the first preset direction within the effective stroke; when the stepper motor 6 rotates forward, the control baffle 22 realizes the centering and clamping. Before the centering and clamping of the PCB board, the torque limiter 7 realizes the stepper motor 6 drive shaft and the synchronous belt driving shaft 8 to rotate at the same speed. After the centering and clamping of the PCB board, the torque limiter 7 realizes the stepper motor 6 drive shaft to continue to rotate, while the synchronous belt driving shaft 8 stops rotating, so as to avoid damage to the PCB board to be detected due to excessive clamping. The stepper motor stops rotating after 0.1s, and then after 0.1s stepper motor 6 reverses, controls baffle 22 to move away from the workpiece (such as PCB board), and when slot photoelectric sensor 23 reacts, the motor stops working, thus realizing the function of centering.
[0063] Furthermore, the automatic centering clamping module 1 also includes a polished rod 26, a movable loading slider 27, an upper fixed support 28, a lower fixed support 29, an adjusting screw 30 and a handwheel 31; the polished rod 26 is connected to the movable loading slider 27 through a clearance fit and both ends extend from the movable loading slider 27, and the top end of the polished rod 26 is threadedly connected to the upper fixed support 28, and the bottom end of the polished rod 26 is threadedly connected to the lower fixed support 29, the adjusting screw 30 extends from the movable loading slider 27 and the movable loading slider 27 is fixed to the adjusting screw 30 by the locking screws at both ends of the movable loading slider 27, the handwheel 31 is fixed to one end of the adjusting screw 30 by a threaded connection, and the other end of the adjusting screw 30 is installed on the lower fixed support 29 through a bearing. By applying the above technical solution, it can be known that when the locking screws at both ends of the movable loading slider 27 are loosened, the position of the movable loading slider 27 can be adjusted by rotating the hand wheel 31, thereby adjusting the position of the baffle 22, and then when the locking screws are tightened, the movable loading slider 27 is fixed to the light rod 26 and the adjusting screw 30, so as to be suitable for clamping the PCB board to be inspected.
[0064] Furthermore, if Fig.17As shown, the dimension measuring module 2 includes a crossbeam slide rail 33, a longitudinal ball screw mechanism I34, a transverse slider 35, a guide rail clamp 36, a slider connecting plate 37, an industrial camera I38, a camera bracket I39, a three-color ring light source I40, a measuring module photoelectric sensor I41, a measuring module photoelectric sensor II42, a measuring module photoelectric sensor III43 and a measuring module sensor sheet 44; both ends of the crossbeam slide rail 33 are fixedly installed on the ball slider of the longitudinal ball screw mechanism I34 by screws, the transverse slider 35 and the guide rail clamp 36 are slidably matched with the crossbeam slide rail 33, and the guide rail clamp 36 is connected to the crossbeam slide rail 33 through the slider connecting plate 37. 5, the industrial camera I38 is fixed to the camera bracket I39 by screws, the industrial camera I38 is connected to the three-color ring light source I40 by screws, the camera bracket I39 is fixed to the horizontal slider 35 by screws, and the use of the three-color ring light source I40 can provide more accurate color reproduction, making the PCB board to be detected look more natural and real; the measuring module photoelectric sensor I41, the measuring module photoelectric sensor II42 and the measuring module photoelectric sensor III43 are fixed to the longitudinal ball screw mechanism I34 by the reversing angle piece, and the measuring module sensor sheet 44 is clamped on the ball slider of the longitudinal ball screw mechanism I34 by screws. It can be seen from the application of the above technical solution that the guide clamp 36 can be used to control the position of the horizontal slider 35, and the longitudinal ball screw mechanism I34 can be used to adjust the movement of the industrial camera I38 along the second preset direction (i.e. Fig.14 The measuring module photoelectric sensor I41 and the measuring module photoelectric sensor III43 are used to limit the range of movement of the industrial camera I38 along the Y axis, and the measuring module photoelectric sensor II42 is used to restore the industrial camera I38 to its initial position to ensure its correct operation.
[0065] Furthermore, for a production line, before using the dimension measurement module 2, the following steps can be used to prepare for measurement:
[0066] Step 1) Prepare the PCB to be tested, ensure that the PCB to be tested is in the proper position and state, and set reasonable parameters of the industrial camera I38, such as exposure time and white balance;
[0067] Step 2) Use the industrial camera I38 to shoot the PCB board to be tested, and adjust the up and down position of the industrial camera I38 to ensure that the image of the PCB board to be tested is clear in the captured image;
[0068] Step 3) Convert the PCB board image from pixels to actual size; for example, the measurement result is as follows: Figure 2 shown.
[0069] Furthermore, the defect detection module 3 is as follows: Fig.18As shown, it includes a longitudinal ball screw mechanism II47, a transverse ball screw mechanism 49, a photoelectric sensor I50, a photoelectric sensor II51, a photoelectric sensor III52, a photoelectric sensor IV53, a photoelectric sensor V54, a photoelectric sensor VI55, an industrial camera II56, a camera bracket II57, a three-color ring light source II58 and a ball slider 59; the ball screw mechanism II47 is fixedly installed on the transverse ball screw mechanism 49 through a connecting angle block, the photoelectric sensor I50, the photoelectric sensor II51 and the photoelectric sensor III52 are fixedly installed on the longitudinal ball screw mechanism II47 through a reversing angle block, the photoelectric sensor IV53, the photoelectric sensor V54 and the photoelectric sensor VI55 are fixedly installed on the transverse ball screw mechanism 49 through a reversing angle block; the industrial camera II56 is fixedly installed on the camera bracket II57 through a threaded connection, the industrial camera II56 is fixed to the three-color ring light source II58 through screws, and the camera bracket II57 is installed on the ball slider 59 on the transverse ball screw mechanism 49 through screws. In the above technical solution, the longitudinal ball screw mechanism II47 is used to control the industrial camera II56 to move along the second preset direction, i.e., the Y-axis direction, and the transverse ball screw mechanism 49 is used to control the industrial camera II56 to move along the first preset direction, i.e., the X-axis direction. The ball screw mechanism in the longitudinal column II47 has high positioning accuracy and repeatability, so it can be used to accurately control the position of the industrial camera II56. By automatically adjusting the object distance between the industrial camera II56 and the PCB board, the clearest image can be collected; the defect detection module 3 of the present invention is provided with a controller, and the frozen model is called to perform defect detection on the collected PCB board image; based on the above, the present invention can be used to solve the detection problems existing in the surface defects of the PCB board, such as complex background, difficult to distinguish between foreground and background, and random defect shape, area, and position. The defect detection module 3 adopts an industrial camera as an image acquisition module to realize the acquisition of PCB board images in a visual manner.
[0070] Furthermore, the specific steps for the industrial camera II in the defect detection module 3 to automatically adjust the lens object distance are as follows:
[0071] Step a: Select the focus option of the industrial camera II56 as auto focus;
[0072] Step b, importing the measurement result of the dimension measurement module 2;
[0073] Step c: Automatically adjust the object distance according to the size of the PCB to be detected, ensuring that the PCB to be detected in the captured image occupies 90% of the overall image length in the X direction or the Y direction. Figure 3 As shown;
[0074] Step d: The industrial camera II56 automatically focuses to ensure that the image remains clear.
[0075] Furthermore, the conveyor belt module 4 is as follows Fig.19 As shown, it includes a support plate 60, a support beam 61, a driving shaft machine base 62, a driven shaft machine base 63, a driving shaft 64, a driven sprocket 65, a driving shaft roller 66, a driven shaft 67, a driven shaft roller 68, a motor support plate 69, a stepper motor 70, a driving sprocket 71, a chain 72, and a transport conveyor belt 73; the two ends of the support plate 60 are fixed to the support beam 61 by screws, the driving shaft machine base 62 is fixed to one end of the support beam 61 by countersunk screws, the driven shaft machine base 63 is fixed to the other end of the support beam 61 by countersunk screws, the two ends of the driving shaft 64 are installed on the driving shaft machine base 62 by bearings, and one end of the driving shaft 64 is fixed to the driving shaft machine base 62 by countersunk screws. The seat 62 extends out and is fixedly installed with the driven sprocket 65 through a key, the driving shaft roller 66 is welded and fixedly installed on the driving shaft 64, both ends of the driven shaft 67 are fixedly installed on the driven shaft machine base 63, the driven shaft roller 68 is installed on the driven shaft 67 through a bearing, the motor support plate 69 is fixedly installed on the support beam 61 by screws, the stepper motor 70 is fixedly installed on the motor support plate 69 by screws, the driving sprocket 71 is fixedly connected to the output shaft of the stepper motor 70 through a key, the chain 72 cooperates with the driving sprocket 71 and the driven sprocket 65 to complete the transmission, and the transport conveyor belt 73 cooperates with the driving shaft roller 66 and the driven shaft roller 68 respectively to complete the PCB board transportation. By applying the above technical solution, it is possible to drive the driven sprocket 65 through the conveyor stepper motor 70 to drive the driving shaft 64 to rotate, and the driving shaft 64 drives the driving shaft roller 66 to drive the transport conveyor belt 73 to move. The installation method of each conveyor belt module used in the automatic sorting module 5 is the same as that of the conveyor belt module 4. In specific applications, the transmission speed of all conveyor belts can be set to 0.2 m / s to ensure that the PCB board can stably complete all processes.
[0076] Furthermore, the automatic sorting module 5 is as follows: Fig. 20 and 21As shown, it includes a support beam 75, a support crossbeam 76, a cylinder fixing seat 77, a cylinder fixing shaft 78, a conveyor belt fixing seat I79, a conveyor belt fixing seat II80, a sorting conveyor belt module 81, a conveyor belt fixing shaft 82, a rotating shaft fixing seat 83, a conveyor belt rotating shaft 84, a cylinder rotating block 85, a guide rod cylinder 86, a conveyor belt rotating block 87, a good conveyor belt module 88, a conveyor belt connecting plate 89 and a defective conveyor belt module 90; the support beam 75 is fixedly installed on the support crossbeam 76 through a reversing angle block, the cylinder fixing seat 77 is fixedly installed on the support beam 75 through a screw connection, both ends of the cylinder fixing shaft 78 are installed on the cylinder fixing seat 77 through bearings, the conveyor belt fixing seat I79 is fixedly installed on the support crossbeam 76 through a screw connection, the conveyor belt fixing seat II80 is fixedly installed on one end of the support beam of the sorting conveyor belt module 81 through a screw connection, and the conveyor belt fixing seat The two ends of the fixed shaft 82 are respectively installed on the conveyor belt fixing seat I79 and the conveyor belt fixing seat II80 through bearings, the rotating shaft fixing seat 83 is fixedly installed on the other end of the support beam of the sorting conveyor belt module 81 through screw connection, and the two ends of the conveyor belt rotating shaft 84 are installed on the rotating shaft fixing seat 83 through bearings. The middle part of the cylinder fixed shaft 78 is rotatably matched with the cylinder rotating block 85 through bearings, and the relative positions of the cylinder fixed shaft 78 and the cylinder rotating block 85 are fixed by the shaft shoulder and elastic retaining ring on the cylinder fixed shaft 78. The guide rod cylinder 86 is fixedly installed on the cylinder rotating block 85 through screws, and the middle part of the conveyor belt rotating shaft 84 is installed with a conveyor belt rotating block 87 through a bearing, and the push rod of the guide rod cylinder 86 is connected to the conveyor belt rotating block 87 through screws; the good conveyor belt module 88 and the defective conveyor belt module 90 arranged up and down are fixedly connected by the conveyor belt connecting plate 89. When in use, the permanent position of the guide rod cylinder 86 is to make the sorting conveyor belt module 81 flush with the good product conveyor belt module 88. When the defect detection module 3 detects that there is a defect in the PCB board, the guide rod cylinder 86 of the automatic sorting module 5 is driven to adjust the position to tilt toward the defective product conveyor belt module 90. That is, the guide rod cylinder 86 controls the movement of the sorting conveyor belt module 81 to realize the conveyance of good product PCB boards to the good product conveyor belt module 88 and the conveyance of defective PCB boards to the defective product conveyor belt module 90.
[0077] According to a third aspect of an embodiment of the present invention, a method for visually sorting defects of PCB boards is provided, which is used for a visually sorting production line for visually sorting defects of PCB boards. The visually sorting production line for visually sorting defects of PCB boards comprises a defect detection module 3, a conveyor belt module 4 and an automatic sorting module 5. The method for visually sorting defects of PCB boards comprises: starting the conveyor belt module 4 to supply a PCB board to be detected, and starting the image acquisition module in the defect detection module 3; when the PCB board to be detected passes through the defect detection module 3, the image acquisition module is triggered to acquire an image as a surface welding defect image of the PCB board to be detected, a controller in the defect detection module 3 calls a frozen model to perform visual real-time defect detection on the surface welding defect image of the PCB board to be detected, and judges whether there is a defect according to the result of the real-time detection of the target: if there is a defect, the automatic sorting module 5 is driven to perform sorting.
[0078] By way of example, an optional specific process is given as follows:
[0079] S1, start the conveyor belt module 4, supply the PCB board to be tested;
[0080] S2, the PCB board to be tested on the conveyor belt module 4 triggers the infrared sensor switch at the specified position, and the automatic centering clamping module 1 starts working, and the synchronous belt transmission speed is set to 0.2m / s. After the PCB board to be tested is aligned, the automatic centering clamping module is reset and stops working;
[0081] S3. After the PCB to be inspected is aligned, the infrared sensor switch at the specified position is triggered, and the industrial camera of the dimension measurement module 2 starts to collect and measure the size of the collected PCB board image. The OPT-CM200-GL-04 industrial camera is used with the RL120-RGB three-color light source. The resolution is set to 1920×1080, the installation height of the light source is 400mm, and the parameters of each channel of the three-color light are R30 (0-255), G100 (0-255) and B100 (0-255).
[0082] S4, after the centering and size measurement, the infrared induction switch at the trigger position of the PCB board to be inspected is triggered, and the measurement result of the size measurement module 2 is imported into the defect detection module 3, and the defect detection module 3 automatically adjusts the object distance between the industrial camera and the PCB board to be inspected, and then controls the industrial camera of the defect detection module 3 to collect the PCB board image;
[0083] S5, calling PCB-YOLO to perform real-time defect monitoring on the PCB board image collected by the industrial camera of the defect detection module 3;
[0084] S6. After the centering, dimension measurement and real-time defect detection, the PCB board triggers the infrared sensing switch at the position of the automatic sorting module 5; if there is no defect, the detected PCB board passes through the automatic sorting module 5 to the good product conveyor belt module; if there is a defect, the detected PCB board passes through the automatic sorting module 5 to the defective product conveyor belt module, thereby realizing automatic sorting of PCB.
[0085] In summary, the present invention ensures correct positioning by centering and aligning the PCB board through the automatic centering clamping module; the dimension measurement module measures the dimension of the PCB board to be detected, thereby driving the stepper motor in the defect detection module to automatically adjust the distance between the industrial camera and the PCB board to be detected, which can ensure that the camera and the PCB board to be detected are at the optimal working distance, thereby improving the accuracy of detection; the automatic sorting module includes a sorting conveyor belt module, a good conveyor belt module and a defective conveyor belt module, and the sorting conveyor belt module transports the detected PCB board to the good conveyor belt module and the defective conveyor belt module through the defect information obtained by the defect detection module, so as to achieve the purpose of improving efficiency, reducing labor costs and improving accuracy. Through the method disclosed in the present invention, the current PCB board defect detection, the low efficiency of manual naked eye detection, low detection accuracy, and the complex background of the traditional detection method, the difficulty in distinguishing the foreground from the background, the random shape, area, and position of the defect are effectively solved. The inventive method uses a deep learning method for analysis, automatically outputs the defect recognition result, and automatically sorts out unqualified products, effectively reducing the labor intensity of workers, and at the same time can also improve the sorting accuracy, so that the product quality of the PCB board is guaranteed.
[0086] The specific implementation modes of the present invention have been described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.
Claims
1. A PCB board defect detection method, characterized in that: include: Get PCB board defect images; The defect image of the PCB board is used as the input of the backbone feature extraction network S-Backbone to derive four effective feature layers through the backbone feature extraction network S-Backbone; the backbone feature extraction network S-Backbone is used to perform preliminary downsampling using the Focus module; then the M-ELAN module is used for efficient feature extraction; and then the ConvNext-Block module is used to obtain global information; Subsequently, four consecutive Res-Block modules are used to further perform more detailed feature extraction, so as to ensure gradient flow and deepen the network depth through residual connections, so as to induce the first, second and third effective feature layers; finally, the C2f module is used to achieve efficient feature extraction and integration, and features of different levels and scales are fused to induce the fourth effective feature layer; the M-ELAN module uses the ELAN module as a framework, and replaces the two convolutional layers in the ELAN module with two 2×2 maximum pooling layers; Four effective feature layers are derived from the backbone feature extraction network S-Backbone as the input of the Neck network. The four effective feature layers of different depths are input into the M-FPN module to be fused into three effective feature maps suitable for large, medium and small targets. The feature maps are then processed by the CA module and input into the head for prediction to obtain prediction information.
2. The PCB board defect detection method according to claim 1, characterized in that: The Res-Block module is used to obtain a first branch and a second branch containing the same feature information after the input feature is subjected to a 1×1 convolution CBS1: the first branch is subjected to feature splitting by a Split operation, and the first feature map 1 obtained by the split is subjected to a 3×3 convolution CBS2 to obtain a third branch and a fourth branch containing the same feature information, and the output of the third branch after the 3×3 convolution CBS3 is spliced with the fourth branch in the channel dimension to obtain a first splicing result; The output of the first splicing result after 1×1 convolution CBS4 is spliced with the second branch to obtain a second splicing result; The second concatenation result is then downsampled by a factor of 2 using a 2×2 maximum pooling layer to obtain the output.
3. The PCB board defect detection method according to claim 1, characterized in that: The Neck network fuses four effective feature layers of different depths into three effective feature maps suitable for large, medium and small targets through the M-FPN module based on the feature pyramid network FPN; the M-FPN module replaces the SPP module in the feature pyramid network FPN with the C-SPP module; the C-SPP module specifically comprises: taking the output of the third effective feature layer F3 after a 1×1 convolution as the input of the C-SPP module; the output of the input of the C-SPP module after a 1×1 convolution is divided into a second feature map 1 and a second feature map 2 by a split operation; the second feature map 2 is used for channel splicing with the second feature map 1 to obtain a third splicing result and as the input of the SPP-Block; the output of the SPP-Block is spliced with the third splicing result to obtain a fourth splicing result; the output of the fourth splicing result after another 1×1 convolution is used as the output of the C-SPP module.
4. The PCB board defect detection method according to claim 1, characterized in that: CIoU and Varifocalloss are used to supervise the model formed by the backbone feature extraction network S-Backbone, Neck network, and Head during the training process; CIoU is mainly responsible for approximating the position and size of the predicted target box and the actual marked real box to obtain the predicted target box closest to the real box; Varifocalloss mainly deals with the problem of imbalance between positive and negative samples in training data to ensure that the network can efficiently learn the features of positive samples.
5. The PCB board defect detection method according to claim 1, characterized in that: The backbone feature extraction network S-Backbone, Neck network, and head Head are constructed as a PCB-YOLO deep learning detection model; the PCB-YOLO deep learning detection model is trained to generate a frozen model for detecting the solder defect image on the surface of the PCB board to be detected, and the steps for obtaining the frozen model are as follows: Step 1, obtaining a public PCB board surface defect data set; collecting a PCB board surface welding defect data set; dividing the public PCB board surface defect data set into a first training set and a first verification set; Divide the collected PCB board surface welding defect data set into a second training set, a second verification set and a test set; Step 2: Call the PCB-YOLO deep learning detection model; pre-train the PCB-YOLO deep learning detection model according to the first training set to obtain multiple first weight files; The first validation set is loaded to screen multiple first weight files to obtain the pre-trained optimal weights; the second training set is used to perform intensive training on the PCB-YOLO deep learning detection model loaded with the pre-trained optimal weights to obtain multiple second weight files; The second validation set is loaded to screen multiple second weight files to obtain the optimal weights for enhanced training; and the PCB-YOLO deep learning detection model loaded with the optimal weights for enhanced training is used as a frozen model.
6. A PCB board defect visual sorting method, characterized in that: Used in a PCB board defect visual sorting production line, the PCB board defect visual sorting production line comprises a defect detection module (3), a conveyor belt module (4) and an automatic sorting module (5), and a PCB board defect visual sorting method comprises: Turning on the conveyor belt module (4) to supply the PCB board to be inspected, and turning on the image acquisition module in the defect detection module (3); When the PCB board to be inspected passes through the defect detection module (3), the image acquisition module is triggered to acquire an image as a welding defect image on the surface of the PCB board to be inspected. The controller in the defect detection module (3) calls the PCB board defect detection method described in any one of claims 1 to 5 to perform visual real-time defect detection on the welding defect image on the surface of the PCB board to be inspected. Based on the result of the target real-time detection, it is determined whether there is a defect: if there is a defect, the automatic sorting module (5) is driven to perform sorting.
Citation Information
Patent Citations
Multi-scale parallel feature fusion road sign detection method based on YOLO
CN113762209A
Lightweight small target detection method based on improved YOLOv7
CN116206185A