A PCBA Appearance Inspection Method and Apparatus
Through deep learning and machine vision technology, combined with Darknet-53 and FPN pyramid feature detection network, the problems of low detection efficiency and poor compatibility of complex three-dimensional components are solved, and efficient and accurate mis-welding and missed welding detection is achieved, reducing the problem of low detection efficiency of traditional PCBA and low-compatibility of complex three-dimensional components. labor costs.
Patent Information
- Application Number
- CN202111292576.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-03
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-11-03
AI Technical Summary
Traditional PCBA appearance inspection mainly relies on manual vision, resulting in high labor intensity, workers are prone to fatigue and low detection efficiency, making it difficult to compatible with the installation of complex three-dimensional electronic components.
Using deep learning-based machine vision detection method, the binarized segmentation and component recognition of standard PCBA images, combined with Darknet-53 and FPN pyramid feature detection network training model, calculate the area cross ratio of component positions IOU to judge the wrong welding and missed welding, use PCBA placement slots to ensure consistent placement position and uniform lighting of the light source.
It reduces labor costs, improves detection efficiency, realizes efficient detection of complex three-dimensional electronic components, and improves detection accuracy and accuracy.
Smart Images

Figure CN114004815B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of industrial visual inspection and relates to a PCBA appearance inspection method and device. Background Art
[0002] PCBA (Printed Circuit Board Assembly) refers to the finished printed circuit board made by SMT (Surface Mounted Technology) patch or DIP (Dual In-line Package) plug-in. It has been widely used in various electronic products, covering communication networks, home appliances, industrial control, consumer electronics, medical electronics, aerospace and other fields.
[0003] As electronic products develop towards low power consumption, lightweight, and intelligent, the assembly density and integration of printed circuit boards are getting higher and higher, so PCBA appearance inspection is very important. Traditional PCBA appearance inspection mainly uses manual visual inspection to detect whether electronic components have problems such as wrong soldering and leaking soldering. However, this inspection method has high labor intensity, workers are prone to fatigue, and the inspection efficiency is low.
[0004] The detection method based on machine vision has the advantages of non-contact, fast speed and high precision, and has achieved good results in flat PCB detection. The general detection steps include target positioning, template registration, template comparison and other operations. For example, the Chinese inventor's patent application "A method and device for detecting the polarity of circuit board components based on convolutional neural network" with application number 201711189432.1 and publication date 4 and 6, 2018 discloses a method for detecting the polarity of circuit board components based on convolutional neural network, adjusting the camera installation height and shooting parameters and adjusting the lighting source, selecting a certain number of circuit boards and establishing a database of target component images with correct and incorrect polarity, using the target component images of the circuit boards with correct and incorrect polarity obtained as input images of the convolutional neural network for training and optimization, and obtaining the optimized polarity feature classifier, the camera shoots the circuit board to be detected and performs Gaussian filtering to obtain the noise-eliminating target component image to be detected, the polarity feature classifier judges the filtered target component image to obtain the final detection result, and the judged target component image is used as the learning object of the polarity feature classifier.
[0005] Although the above-mentioned existing technologies have the advantages of being fast, accurate, and reliable, and can speed up the detection of circuit board components, for PCBA, three-dimensional electronic components of different specifications are mounted on its surface, and tilted installation is relatively common, making traditional PCB detection methods difficult to be compatible. Summary of the invention
[0006] The purpose of the present invention is to improve the inspection efficiency of PCBA with complex three-dimensional electronic components mounted on the surface by using a machine vision inspection method.
[0007] The present invention solves the above technical problems through the following technical solutions:
[0008] A PCBA appearance detection method comprises the following steps:
[0009] S1. Place the standard PCBA into the PCBA placement slot and acquire a standard PCBA image;
[0010] S2, performing binary segmentation processing on the standard PCBA image, obtaining the PCBA regional mask, and locating the PCBA image;
[0011] S3, applying the component model obtained through deep learning training to the standard PCBA image, extracting and identifying each component in the standard PCBA image;
[0012] S4, obtaining the position information of each component on the standard PCBA according to the regional mask of the PCBA and the identification results of the components;
[0013] S5, placing the PCBA to be tested into the PCBA placement slot, collecting the image of the PCBA to be tested, and then performing binary segmentation and component recognition to obtain the position information of each component on the PCBA to be tested;
[0014] S6. Compare the component position information of the PCBA board to be tested with the component position information of the standard PCBA board one by one, calculate the area intersection ratio IOU of each corresponding annotation box, output the test results and save them to the database.
[0015] It solves the problems of traditional PCBA appearance inspection which mainly relies on manual visual inspection, resulting in high labor intensity, easy fatigue of workers, and low inspection efficiency, thus reducing labor costs and improving inspection efficiency.
[0016] As a further improvement of the technical solution of the present invention, the method for obtaining the component model through deep learning training described in step S3 is:
[0017] S31, prepare multiple PCBA boards as training samples, and place the PCBA boards into the placement slots one by one;
[0018] S32, the camera collects images of the PCBA boards one by one and stores them in the PCBA image training set;
[0019] S33, annotate the collected PCBA board image offline, using a dotted frame to represent the annotation frame, an icon to represent the annotated components, and text to represent the component label;
[0020] S34, input the labeled image training set into Darknet-53 and train it with FPN pyramid feature detection network to obtain models of components of different models and specifications; the specific process of the Darknet-53 with FPN pyramid feature detection network is as follows: first, use a 3x3 convolution kernel with a step size of 1 to perform preliminary feature extraction on the original 416*416*3 input, and then use a 3x3 convolution kernel with a step size of 2 to downsample the feature map; then pass through a residual layer and perform downsampling, at this time the image resolution is 104*104; after passing through 8 residual layers, downsample again to obtain a feature map with a resolution of 52*52; then pass through 8 residual layers in sequence, and downsample again to obtain a feature map with a resolution of 26*26; finally, pass through 4 residual layers to obtain a feature map with a resolution of 13*13; use the target detection head on the feature maps with resolutions of 13*13, 26*26, and 52*52 to obtain structured target detection output;
[0021] As a further improvement of the technical solution of the present invention, the calculation of the area intersection ratio IOU of each corresponding detection frame described in step S6 is specifically: IOU = (A∩B) / (A∪B), and a judgment threshold K is set. If IOU≤K, it is judged that the position installation of the component is abnormal; if IOU>K, it means that the position installation of the component is normal, wherein A represents the area of the detection frame corresponding to the component of the PCBA board to be detected, and B represents the area of the detection frame corresponding to the component of the standard PCBA board, 0≤IOU<1, 0≤K<1.
[0022] As a further improvement of the technical solution of the present invention, the marking box in step S6 is a rectangular box, and the specific format is: Lab0(N), (X N , Y N , L N , W N ); where Lab() represents the detection category, N represents the number of samples, and N is a positive integer; X N , Y N Respectively represent the image coordinate position of the upper left corner of the rectangular box, L N , W N The length and width of the rectangle respectively.
[0023] As a further improvement of the technical solution of the present invention, the detection result described in step S6 is: if the PCBA board to be detected is compared with the standard PCBA board of the corresponding model, the types of components at the same position are different, then the components of the PCBA board to be detected are wrongly soldered; if the PCBA board to be detected is compared with the standard PCBA board of the corresponding model, there are components on the standard PCBA board at the same position, but there are no components on the PCBA board to be detected, then the components of the PCBA board to be detected are leaked.
[0024] A PCBA board appearance detection device based on the PCBA board appearance online detection method comprises: a computer, a camera, a light source, and a PCBA placement slot, wherein the camera is connected to the computer, the PCBA placement slot is used to place the PCBA board, and the light source is installed above the PCBA placement slot for system illumination; wherein the field of view of the camera covers the PCBA placement slot, and the irradiation area of the light source covers the PCBA placement slot; and the slot size of the PCBA placement slot is equal to the appearance size of the PCBA.
[0025] The advantages of the present invention are:
[0026] (1) The PCBA appearance inspection method of the present invention applies the component model obtained by deep learning training to the standard PCBA image, extracts and identifies each component in the standard PCBA image; compares the component position information of the PCBA board to be inspected with the component position information of the standard PCBA board one by one, and calculates the area intersection ratio (IOU) of each corresponding annotation box to determine whether there is wrong soldering or leaking soldering of the electronic components, thereby solving the problem that the traditional PCBA appearance inspection mainly adopts manual visual inspection, which brings high labor intensity, easy fatigue of workers, and low inspection efficiency, reduces labor costs, and improves inspection efficiency.
[0027] (2) In the PCBA placement slot of the PCBA appearance inspection device of the present invention, the placement position and posture of the PCBA are guaranteed to be consistent each time, so the deviation of the region of interest in the image is small; at the same time, the appearance color of the PCBA placement slot is single, and there is a large color difference with the color of the PCBA, which is conducive to the subsequent accurate segmentation and positioning of the region of interest of the PCBA, and the device structure is simple and the cost is low. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 The PCBA appearance inspection device according to an embodiment of the present invention;
[0029] Figure 2 is a flow chart of a PCBA appearance inspection method according to an embodiment of the present invention;
[0030] Figure 3 This is a schematic diagram of the PCBA board marking of an embodiment of the present invention;
[0031] Figure 4 It is a deep learning network model diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and specific embodiments:
[0034] Example
[0035] like Figure 1 As shown, a PCBA board appearance detection device includes: a computer, a camera, a light source, and a PCBA placement slot, wherein the camera is connected to the computer, the PCBA placement slot is used to place the PCBA board, and the light source is installed above the PCBA placement slot for system illumination; wherein the field of view of the camera can cover the PCBA placement slot, the light source irradiation area also needs to cover the PCBA placement slot, and the light intensity distribution is relatively uniform; the slot size of the PCBA placement slot is equal to the appearance size of the PCBA, and the PCBA board can be placed in the PCBA placement slot, ensuring that the placement position and posture of the PCBA are consistent each time, so that the offset of the area of interest in the image is small; at the same time, the appearance color of the PCBA placement slot is single, and there is a large color difference with the color of the PCBA, which is conducive to the subsequent accurate segmentation and positioning of the PCBA area of interest.
[0036] like Figure 2 As shown, a PCBA board appearance detection method includes the following steps:
[0037] 1. Place the standard PCBA into the PCBA placement slot and acquire a standard PCBA image;
[0038] 2. Perform binary segmentation on the standard PCBA image to obtain the regional mask of the PCBA and realize the positioning of the PCBA;
[0039] 3. Apply the standard electronic component model obtained through deep learning training to the standard PCBA image to extract and identify the components in the standard PCBA image;
[0040] The method of deep learning training is:
[0041] 1) Prepare a sufficient number of PCBAs as training samples;
[0042] 2) Place the PCBAs into the slots one by one;
[0043] 3) The camera collects images of the PCBA one by one and stores them in the PCBA image training set. Note that the number of images in the PCBA image training set must reach a certain number, generally more than a thousand;
[0044] 4) Offline annotation of PCBA image training set images, collect a large number of PCBA component images, annotate the special-shaped categories of interest, and store the specific annotation results in VOC format for deep learning training. The annotation diagram is shown in the figure below. Figure 3 As shown, the dotted box represents the annotation box, the icon represents the annotated component, and the text represents the label of the component. The figure only shows the annotation examples of resistors, capacitors, inductors and diodes;
[0045] The offline annotation is performed using a rectangular frame, specifically:
[0046] Step 1: Collect a standard PCBA board image;
[0047] Step 2: Mark the target components on the image board with a rectangular frame. The specific format is:
[0048] Lab0(1), (X1, Y1, L1, W1);
[0049] Lab0(2), (X2, Y2, L2, W2);
[0050] …
[0051] Lab0(N), (XN, YN, LN, WN);
[0052] Among them, Lab() represents the detection category, N represents the number of samples, and N is a positive integer; X N , Y N Respectively represent the image coordinate position of the upper left corner of the rectangular box, L N , W N The length and width of the rectangle respectively.
[0053] Setp3: Save the results as a comparison information template.
[0054] 5) By inputting the labeled image training set into the deep learning network for training, models of components of different models and specifications can be obtained.
[0055] like Figure 4 As shown, the basic backbone network of the deep learning network model adopts Darknet-53, which is matched with the FPN pyramid feature detection network. Darknet-53 is a fully convolutional network, does not contain a fully connected layer, and uses a large number of residual units.
[0056] First, a 3x3 convolution kernel with a step size of 1 is used to perform preliminary feature extraction on the original 416*416*3 input, and then a 3x3 convolution kernel with a step size of 2 is used to downsample the feature map.
[0057] After passing through another residual layer, the image is downsampled to a resolution of 104*104. After passing through 8 residual layers, the image is downsampled again to obtain a feature map with a resolution of 52*52. After passing through 8 residual layers, the image is downsampled again to obtain a feature map with a resolution of 26*26. After passing through 4 residual layers, the image is finally downsampled to obtain a feature map with a resolution of 13*13.
[0058] The object detection head is used on feature maps with resolutions of 13*13, 26*26, and 52*52 to obtain structured object detection output.
[0059] Taking the 13*13 feature map as an example, using the fully convolutional network, we get a 13*13*(3*(6+c)) feature representation. For the 13*13 original image grid division, each grid can predict 3 target boxes. The information of each target box includes the probability of c categories, the coordinate information of the target box, the object discrimination information and the angle information. The 13*13 and 26*26 resolution feature maps will also be upsampled and fused with the 26*26 and 52*52 resolution features, respectively, to achieve information flow in the spatial pyramid, ensuring the compatibility and balance of high-order semantic information and low-order detail information in the high-resolution feature map.
[0060] 4. According to the regional mask of PCBA and the identification results of components, the location information of each component on the standard PCBA is obtained;
[0061] 5. Place the PCBA to be tested into the PCBA placement slot, collect the image of the PCBA to be tested, and then perform binary segmentation and component identification to obtain the position information of each component on the PCBA board to be tested;
[0062] 6. Compare the component position information of the PCBA board to be tested with the component position information of the standard PCBA board one by one, calculate the difference between the two, output the detection results such as wrong soldering and leak soldering, and save the detection results to the database for subsequent retrieval and query.
[0063] Calculate the area intersection over (IOU) ratio of each corresponding detection frame, IOU = (A∩B) / (A∪B). If IOU≤0.6 is set, it is considered to be abnormal installation. If IOU≥0.6, it means that the installation is normal. The IOU threshold can be adjusted according to the actual situation.
[0064] If the types of components on the same position of the PCBA board to be tested are different from those of the standard PCBA board of the corresponding model, the components of the PCBA board to be tested are incorrectly soldered.
[0065] If the PCBA board to be tested is compared with the standard PCBA board of the corresponding model, and there are components on the standard PCBA board at the same position, but there are no components on the PCBA board to be tested, then the components of the PCBA board to be tested are leaked.
[0066] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A PCBA appearance inspection method, It is characterized in that The following steps are involved: S1. Place the standard PCBA into the PCBA placement slot and acquire a standard PCBA image; S2, performing binary segmentation processing on the standard PCBA image, obtaining the PCBA regional mask, and locating the PCBA image; S3, applying the component model obtained through deep learning training to the standard PCBA image, extracting and identifying each component in the standard PCBA image; The method of obtaining the component model through deep learning training is as follows: S31, prepare multiple PCBA boards as training samples, and place the PCBA boards into the placement slots one by one; S32, the camera collects images of the PCBA boards one by one and stores them in the PCBA image training set; S33, annotate the collected PCBA board image offline, using a dotted frame to represent the annotation frame, an icon to represent the annotated components, and text to represent the component label; S34, input the labeled image training set into Darknet-53 and train it with FPN pyramid feature detection network to obtain models of components of different models and specifications; the specific process of the Darknet-53 with FPN pyramid feature detection network is as follows: first, use a 3x3 convolution kernel with a step size of 1 to perform preliminary feature extraction on the original 416*416*3 input, and then use a 3x3 convolution kernel with a step size of 2 to downsample the feature map; then pass through a residual layer and perform downsampling, at this time the image resolution is 104*104; after passing through 8 residual layers, downsample again to obtain a feature map with a resolution of 52*52; then pass through 8 residual layers in sequence, and downsample again to obtain a feature map with a resolution of 26*26; finally, pass through 4 residual layers to obtain a feature map with a resolution of 13*13; use the target detection head on the feature maps with resolutions of 13*13, 26*26, and 52*52 to obtain structured target detection output; S4, obtaining the position information of each component on the standard PCBA according to the regional mask of the PCBA and the identification results of the components; S5, placing the PCBA to be tested into the PCBA placement slot, collecting the image of the PCBA to be tested, and then performing binary segmentation and component recognition to obtain the position information of each component on the PCBA to be tested; S6. Compare the component position information of the PCBA board to be tested with the component position information of the standard PCBA board one by one, calculate the area intersection ratio IOU of each corresponding annotation box, output the test results and save them to the database.
2. The PCBA board appearance online detection method according to claim 1, It is characterized in that The calculation of the area intersection ratio IOU of each corresponding detection frame described in step S6 is specifically: IOU = (A∩B) / (A∪B), and a judgment threshold K is set. If IOU≤K, it is judged that the position installation of the component is abnormal; if IOU>K, it means that the position installation of the component is normal, where A represents the area of the detection frame corresponding to the component of the PCBA board to be detected, B represents the area of the detection frame corresponding to the component of the standard PCBA board, 0≤IOU<1, 0≤K<1.
3. The PCBA board appearance online detection method according to claim 1, It is characterized in that The labeling box in step S6 is a rectangular box, and the specific format is: Lab0(N), (X N , Y N , L N , W N ); where Lab() represents the detection category, N represents the number of samples, and N is a positive integer; X N , Y N Respectively represent the image coordinate position of the upper left corner of the rectangular box, L N , W N The length and width of the rectangle respectively.
4. The PCBA board appearance online detection method according to claim 1, It is characterized in that The detection result described in step S6 is: if the types of components at the same position of the PCBA board to be detected are different from those of the standard PCBA board of the corresponding model, the components of the PCBA board to be detected are wrongly soldered; if the types of components at the same position of the PCBA board to be detected are different from those of the standard PCBA board of the corresponding model, the components of the PCBA board to be detected are wrongly soldered; if the types of components at the same position of the PCBA board to be detected are different from those of the standard PCBA board of the corresponding model, the components of the PCBA board to be detected are not soldered.
5. A PCBA board appearance detection device based on the PCBA board appearance online detection method according to any one of claims 1 to 4, include: A computer, a camera, a light source, and a PCBA placement slot, wherein the camera is connected to the computer, the PCBA placement slot is used to place the PCBA board, and the light source is installed above the PCBA placement slot for system illumination; wherein the field of view of the camera covers the PCBA placement slot, and the illumination area of the light source covers the PCBA placement slot; and the slot size of the PCBA placement slot is equal to the appearance size of the PCBA.
Citation Information
Patent Citations
Method for detecting circuit board component polarity on the basis of convolutional neural network, and device
CN107886131A
PCB component detection method based on deep learning
CN110070536A
Industrial component appearance defect detection method based on deep learning
CN110658202A
Circuit board component defect detection method based on deep learning
CN113077453A
Implemented component inspection method
JP2004053369A
