A PCB component detection method based on lightweight network

Through a lightweight network-based PCB component detection method, deep neural networks and target detection algorithms are used to solve the problems of low detection efficiency and high cost in the existing technology, and achieve fast and accurate PCB component detection, which is suitable for Small batch production and reduced inspection costs.

CN112102242BActive Publication Date: 2024-09-20NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010811456.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-13
Publication Date
2024-09-20
Estimated Expiration
2040-08-13

AI Technical Summary

Technical Problem

Existing PCB component detection methods have problems such as low manual detection efficiency, low accuracy, high cost, complex operation of automatic optical detection equipment, and vulnerability to interference from the external environment. Especially in small batch production, it is difficult to achieve efficient and accurate detection.

Method used

Using a lightweight network-based PCB component detection method, by taking high-definition samples, data augmentation, deep neural network training and target detection algorithms, combined with the improved feature extraction network and detection network, the target detection network and detection network for detection are generated. Weight file to achieve fast and accurate component detection.

Benefits of technology

It achieves fast and accurate detection of PCB components, reduces detection costs, improves detection efficiency, is suitable for small batch production, and has the characteristics of small memory consumption, low calculation amount, and strong robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112102242B
    Figure CN112102242B
Patent Text Reader

Abstract

The present invention discloses a PCB component detection method based on a lightweight network, including S1, shooting high-definition PCB component samples, and performing data augmentation on the PCB component samples, marking various components therein, and obtaining a PCB component database; S2, sending the PCB component training samples to a deep neural network for training until the deep learning network converges, and obtaining a target detection network and weight file for detecting PCB components; S3, using the deep learning network and weight file trained in step S2 to detect PCB component targets in PCB component test samples, and outputting the detection results. The present invention has a fast detection speed and high detection accuracy, and solves the shortcomings of low efficiency and low reliability of traditional manual detection, and also solves the disadvantages of high operation requirements of automatic optical detection equipment and susceptibility to interference from the external environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to computer vision technology, and in particular to a PCB component detection method based on a lightweight network. Background Art

[0002] With the continuous advancement of electronic science and technology, the electronics industry is thriving, and people's demand for electronic products is getting higher and higher, such as mobile terminals, digital products, smart cars, etc. However, these electronic products are all completed on integrated circuits, so the production quality requirements of integrated circuits are getting higher and higher. Among them, printed circuit boards (PCBs) are widely used in integrated circuits. With the continuous advancement of technology, the functions of electronic products are becoming more and more complex, but the size is getting smaller and smaller, which tests the production process of PCBs. In the future, in order to meet the needs of the electronics industry, PCBs may have more and more layers and more and more sophisticated components.

[0003] In order to produce high-quality printed circuit boards and reduce the scrap rate, manufacturers will strictly control the production process of circuit boards. Sometimes a small mistake will cause the entire circuit board to not work properly. With the increasing production requirements, the production process of printed circuit boards is complicated and cumbersome, and there are many factors affecting the production quality on the assembly line, such as incorrect operation of workers, equipment failure or other external factors, which will cause the circuit board to fail. Therefore, introducing a detection mechanism in the manufacturing process of printed circuit boards can avoid unnecessary waste of manpower and financial resources as early as possible, thereby reducing production costs.

[0004] So far, there are manual inspection, electrical inspection, optical inspection and other methods for PCB component inspection. However, these methods all have their own shortcomings. Manual inspection is to arrange professional inspectors to visually inspect the produced PCBs. This method not only wastes a lot of manpower, but also has low inspection accuracy and is easily affected by the physical fitness of the inspectors. Moreover, the design of circuit boards is becoming more and more complex, the requirements for inspectors are getting higher and higher, and the work intensity is getting higher and higher. Electrical inspection requires a set of ejector machines. Different circuit boards require different ejector machines, and the machine tools are used to detect whether the circuit boards are qualified or not. This method has a high investment cost, and different machine tools are required for different PCB components, which is not suitable for small batch production. Optical inspection is a commonly used method now, which uses optical knowledge, image processing knowledge and control principles for inspection. Although this method has high inspection accuracy and low cost, it requires professional technicians to operate the software and maintain software development. In addition, this method may lead to missed inspections or false inspections due to inconsistent standards. Summary of the invention

[0005] Purpose of the invention: The purpose of the present invention is to provide a PCB component detection method based on a lightweight network, which combines a lightweight network with a target detection algorithm to significantly improve the detection speed while ensuring that the detection accuracy does not change much.

[0006] Technical solution: The lightweight network-based PCB component detection method of the present invention comprises the following steps:

[0007] S1. photograph high-definition PCB component samples, perform data augmentation on the PCB component samples, label various components therein, and obtain a PCB component database, which includes PCB component training samples and PCB component test samples;

[0008] S2, sending the PCB component training samples to the deep neural network for training until the deep learning network converges, and obtaining the target detection network and weight file for detecting PCB components;

[0009] S3. Use the deep learning network and weight file trained in step S2 to detect the PCB component targets in the PCB component test sample, and output the detection results.

[0010] Furthermore, the operation of data augmentation for the PCB component sample in step S1 includes: randomly performing horizontal or vertical flipping, rotation, scaling, cropping, translation, contrast adjustment, color dithering and noise addition operations on the pre-processed image.

[0011] Furthermore, image preprocessing refers to cutting the original image with a resolution of 2048×2048 into a size of 1024×1024.

[0012] Furthermore, the PCB component sample in step S1 includes 11 categories of PCB components, specifically including five categories of capacitors, chips, resistors, transistors and diodes, each of which is divided into several subcategories, for a total of 11 subcategories.

[0013] Further, step S2 includes the following steps:

[0014] S201, sending the training samples in the PCB component database into the improved feature extraction network and detection network structure, using Kaiming initialization method to set the learning rate iteration number and batch size value of the improved feature extraction network and detection network training, wherein the improved feature extraction network and detection network synthesize the PCB target detection network of the present invention;

[0015] S202, the training sample first passes through an improved feature extraction network, which includes a Stem Block module and three modules consisting of a Dense Block and a Transition Layer, and finally obtains a high-level feature map;

[0016] S203, input the high-level feature map in S202 into the RPN network, which is mainly used to generate a region candidate box; first, several anchor boxes are generated, one branch cuts and screens them, and then uses softmax to determine whether the anchors belong to the foreground, and the other branch corrects the anchor box bounding box to form a more accurate candidate box;

[0017] S204, inputting the high-level feature map generated in step S202 and the candidate box generated in step S203 into a context-aware ROI pooling layer to obtain a fixed-size candidate box feature map;

[0018] S205, inputting the fixed-size candidate box feature map generated in step S204 into the fully connected layer and the softmax layer, calculating the probability that each candidate box contains each PCB component, and using bounding box regression to obtain a more accurate target detection box;

[0019] S206. When the maximum number of iterations is reached or the loss function converges, the training is stopped to obtain a target detection network and a weight file for detecting PCB components.

[0020] Furthermore, the improved feature extraction network and detection network structures are:

[0021]

[0022] The training sample or test sample is input into the network from the 0th convolutional layer, processed by the 0th, 1st, 2nd, …, 6th layers in sequence, and finally output from the 6th fully connected layer.

[0023] Furthermore, the Stem Block module in step S202 includes the following process: first perform a convolution operation with a step size of 2 and a convolution kernel of 32×3×3, and then divide it into two channels, one of which undergoes a convolution operation with a step size of 1, a convolution kernel of 32×1×1 and a step size of 2, a convolution kernel of 32×3×3; the other channel undergoes a convolution operation with a step size of 1, a convolution kernel of 32×1×1 and a maximum pooling operation with a step size of 2 and 2×2. The feature maps obtained from the two channels are fused according to the channel dimension, and then a convolution operation with a step size of 1 and a convolution kernel of 32×1×1 is performed. The Dense Block is composed of several Dense Layers. The specific process of the Dense Layer is as follows: one channel uses two 1x1 convolutions for feature extraction, and the other channel undergoes two layers of 3×3 convolutions after the 1×1 convolution, and finally the feature maps of the two channels are fused.

[0024] Furthermore, the anchor sizes used in step S203 are 16×8, 16×16, 16×32, 32×16, 32×32, 32×64, 64×32, 64×64 and 64×128 respectively.

[0025] Furthermore, in step S204, the context-aware ROIPooling layer uses a bilinear deconvolution kernel for upsampling to expand the feature area of ​​the small candidate box to avoid distortion of the target object after pooling.

[0026] Further, step S3 includes the following steps:

[0027] S301, sending the test sample to the target detection network obtained in step S2, and obtaining a high-level feature map through the improved feature extraction network and detection network;

[0028] S302, sending the high-level feature map to the RPN network and the context-aware ROI pooling layer to obtain the candidate box feature map, and then sending it to the fully connected layer to obtain the category confidence and bounding box regression position of the candidate box;

[0029] S303, setting a threshold, filtering low confidence bounding boxes, using non-maximum suppression to remove redundant bounding boxes, and then obtaining the final detection result through the classification layer.

[0030] Beneficial effects: Compared with the prior art, the lightweight network-based PCB component detection method of the present invention can accurately locate and detect PCB components with fewer samples and smaller targets. The method has the characteristics of low memory consumption, low calculation amount, high detection speed, strong robustness, etc. The present invention has high efficiency and low cost in PCB component detection and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is the overall flow chart of the present invention;

[0032] Figure 2 is a flow chart of step S1 of the present invention;

[0033] Figure 3 is a flow chart of step S2 of the present invention;

[0034] Figure 4 is a flow chart of step S3 of the present invention;

[0035] Figure 5 This is a picture of PCB component detection results. DETAILED DESCRIPTION

[0036] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0037] Printed Circuit Board (PCB), that is, printed circuit board, is the provider of electrical connections for electronic components. The present invention takes high-definition samples from the PCB production workshop and trains a neural network to detect whether the produced PCB has quality problems such as missing soldering, wrong soldering, wrong insertion and missing insertion. First, data augmentation is performed on a small number of PCB component samples, and 11 types of components therein are labeled to obtain a component database; then, the component database used for training is sent to a deep neural network for training until the deep learning network converges; finally, the trained deep neural network and weight file are used to detect the PCB component targets in the test image, and the detection results are output. The present invention has a fast detection speed and high detection accuracy, which solves the shortcomings of low efficiency and low reliability of traditional manual detection, and also solves the disadvantages of high operation requirements of automatic optical detection equipment and susceptibility to interference from the external environment.

[0038] like Figure 1 As shown, the PCB component detection method based on lightweight network designed by the present invention includes the following steps:

[0039] S1. Shoot high-definition PCB component samples, perform data augmentation on a small number of PCB component samples, label various components therein, and obtain a PCB component database, which includes PCB component training samples and PCB component test samples;

[0040] like Figure 2 As shown, first, the PCB data set is classified and labeled. The PCB component data can be divided into five categories: capacitors, chips, resistors, transistors, and diodes. Each category has several subcategories, a total of 11 subcategories; and the 11 categories of components are labeled to obtain the PCB component database; the PCB component database includes test samples and training samples.

[0041] Next, the original image with a resolution of 2048×2048 is cut into a size of 1024×1024. The small target objects contained in the image are augmented by oversampling and copying and pasting small targets in the image multiple times.

[0042] Finally, data augmentation operations are performed on the PCB component dataset with a small amount of data, including: randomly flipping, rotating, scaling, cropping, translating, adjusting contrast, color jittering, and adding noise to the preprocessed images.

[0043] S2, sending the PCB component training samples to the deep neural network for training until the deep learning network converges, and obtaining the target detection network and weight file for detecting PCB components;

[0044] First, inspired by PeleeNet, the present invention designs a feature extraction network for the features of smaller PCB components. Table 1 shows the original PeleeNet recognition network structure, and Table 2 shows the improved feature extraction network (Table 2 Stages 0-3) and detection network structure (Table 2 Stages 4-6).

[0045] Table 1

[0046]

[0047]

[0048] Table 2

[0049]

[0050] like Figure 3 As shown, the specific expansion steps of step S2 are as follows:

[0051] S201, sending the training samples in the PCB component database to the improved feature extraction network and detection network structure, using Kaiming initialization to set the learning rate iteration number and batch size value of the network training. Among them, the improved feature extraction network and detection network synthesize the PCB target detection network of the present invention.

[0052] S202. Inspired by the lightweight network PeleeNet, the training data first passes through an improved feature extraction network, which includes a Stem Block and three modules consisting of a Dense Block and a Transition Layer, and finally obtains a high-level feature map.

[0053] Furthermore, inspired by the lightweight network PeleeNet, the present invention selects the first four stages of its feature extraction network (stages 0-4 in Table 1) and discards the last stage. The first stage is a Stem Block, and the following three stages are composed of several dual-channel Dense Layers and Transition Layers. Stem Block and Dense Layer perform feature fusion acquisition in a dual-channel manner to enhance the semantic expression ability of features.

[0054] Furthermore, the specific process of Stem Block is as follows: first, a convolution operation with a stride of 2 and a convolution kernel of 32×3×3 is performed, and then it is divided into two channels, one of which undergoes a convolution operation with a stride of 1, a convolution kernel of 32×1×1 and a stride of 2, a convolution kernel of 32×3×3; the other channel undergoes a convolution operation with a stride of 1, a convolution kernel of 32×1×1 and a maximum pooling operation with a stride of 2 and 2×2. The feature maps obtained from the two channels are fused according to the channel dimension, and then a convolution operation with a stride of 1 and a convolution kernel of 32×1×1 is performed. Dense Block consists of several Dense Layers. The specific process of Dense Layer is as follows: one channel uses two 1x1 convolutions for feature extraction, and the other channel undergoes two layers of 3×3 convolutions after 1×1 convolution, and finally the feature maps of the two channels are fused.

[0055] S203, input the high-level feature map in step S202 into the RPN network, mainly used to generate region candidate boxes. First, several anchor boxes are generated. One branch cuts and filters them and then uses softmax to determine whether the anchors belong to the foreground. Another branch corrects the anchor box bounding box to form a more accurate candidate box.

[0056] Furthermore, in order to obtain accurate candidate bounding boxes of vehicle targets, the anchor sizes used by the improved target detection network of the present invention are 16×8, 16×16, 16×32, 32×16, 32×32, 32×64, 64×32, 64×64, and 64×128. Since the target size is too small in the aerial image and it is difficult to detect the vehicle, a smaller anchor size is designed to solve the problem of difficult vehicle detection, and finally the vehicle target candidate bounding box data is output from the RPN network.

[0057] S204, inputting the high-level feature map generated in step S204 and the candidate box generated in step S203 into a context-aware ROI pooling layer to obtain a fixed-size candidate box feature map.

[0058] S205: Input the fixed-size candidate box feature map generated in step S204 into the fully connected layer and the softmax layer, calculate the probability that each candidate box contains each PCB component, and use bounding box regression to obtain a more accurate target detection box

[0059] S206. When the maximum number of iterations is reached or the loss function converges, the training is stopped to obtain a target detection network and a weight file for detecting PCB components.

[0060] S3. Use the trained deep learning network and weight file to detect the PCB component targets in the test image and output the detection results.

[0061] like Figure 4 As shown, step S3 includes the following steps:

[0062] S301, sending the test image to the object detection network of the present invention, and obtaining a high-level feature map through the feature extraction network of step S202;

[0063] S302, sending the high-level feature map to the RPN network and the context-aware ROI pooling layer to obtain the candidate box feature map, and then connecting the fully connected layer to obtain the category confidence and bounding box regression position of the candidate box;

[0064] S303, setting a threshold, filtering low confidence bounding boxes, using non-maximum suppression to remove redundant bounding boxes, and then obtaining the final detection result through the classification layer.

[0065] Figure 5 The figure is a PCB component detection result obtained by using the present invention (the target is marked with a dotted box). The final detection accuracy mAP of the present invention on the collected data set is 84.3%, and the obtained model size is 1.7M. The number of model parameters is greatly reduced compared with other models. It has the advantages of fast detection speed and small number of parameters while ensuring competitive detection accuracy. It is a lightweight detection method.

Claims

1. A PCB component detection method based on a lightweight network, characterized in that: The following steps are involved: S1. Photograph high-definition PCB component samples, perform data augmentation on the PCB component samples, label various components therein, and obtain a PCB component database, which includes PCB component training samples and PCB component test samples; when labeling, divide the PCB components into major categories, and then label several subcategories under the same major category; S2, sending the PCB component training samples to the deep neural network for training until the deep learning network converges, and obtaining the target detection network and weight file for detecting PCB components; comprising the following steps: S201, sending the training samples in the PCB component database to the improved feature extraction network and detection network structure, using Kaiming initialization method to set the learning rate iteration number and batch size value of the improved feature extraction network and detection network training; S202, the training sample first passes through an improved feature extraction network, which includes a Stem Block module and three modules consisting of a Dense Block and a Transition Layer, and finally obtains a high-level feature map; The Stem Block module includes the following process: first perform a convolution operation with a stride of 2 and a convolution kernel of 32×3×3, then divide it into two channels, one of which undergoes a convolution operation with a stride of 1, a convolution kernel of 32×1×1 and a convolution operation with a stride of 2 and a convolution kernel of 32×3×3; the other channel undergoes a convolution operation with a stride of 1, a convolution kernel of 32×1×1 and a maximum pooling operation with a stride of 2 and 2×2; the feature maps obtained from the two channels are fused according to the channel dimension, and then a convolution operation with a stride of 1 and a convolution kernel of 32×1×1 is performed; the Dense Block consists of several Dense Layers, and the specific process of the Dense Layer is as follows: one channel uses two 1x1 convolutions for feature extraction, and the other channel undergoes two layers of 3×3 convolutions after the 1×1 convolution, and finally the feature maps of the two channels are fused; S203, input the high-level feature map in S202 into the RPN network, which is mainly used to generate a region candidate box; first, several anchor boxes are generated, one branch cuts and screens them, and then uses softmax to determine whether the anchors belong to the foreground, and the other branch corrects the anchor box bounding box to form a more accurate candidate box; S204, inputting the high-level feature map generated in step S202 and the candidate box generated in step S203 into the context-aware ROI pooling layer to obtain a fixed-size candidate box feature map; the context-aware ROIPooling layer uses a bilinear deconvolution kernel upsampling to expand the feature area of ​​the small candidate box to avoid distortion of the target object after pooling; S205, inputting the fixed-size candidate box feature map generated in step S204 into the fully connected layer and the softmax layer, calculating the probability that each candidate box contains each PCB component, and using bounding box regression to obtain a more accurate target detection box; S206, when the maximum number of iterations is reached or the loss function converges, stop training, and obtain a target detection network and weight file for detecting PCB components; The improved feature extraction network and detection network structure are: The training sample or test sample is input into the network from the 0th convolutional layer, processed by the 0th, 1st, 2nd, …, 6th layers in sequence, and finally output from the 6th fully connected layer; S3. Use the deep learning network and weight file trained in step S2 to detect the PCB component targets in the PCB component test sample and output the detection results.

2. The PCB component detection method based on lightweight network according to claim 1 is characterized in that: The operation of data augmentation for the PCB component sample in step S1 includes: randomly performing horizontal or vertical flipping, rotation, scaling, cropping, translation, contrast adjustment, color dithering and noise addition operations on the pre-processed image.

3. The PCB component detection method based on lightweight network according to claim 2 is characterized in that: Image preprocessing refers to cutting the original image with a resolution of 2048×2048 into a size of 1024×1024.

4. The PCB component detection method based on lightweight network according to claim 1 is characterized in that: The PCB component sample in step S1 includes 11 categories of PCB components, specifically including five categories of capacitors, chips, resistors, transistors and diodes, and each category has 11 subcategories.

5. The PCB component detection method based on lightweight network according to claim 1 is characterized in that: In step S203, the anchor sizes used are 16×8, 16×16, 16×32, 32×16, 32×32, 32×64, 64×32, 64×64 and 64×128 respectively.

6. The PCB component detection method based on lightweight network according to claim 1 is characterized in that: Step S3 includes the following steps: S301, sending the test sample to the target detection network obtained in step S2, and obtaining a high-level feature map through the improved feature extraction network and detection network; S302, sending the high-level feature map to the RPN network and the context-aware ROI pooling layer to obtain the candidate box feature map, and then sending it to the fully connected layer to obtain the category confidence and bounding box regression position of the candidate box; S303, setting a threshold, filtering low confidence bounding boxes, using non-maximum suppression to remove redundant bounding boxes, and then obtaining the final detection result through the classification layer.