A deep learning-based PCB board mark point accurate positioning method
By combining deep learning neural networks and white light interferometric displacement sensors, the problem of poor Mark point positioning accuracy on PCB boards was solved, achieving high-precision, fast positioning and widely applicable Mark point positioning results.
Patent Information
- Application Number
- CN202210339706.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-01
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2042-04-01
AI Technical Summary
In existing technologies, the positioning accuracy of PCB board Mark points is not good, which affects the accurate placement of components.
Using a deep learning-based approach, a neural network model and a white light interferometric displacement sensor are combined with feature extraction, attention module, size restoration and feature fusion modules to accurately locate the shape and position of the Mark point.
It achieves high-precision positioning of Mark points, is easy to design and build, has a wide range of applications, and offers fast segmentation speed. It is suitable for positioning objects of various fixed positions and shapes.
Smart Images

Figure CN115359118B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of PCB production, and particularly relates to a PCB Mark point accurate positioning method based on deep learning. BACKGROUND
[0002] In the production process of a PCB, after the PCB is completed, a Mark point (reference point) needs to be provided for the mounting of all components in the mounting process, and the machine will automatically position the Mark point for calibration to realize accurate mounting of components. In the actual production process, the circular Mark point is not flat around and has a concave phenomenon, which affects the positioning effect.
[0003] PCB circuit boards have many types and increasing numbers year by year, so improving the positioning accuracy of the Mark point is extremely important for the production process of the PCB. In the prior art, the position of the Mark point is first positioned by using a neural network, and then the shape of the Mark point is positioned by using a white light interference displacement sensor. Although this method is a feasible and effective method, its accuracy is not good enough. Therefore, one of the main topics for researchers to overcome is to research a PCB Mark point positioning method with higher accuracy. SUMMARY
[0004] Therefore, the purpose of the present application is to provide a PCB Mark point accurate positioning method based on deep learning, which solves the problem of poor accuracy when positioning the Mark point of the PCB in the prior art.
[0005] To achieve the above purpose, the technical scheme of the present application is as follows: a PCB Mark point accurate positioning method based on deep learning, which comprises the following steps:
[0006] S1, obtaining a PCB grayscale image containing a Mark point by using a camera device, marking the position of the Mark point at the same coordinates of another PCB grayscale image by using a marking tool, connecting all the marked Mark points into a closed circular region, and obtaining a PCB image;
[0007] S2, designing a neural network model;
[0008] S3, training the neural network model by using the PCB image and the marked image, inputting the PCB image into the trained neural network model for calculation, and obtaining a prediction image containing a first curve C1;
[0009] S4, increasing the radius of each place on the first curve C1 in the prediction map by μ%, obtaining a second curve C2, detecting the same position area Area between the first curve C1 and the second curve C2 in the prediction map by using a white light interference displacement sensor, and obtaining a region height distribution map;
[0010] S5, accurately positioning the shape of the Mark point by using the first curve C1 and the region height distribution map.
[0011] Preferably, in the S2, the neural network comprises a feature extraction module, an attention module, a size recovery module, and a feature fusion module; wherein,
[0012] Preferably, in the S2, the neural network comprises a feature extraction module, an attention module, a size recovery module, and a feature fusion module; wherein,
[0013] The feature extraction module is configured to extract feature information.
[0014] The attention module is connected with the feature extraction module and is configured to select important information of a processing object.
[0015] The size recovery module is connected with the attention module and is configured to recover the size of a feature map.
[0016] The feature fusion module is connected with the size recovery module and is configured to fuse feature information of different sizes.
[0017] Preferably, the feature fusion module comprises a convolution unit, an up-sampling unit, and a splicing operation unit.
[0018] Preferably, the attention module comprises a convolution unit, an element-wise addition unit, and a global average pooling unit.
[0019] Preferably, the feature extraction module comprises a plurality of feature extraction units; the size recovery module comprises a plurality of size recovery units; the feature extraction unit comprises two convolution layers and one maximum pooling layer; and the size recovery unit comprises an up-sampling layer and a convolution layer.
[0020] Preferably, in the S3, the trained neural network model is obtained by the following method:
[0021] During the training, each prediction map obtained by the training is compared with a labeled picture respectively. When the gray values of the same positions of the prediction map and the labeled picture are different, it represents that the prediction map has a loss. A fusion loss function and back propagation are used to update the parameter values of the neural network, and a trained neural network model is obtained.
[0022] Preferably, the fusion loss function is specifically:
[0023] L = a*L1 + (1-a)*L2 (0 < a < 1)
[0024] wherein L is a new fusion loss function, L1 is a cross-entropy loss function, L2 is an exponential loss function, and a is a weight value;
[0025] Preferably, the cross-entropy loss function is specifically:
[0026] L1 = - [y log y + (1-y) log (1-y)] pre pre )
[0027] wherein y is a pixel real gray value, and ypre is a pixel predicted gray value;
[0028] Preferably, the exponential loss function is specifically as follows:
[0029] L2 = (1-y*y) exp(-y*y) pre pre ).
[0030] Preferably, the specific method of S5 is:
[0031] S5.1, region height difference calculation: divide the first curve C1 into n regions according to angle, n≥1, and the angle of each region is 360 / n degrees, and then calculate the highest point height hmax and the lowest point height hmin of each region according to the height distribution diagram, and then calculate the height difference;
[0032] S5.2, region block division: then divide each region into m blocks according to angle, and the block number m depends on the height difference in the region, and the greater the height difference, the greater the block number m;
[0033] S5.3, offset the first curve C1: take the middle pixel a of each block as the representative of the block, draw a ray from the center to a, and calculate the maximum height difference d between the first curve C1 and the second curve C2 that the ray passes through l (the calculation method is the same as the formula in Step 5.1), and then calculate the offset amount E from d l .
[0034] S5.4, offset all pixels in the same block outward by E, and the offset direction is: the center is the end point, and the direction is the direction of the ray pointing to the pixel in the block; after offsetting, all the pixels are connected to form a closed third curve C3; repeat the step several times, and the third curve C3 is the accurately positioned PCB Mark point position and shape.
[0035] Preferably, in S5.1, the specific method for calculating the maximum height hmax and the minimum height hmin of each region according to the height distribution map is as follows:
[0036] After obtaining the height distribution map, the line roughness is extracted every certain angle in each region, the height values of all points in the line are recorded to form a height distribution curve, and the height distribution curve is converted into a curve subject to normal distribution by using a data analysis tool, the mathematical expectation value of the curve is μ, and the maximum value and the minimum value between 0 and μ-1 on the curve are hmax and hmin.
[0037] Preferably, the roughness is 360 / (n*k), wherein k is the number of times of acquiring roughness in each region.
[0038] Preferably, in S5.1, the specific calculation formula of the height difference is d = h max -h min .
[0039] Preferably, in S5.2, the value of m is calculated by the following formula:
[0040] wherein α1 is a coefficient, and 0<α1<1.
[0041] Preferably, in S5.3, the offset E is calculated by the following formula:
[0042] E = α2·d1 2 + β2
[0043] wherein α2 is a coefficient, and 0<α2<1; β2 is an offset, and β2 is an integer.
[0044] Compared with the prior art, by adopting the accurate determination method in the present application, the purposes of easy design and construction, fast segmentation speed, high precision, and wide applicable range are achieved. BRIEF DESCRIPTION OF DRAWINGS
[0045] Figure 1 It is a PCB picture described in the embodiment of the present application;
[0046] Figure 2 It is a labeled picture described in the embodiment of the present application;
[0047] Figure 3 It is a neural network structure diagram described in the embodiment of the present application;
[0048] Figure 4 It is a feature fusion module logic block diagram described in the embodiment of the present application;
[0049] Figure 5A logic block diagram of the attention module described in the embodiments of the present application;
[0050] Figure 6 A logic block diagram of the feature extraction module described in the embodiments of the present application;
[0051] Figure 7 A logic block diagram of the size recovery module described in the embodiments of the present application;
[0052] Figure 8 A height distribution map described in the embodiments of the present application;
[0053] Figure 9 A partition map described in the embodiments of the present application;
[0054] Figure 10 A block diagram described in the embodiments of the present application. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0056] The embodiment provides a PCB Mark point accurate positioning method based on deep learning, which comprises the following steps:
[0057] S1, obtaining a PCB grayscale image containing a Mark point by using a camera device, marking the position of the Mark point at the same coordinates of another PCB grayscale image by using a marking tool, connecting all the marked Mark points into a closed circular area, and obtaining a PCB image;
[0058] S2, designing a neural network model;
[0059] S3, training the neural network model by using the PCB image and the marked image, inputting the PCB image into the trained neural network model, and obtaining a prediction map containing a first curve C1 through calculation;
[0060] S4, increasing the radius of each point on the first curve C1 in the prediction map by μ%, obtaining a second curve C2, detecting the same position area Area between the first curve C1 and the second curve C2 in the prediction map by using a white light interference displacement sensor, and obtaining a region height distribution map;
[0061] S5, accurately positioning the shape of the Mark point by using the first curve C1 and the region height distribution map.
[0062] By adopting the above scheme, by adopting the above precise positioning method, the purposes of easy design and construction, fast segmentation speed, high precision, and wide application range are achieved; specifically: 1) the neural network is modularized, and the components of the module are widely used in industry and academia, easy to build, and the white light interference displacement sensor has mature products; 2) the industrial computer has powerful computing power to quickly locate the position, and the segmentation technology is mature and has been verified in a wide range; 3) various fixed positions and shapes of objects can be positioned by using this method. Moreover, the applicability of various units and modules in the network model is wide, and different fields only need to modify the modules of the model.
[0063] In the specific implementation process, in S2, the neural network comprises a feature extraction module, an attention module, a size recovery module, and a feature fusion module; wherein,
[0064] The feature extraction module is configured to extract feature information.
[0065] The attention module is connected with the feature extraction module and is configured to select important information of a processing object.
[0066] The size recovery module is connected with the attention module and is configured to recover the size of a feature map.
[0067] The feature fusion module is connected with the size recovery module and is configured to fuse feature information of different sizes.
[0068] In the specific implementation process, the feature fusion module comprises a convolution unit, an upsampling unit, and a splicing operation unit.
[0069] In the specific implementation process, the attention module comprises a convolution unit, an element-wise addition unit, and a global average pooling unit.
[0070] In the specific implementation process, the feature extraction module comprises a plurality of feature extraction units; the size recovery module comprises a plurality of size recovery units; the feature extraction unit comprises two convolution layers and a maximum pooling layer; and the size recovery unit comprises an upsampling layer and a convolution layer.
[0071] In the specific implementation process, in S3, the trained neural network model is obtained by the following method:
[0072] In the training process, each prediction map obtained by training is compared with a labeled picture. When the gray values of the same positions of the prediction map and the labeled picture are different, it represents that the prediction map has a loss, and the parameter values of the neural network are updated by using a fusion loss function and back propagation to obtain a trained neural network model.
[0073] In the specific implementation process, the fusion loss function is specifically:
[0074] L=α·L1+(1-α)·L2(0<α<1)
[0075] Wherein L is a new fusion loss function, L1 is a cross-entropy loss function, L2 is an exponential loss function, and a is a weight value.
[0076] The cross-entropy loss function is specifically:
[0077] L1=-[ylogy pre +(1-y)log(1-y pre )]
[0078] Wherein y is the real gray value of the pixel, and ypre is the predicted gray value of the pixel.
[0079] The exponential loss function is specifically as follows:
[0080] L2=(1-y·y pre )exp(-y·y pre )。
[0081] In the specific implementation process, the specific method of S4 is:
[0082] The radius of the first curve C1 in the predicted graph in S3 is increased by μ% to obtain the second curve C2. The calculation method of the second curve C2 is: if the radius of the p point in the first curve C1 is r, then the radius of the first curve C1 in the direction of the point is increased to (1+μ%) * r, μ is a threshold value, in order to avoid too large error, the value range of μ can be [10, 20]. The white light interference displacement sensor is used to detect the same position area Area between the first curve C1 and the second curve C2 in the PCB plate picture, as shown in Figure 8 , and the height distribution graph of the area is obtained.
[0083] In the specific implementation process, the specific method of S5 is:
[0084] S5.1, region height difference calculation: the first curve C1 is divided into n regions according to angle, n≥1, and the angle of each region is 360 / n degrees. The highest point height hmax and the lowest point height hmin of each region are calculated according to the height distribution graph, and then the height difference (as shown in Figure 9 ) is calculated.
[0085] S5.2, region blocking: each region is further divided into m blocks according to angle, and the number of blocks m depends on the height difference in the region. The larger the height difference, the larger the number of blocks m.
[0086] S5.3, offset the first curve C1: take the middle pixel a of each block as the representative of the block, draw a ray from the center to a, and calculate the maximum height difference d between the first curve C1 and the second curve C2 that the ray passes through l (Computing method same as formula in Step 5.1), d l Calculate the offset E;
[0087] S5.4, all pixels in the same block are offset outward, the offset is E, and the offset direction is: the center as the endpoint, pointing to the direction of the ray of the pixel in the block; After offsetting, all pixels are connected to form a closed third curve C3; Repeat this step several times, and the third curve C3 is the accurately positioned PCB Mark point position and shape.
[0088] In the specific implementation process, in S5.1, the specific method for calculating the maximum height hmax and the minimum height hmin of each region according to the height distribution diagram is:
[0089] After obtaining the height distribution diagram, the line roughness is extracted every certain angle in each region, the height values of all points in the line are recorded to make a height distribution curve, and then a data analysis tool is used to convert the height distribution curve into a curve subject to normal distribution, the mathematical expectation value of the curve is μ, and the maximum and minimum values between 0 and μ-1 on the curve are hmax and hmin.
[0090] In the specific implementation process, the roughness is 360 / (n*k), where k is the number of times of obtaining roughness for each region.
[0091] In the specific implementation process, in S5.1, the specific calculation formula of the height difference is: d = h max -h min .
[0092] In addition, the step of converting the height distribution curve into a curve subject to normal distribution is:
[0093] 1) First, calculate the skewness and kurtosis of the data. If the skewness value is 0, it is completely symmetric, if the skewness value is greater than 0, it means that the distribution of the data is positively skewed, and if the skewness value is less than 0, it means that the distribution of the data is negatively skewed; If the kurtosis value is 0, it means that the data distribution is appropriate, if the kurtosis value is greater than 0, it means that the data distribution is steep, and if the kurtosis value is less than 0, it means that the data distribution is flat.
[0094] 2) Determine the normal conversion method. If the skewness value and kurtosis value are not 0, it means that the normal conversion is to be done, and the corresponding conversion formula can be determined according to the distribution form of the data. If it is moderate skewness, the square root value can be considered for conversion; if it is high skewness, the logarithm can be taken, and the logarithm can be divided into natural logarithm and logarithm with 10 as the base; for bimodal and multimodal, the normal score conversion method of rank division can be used.
[0095] 3) If the problem is not solved, it needs to be done from the second step, and then go back to the inspection of the first step until the satisfactory result is achieved.
[0096] In the specific implementation process, in the S5.2, the number of m is calculated by the following formula ((as shown in the specific embodiment Figure 10 ):
[0097] Wherein, α1 is a coefficient, and 0 < α1 < 1.
[0098] In the specific implementation process, in the S5.3, the offset E is calculated by the following formula:
[0099] E = α2·d1 2 + β2
[0100] Wherein, α2 is a coefficient, and 0 < α2 < 1; β2 is an offset, and β2 is an integer.
[0101] All pixels in the same block are offset outward, and the offset is E, and the offset direction is: the center is the end point, and the direction of the ray pointing to the pixel in the block. After the offset, all the pixels are connected to form a new closed curve. Repeat the step several times, and the new closed curve is the accurately positioned PCB Mark point position and shape.
[0102] To sum up, by adopting the accurate positioning method of the application, the purposes of easy design and construction, fast segmentation speed, high precision, and wide application range are achieved. Specifically, 1) the neural network is modularized, and the components of the module are widely used in industry and academia, easy to build, and the white light interference displacement sensor has a very mature product; 2) the powerful computing power of the industrial computer quickly locates the position, and the segmentation technology tends to be mature and has been verified in a wide field; 3) various fixed positions and shapes of objects can be positioned by using this method. Moreover, the applicability of various units and modules in the network model is wide, and different fields only need to modify the modules of the model.
[0103] The above merely describes preferred specific embodiments of the present application, but the protection scope of the present application is not limited thereto, any changes or replacements within the technical scope disclosed by the present application, which can be easily thought by those skilled in the art, should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for precise positioning of Mark points on a PCB board based on deep learning, characterized in that, The method includes the following steps: S1. Use a camera to obtain a grayscale image of the PCB containing the Mark points. Then, use a marking tool to mark the positions of the Mark points at the same coordinates on another grayscale image of the PCB. Connect all the marked Mark points into a closed circular area to obtain the PCB image. S2. Design a neural network model; S3. Train the neural network model using the PCB board image and the labeled image. Input the PCB board image into the trained neural network model and calculate to obtain a prediction image containing the first curve C1. S4. Increase the radius of each point on the first curve C1 in the prediction map by μ% to obtain the second curve C2. Use a white light interferometric displacement sensor to detect the area at the same position between the first curve C1 and the second curve C2 in the prediction map to obtain the area height distribution map. S5. Use the first curve C1 and the regional height distribution map to accurately locate the shape of the Mark point; The specific method of S5 is as follows: S5.1 Calculation of regional height difference: Divide the first curve C1 into n regions according to the angle, n≥1, and the angle of each region is 360 / n degrees. Calculate the highest point height hmax and the lowest point height hmin of each region according to the height distribution map, and then calculate the height difference. S5.2, Region Segmentation: Divide each region into m blocks according to the angle. The number of blocks m depends on the height difference within the region. The greater the height difference, the greater the number of blocks m. S5.3, Offset the first curve C1: Take the middle pixel a of each block as the representative of that block, draw a ray from the center of the circle to a, and calculate the maximum height difference d between the first curve C1 and the second curve C2 through which the ray passes. l , by d l Calculate the offset E; S5.
4. All pixels within the same block are offset outward by an offset amount of E, and the offset direction is: with the center of the circle as the endpoint, pointing in the direction of the ray pointing to the pixel within the block; after offsetting, connect all pixels to form a closed third curve C3; repeat this step several times, and the third curve C3 is the precise location and shape of the PCB board Mark point.
2. The method for precise positioning of PCB board Mark points based on deep learning according to claim 1, characterized in that, In step S2, the neural network includes a feature extraction module, an attention module, a size restoration module, and a feature fusion module; wherein, The feature extraction module is used to extract feature information; The attention module is connected to the feature extraction module and is used to select important information of the object to be processed. The size restoration module, connected to the attention module, is used to restore the size of the feature map; The feature fusion module is connected to the size restoration module and is used to fuse feature information of different sizes.
3. The method for precise positioning of PCB board Mark points based on deep learning according to claim 2, characterized in that, The feature fusion module includes a convolutional unit, an upsampling unit, and a concatenation operation unit; the attention module includes a convolutional unit, an element-wise addition unit, and a global average pooling unit; the feature extraction module includes multiple feature extraction units; the size restoration module includes multiple size restoration units; the feature extraction unit includes two convolutional layers and one max pooling layer; the size restoration unit includes an upsampling layer and a convolutional layer.
4. The method for precise positioning of PCB board Mark points based on deep learning according to claim 1, characterized in that, In step S3, the trained neural network model is obtained through the following method: During training, each predicted image obtained from training is compared with the labeled image. When the gray values at the same position in the predicted image and the labeled image are different, it means that the predicted image has suffered a loss. The parameter values of the neural network are updated using the fusion loss function and backpropagation to obtain the trained neural network model.
5. The method for precise positioning of PCB board Mark points based on deep learning according to claim 4, characterized in that, The fusion loss function is specifically as follows: L = α·L1 + (1-α)·L2 (0 < α < 1) Where L is the new fusion loss function, L1 is the cross-entropy loss function, L2 is the exponential loss function, and α is the weight value; The cross-entropy loss function is specifically as follows: L1=-[ylogy pre +(1-y)log(1-y pre )] Where y is the true gray value of the pixel, and ypre is the predicted gray value of the pixel; The specific exponential loss function is as follows: L2=(1-y·y pre )exp(-y·y pre )。 6. The method for precise positioning of PCB board Mark points based on deep learning according to claim 5, characterized in that, In S5.1, the specific method for calculating the maximum height hmax and minimum height hmin of each region based on the height distribution map is as follows: After obtaining the height distribution map, the line roughness is extracted at certain angles in each region, and the height values of all points on the line are recorded to form a height distribution curve. Then, the height distribution curve is converted into a curve that follows a normal distribution using data analysis tools. The expected value of the curve is μ, and the maximum and minimum values between 0 and μ-1 on the curve are hmax and hmin, respectively. The roughness is 360 / (n*k), where k is the number of times the roughness is obtained for each region.
7. The method for precise positioning of PCB board Mark points based on deep learning according to claim 6, characterized in that, In S5.1, the specific formula for calculating the height difference is: d = h max -h min .
8. The method for precise positioning of PCB board Mark points based on deep learning according to claim 7, characterized in that, In S5.2, the value of m is calculated using the following formula: Where α1 is a coefficient, and 0 < α1 < 1.
9. A method for precise positioning of PCB board Mark points based on deep learning according to any one of claims 5-8, characterized in that, In S5.3, the offset E is calculated using the following formula: E=α2·d1 2 +β2 Where α2 is a coefficient, and 0 < α2 < 1; β2 is an offset, and β2 is an integer.
Citation Information
Patent Citations
High-precision and high anti-interference positioning method and device for Mark point of PCB
CN104732207A
PCB Mark point reflection light spot segmentation method based on deep learning
CN114202489A