Positioning calibration method of surface mounting equipment, equipment, medium and product
By combining image recognition models and iterative calculations with multi-source image fusion technology, the problem of inaccurate positioning and matching of surface mount equipment is solved, and high-precision positioning calibration is achieved in complex environments.
Patent Information
- Application Number
- CN202511164846.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-20
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-08-20
AI Technical Summary
During the positioning and matching process, existing surface mount equipment has inaccurate positioning and matching due to different environmental conditions, irregular equipment placement, irregular component shapes, and point obstruction.
An image recognition model is used to identify the pin positions of circuit board pads and components to be mounted, and the confidence levels are recorded. Through iterative calculation and confidence weighting, the influence of low-confidence position detection results on spatial mapping parameters is reduced. Combined with multi-source image fusion and an improved YOLOv7 network model, the accuracy of positioning and matching is improved.
It improves the positioning and matching accuracy of surface mount equipment, enhances the anti-interference ability in complex environments and irregular conditions, and ensures the stability and reliability of spatial mapping parameters.
Smart Images

Figure CN120659248A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of printed circuit boards, and in particular to a positioning and calibration method, equipment, medium and product of a surface mounting device. Background Art
[0002] Surface-mount technology (SMT) is a widely used technology in modern electronics manufacturing. It achieves miniaturization and high density in electronic products by mounting electronic components directly on printed circuit boards (PCBs). Visual positioning calibration of surface mount equipment is a critical step in ensuring precise component placement on circuit boards. This involves identifying and locating the pads on the circuit board and the pins of the component to be mounted, and establishing a positional mapping between the pads and component pins to achieve precise placement. However, current positioning and matching results are inaccurate due to varying environmental conditions, irregular equipment placement, irregular component shapes, and obstructed points.
[0003] How to improve the positioning and matching accuracy of surface mount devices is a technical problem that those skilled in the art need to solve. Summary of the Invention
[0004] The present invention provides a positioning calibration method, device, medium and product for a surface mount device, so as to at least solve the problem of inaccurate positioning and matching of the surface mount device in the related art.
[0005] The present invention provides a positioning and calibration method for a surface mount device, comprising: Acquire a circuit image of a circuit board and a component image of a component to be mounted; Using an image recognition model to respectively identify the circuit image and the component image, obtain a first position and a first confidence of a pad on the circuit board, and a second position and a second confidence of a component pin of the component to be mounted; Entering an iterative calculation, in the current iteration, matching the pad and the component pin, calculating the spatial mapping parameters based on the matched multiple pairs of the first position and the second position, performing position transformation calculation on the matched first position and the second position according to the spatial mapping parameters, and calculating the transformed position error according to the first confidence level and / or the second confidence level, until the end condition of the first iteration is reached, outputting the final matching result of the pad and the component pin and the corresponding final spatial mapping parameters.
[0006] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned positioning and calibration methods for surface mount devices when executing the computer program.
[0007] The present invention also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned positioning and calibration methods for surface mount devices are implemented.
[0008] The present invention also provides a computer program product, comprising a computer program, which implements the steps of any of the above-mentioned positioning and calibration methods for surface mount devices when executed by a processor.
[0009] Through the present invention, when the first position of the solder pad on the circuit board and the second position of the component pin of the component to be mounted are identified by using an image recognition model, the corresponding confidence is also recorded. When the matching calculation is performed based on the first position and the second position, an iterative calculation is performed, and the position of the matched solder pad and component pin in the current iteration is transformed. The position error after the transformation is calculated in combination with the confidence, so as to output the final matching result of the solder pad and component pin and the corresponding final spatial mapping parameter after the first iterative calculation condition is met. This can effectively reduce the influence of the low-confidence position detection result on the spatial mapping parameter calculation, ensure the stability and reliability of the final spatial mapping parameter, and have stronger anti-interference ability than the traditional position error calculation, and can better adapt to the recognition interference caused by different environmental conditions, irregular equipment placement, irregular component shape, point occlusion, etc., thereby improving the accuracy of positioning matching of high surface mount equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0011] Figure 1 A flow chart of a positioning and calibration method for a surface mount device provided by an embodiment of the present invention; Figure 2 A schematic structural diagram of a positioning and calibration system for a surface mount device provided by an embodiment of the present invention; Among them, 201 is a camera system and 202 is a detection device. DETAILED DESCRIPTION
[0012] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0013] It should be noted that, in the description of the present invention, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. The terms "first," "second," etc., in the present invention are used to distinguish similar objects, and are not used to describe a particular order or precedence.
[0014] In order to enable those skilled in the art to better understand the solutions of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0015] During the visual positioning calibration process of the surface mount equipment, a camera is used to take photos of the circuit board and the components to be mounted. These photos are input into the image recognition model to obtain the spatial coordinates of the pads on the circuit board and the spatial coordinates of the component pins to be mounted. A spatial mapping relationship between the two is established to achieve accurate automatic mounting.
[0016] However, there are various unfavorable conditions in practical applications that affect the accuracy of positioning and matching between pads and component pins.
[0017] First, under different ambient lighting conditions, especially when there are metal reflections or shadows, traditional single-light source imaging has difficulty providing stable image quality, resulting in blurring or loss of key details in the image, thereby affecting subsequent image recognition and positioning accuracy.
[0018] At the same time, traditional object detection methods cannot provide high enough accuracy for pads and component pins with irregular shapes or placed at different angles. This means that the system may not be able to accurately identify the location of pads and component pins, especially when dealing with complex shapes and layouts.
[0019] In addition, key point detection is prone to false detection or partial occlusion: Traditional methods are easily affected by false detection or partial occlusion when performing key point detection, resulting in inaccurate final spatial mapping parameters. For example, in some cases, the system may mistakenly identify non-key points as key points, or miss real key points due to partial occlusion.
[0020] In order to cope with the above-mentioned unfavorable conditions and improve the positioning and matching accuracy of surface mount equipment, the present invention provides a positioning calibration method, equipment, medium and product for surface mount equipment. When the first position of the pad on the circuit board and the second position of the component pin of the component to be mounted are obtained by using an image recognition model, the corresponding confidence is also recorded. When performing matching calculation based on the first position and the second position, an iterative calculation is performed, and the position of the matched pad and component pin in the current iteration is transformed. The position error after the transformation is calculated in combination with the confidence, so as to output the final matching result of the pad and component pin and the corresponding final spatial mapping parameter after meeting the first iterative calculation condition. The method can effectively reduce the influence of low-confidence position detection results on the calculation of spatial mapping parameters, ensure the stability and reliability of the final spatial mapping parameters, and have stronger anti-interference ability than traditional position error calculation, and can better adapt to recognition interference caused by different environmental conditions, irregular equipment placement, irregular component shape, point occlusion, etc., thereby improving the positioning and matching accuracy of high surface mount equipment.
[0021] Figure 1 A flow chart of a positioning and calibration method for a surface mount device provided by an embodiment of the present invention; Figure 2 A schematic structural diagram of a positioning and calibration system for a surface mount device provided by an embodiment of the present invention.
[0022] like Figure 1 As shown, the positioning calibration method of the surface mount device provided by the embodiment of the present invention may include: S101: acquiring a circuit image of a circuit board and a component image of a component to be mounted.
[0023] S102: Using an image recognition model to respectively identify the circuit image and the component image, obtain a first position and a first confidence of a pad on the circuit board, and a second position and a second confidence of a component pin of a component to be mounted.
[0024] S103: Enter iterative calculation. In the current iteration, the pads and component pins are matched, and spatial mapping parameters are calculated based on the matched multiple pairs of first positions and second positions. Position transformation calculation is performed on the matched first positions and second positions based on the spatial mapping parameters, and the transformed position error is calculated based on the first confidence level and / or the second confidence level, until the end condition of the first iteration is reached, and the final matching result of the pads and component pins and the corresponding final spatial mapping parameters are output.
[0025] In the embodiments of the present invention, pads refer to metal contact points on a circuit board for soldering surface mount components (such as chip resistors, chip capacitors, etc.). These pads are specially designed for component pins to ensure that the components can be properly fixed on the circuit board and achieve electrical connection. For example, the pins of components such as chip resistors and chip capacitors need to be aligned with the pads on the circuit board and soldered.
[0026] The positioning and calibration method of the surface mount device provided by the embodiment of the present invention can be applied to the following Figure 2 The system shown in FIG. 1 mainly includes a camera system 201 and a detection device 202. The camera system 201 is used to acquire image data, and the detection device 202 is used to locate and match key points based on the image data. The camera system 201 may include an image acquisition module, an image enhancement processing module, and a compensation control module. The detection device 202 may include a key point detection module, a graph structure modeling and optimization module, and a spatial mapping parameter estimation module.
[0027] In an embodiment of the present invention, the types of key points include solder pads and component pins. The positioning and calibration task of the surface mount equipment requires accurately establishing a spatial mapping relationship between the spatial coordinates of the solder pads and the spatial coordinates of the component pins they match, so that the machine can grab the components to be mounted and realize automatic mounting.
[0028] For S101, in the positioning and calibration task of the surface mount equipment, the circuit board is placed on a bracket or fixture, and the components to be mounted are placed on another bracket or tray. The camera is used to capture the circuit image of the circuit board and the component image of the components to be mounted respectively.
[0029] For S102, a pre-trained image recognition model can be used to perform image recognition on the circuit image of the circuit board and the component image of the component to be mounted, respectively, to identify the position of the pad and the position of the component pin from the circuit image, and to use the image recognition model to output the confidence level corresponding to the position recognition result.
[0030] For S103, the random sampling consensus algorithm (RANSAC) can be used to perform matching calculations on pads and component pins.
[0031] In each iteration of the iterative calculation, pads and component pins can be randomly matched to obtain key point pairs (a pair of matching pads and component pins). A group of key point pairs (e.g., three pairs) is randomly selected to calculate the spatial mapping parameters for the current iteration, i.e., the transformation parameters used to map the spatial coordinates of the pads to the spatial coordinates of the component pins. Then, for each key point pair in the current iteration, the spatial mapping parameters are used to calculate the position transformation of one of the key points. It is understandable that if the spatial mapping parameters can accurately describe the relationship between the spatial coordinates of the pads and the spatial coordinates of the component pins, the transformed key point should coincide with the position of the other key point in a key point pair. However, in actual situations, the position of the transformed key point may differ from the position of the other key point in a key point pair. This error may be caused by inaccurate position identification of the pads or component pins, improper matching between the two, or inappropriate selection of the key point pair used to calculate the spatial mapping parameters. For the error caused by the first reason, in an embodiment of the present invention, the confidence level (first confidence level and / or second confidence level) corresponding to the position recognition result output by the image recognition model in S102 is used as a weight, that is, the position error calculated in S103 is the result of weighting the actual position error with the confidence level.
[0032] Therefore, when calculating the position error in the current iteration, the key points with higher confidence in the image recognition link will have an increased impact on the error of the matching calculation, and the key points with lower confidence in the image recognition link will have a reduced impact on the error of the matching calculation, that is, the impact of low-confidence position detection results on the calculation of spatial mapping parameters is reduced, thereby ensuring the stability and reliability of the final spatial mapping parameters.
[0033] After the iterative calculation reaches the end condition of the first iteration, the best matching result is selected from each iteration as the final matching result of the pad and the component pin, and the corresponding space mapping parameter is obtained as the final space mapping parameter.
[0034] The first iteration end condition may be that a first preset number of iterations is reached, or the position error of the current iteration meets a preset error condition.
[0035] The positioning and calibration method for surface mount equipment provided by an embodiment of the present invention uses an image recognition model to identify the first position of the solder pad on the circuit board and the second position of the component pin of the component to be mounted, and also records the corresponding confidence. When performing matching calculation based on the first position and the second position, iterative calculation is performed, and the position of the matched solder pad and component pin in the current iteration is transformed. The position error after the transformation is calculated in combination with the confidence, so as to output the final matching result of the solder pad and component pin and the corresponding final spatial mapping parameter after meeting the first iterative calculation condition. It can effectively reduce the influence of low-confidence position detection results on the calculation of spatial mapping parameters, ensure the stability and reliability of the final spatial mapping parameters, and have stronger anti-interference ability than traditional position error calculation, and can better adapt to recognition interference caused by different environmental conditions, irregular equipment placement, irregular component shape, point occlusion, etc., thereby improving the accuracy of positioning matching of high surface mount equipment.
[0036] On the basis of the above embodiments, in the positioning and calibration method of the surface mount device provided in the embodiment of the present invention, in response to the situation where the quality of the collected image is unstable due to environmental conditions, obtaining the circuit image of the circuit board and the component image of the component to be mounted in S101 may include: obtaining an initial image taken by the camera, and calculating the image quality parameters of the initial image; if the image quality parameters of the initial image meet the second threshold condition, entering the step of using the image recognition model to recognize the initial image; if the image quality parameters of the initial image do not meet the second threshold condition, enhancing the initial image to obtain an enhanced image; calculating the image quality parameters of the enhanced image; if the image quality parameters of the enhanced image meet the second threshold condition, entering the step of image recognition model recognition with the enhanced image; if the image quality parameters of the enhanced image do not meet the second threshold condition, re-acquiring the initial image taken by the camera, and entering the step of calculating the image quality parameters of the initial image; wherein the initial image includes the circuit image and the component image.
[0037] In an embodiment of the present invention, multi-source images of the circuit board and components to be mounted can be captured to address the issue of single-light source imaging failing to provide stable image quality. Acquiring an initial image captured by a camera can include: acquiring a visible light image, a polarization image, and a near-infrared image captured by a synchronously triggered visible light camera, a polarization camera, and a near-infrared camera; and fusing the visible light, polarization, and near-infrared images to obtain the initial image.
[0038] In a specific implementation, a three-channel imaging platform consisting of a visible light camera, a polarization camera, and a near-infrared camera can be set up on the surface mounting equipment operating platform. The three-channel imaging platform collects images of the circuit board and the components to be mounted through synchronous triggering, and obtains respective visible light images, polarization images, and near-infrared images. Among them, the visible light image is used to obtain color and geometric contour information, the polarization image is used to extract the surface reflection directional characteristics, and the near-infrared image is used to penetrate the packaging material and identify hidden structures.
[0039] To evaluate the image quality of visible light images, the overall edge clarity function is defined, which can be expressed as: ; in, It represents the average value of the gradient amplitude of all pixels in the area, representing the overall edge clarity; represents the region of interest where the key points are located in the visible light image, represents the total number of pixels in the region R, represents the gradient of the visible light image in the x direction, Represents the gradient of the visible light image in the y direction, Represents a visible light image.
[0040] To evaluate the effect of polarization images in suppressing metal pad reflections, gradient analysis is performed on the polarization images and an image edge clarity function is defined. The expression can be: ; Where E represents the edge clarity value of the key point area in the polarization image, represents the gradient of the polarization image in the x direction, Represents the gradient of the polarization image in the y direction. A larger E indicates a clearer edge and can be used to quantify the ability to suppress reflections.
[0041] To further determine whether the near-infrared image is suitable for key point recognition in the current scene, the spectral response of the near-infrared image is analyzed and the signal-to-noise ratio evaluation factor is defined. The expression can be: ; in, Indicates that the near-infrared image has a wavelength of The spectral response intensity at 、 Indicates the main frequency band range of the useful signal in the near-infrared image. 、 It represents the interference frequency band range of the background noise, and R represents the signal-to-noise ratio evaluation factor of the near-infrared image.
[0042] The three types of images are weighted fused to generate a high-quality initial image. The expression is: ; in, is the weight coefficient of the visible light image, is the output value of the edge clarity function of the visible light image; is the weight coefficient of the polarization image enhancement term, is the nonlinear gain adjustment factor of the polarization image, and E is the output value of the image edge clarity function of the polarization image; is the weight coefficient of the near-infrared image, and R is the signal-to-noise ratio evaluation factor of the near-infrared image.
[0043] In the embodiment of the present invention, the image quality parameter of the initial image can be calculated by the following formula: ; Where Q represents the image quality parameter of the initial image, represents the contrast weight coefficient, C represents the image contrast, represents the uniformity weight coefficient, and U represents the image uniformity.
[0044] By setting up a three-channel imaging platform to collect multimodal image data, it is possible to effectively address visual recognition challenges such as pad reflection and package occlusion of surface mount equipment under complex lighting conditions. The polarization image is evaluated for its ability to suppress metal surface reflection through gradient analysis and edge clarity function, and the near-infrared image is judged for its ability to penetrate the packaging material through the signal-to-noise ratio evaluation factor, thereby ensuring that the image quality is controllable and evaluable. The image quality output is optimized through weighted fusion and comprehensive image quality evaluation function, providing a high-quality, stable and reliable input foundation for subsequent key point detection.
[0045] In other optional implementations of the embodiments of the present invention, after obtaining multi-source images, such as obtaining visible light images, polarization images and near-infrared images separately, they may not be fused. Instead, subsequent steps of image recognition and matching calculations are performed based on the visible light images, polarization images and near-infrared images of the circuit board and the components to be mounted, respectively, and the matching results of the three channels are fused to obtain matching results and spatial mapping parameters.
[0046] In an embodiment of the present invention, performing enhancement processing on an initial image to obtain an enhanced image may include: normalizing image features of the initial image to obtain a normalized image; extracting image features of multiple scales from the normalized image, and performing weighted fusion calculation on the image features of the multiple scales to obtain a first image; and performing local enhancement processing on the first image based on the image features of the first image, the minimum grayscale value within a local area of the first image, the maximum grayscale value within the local area of the first image, and a target grayscale level, so as to limit the output image features to not exceed a grayscale range, thereby obtaining an enhanced image.
[0047] In a specific implementation, a multi-scale Retinex enhancement algorithm and adaptive histogram equalization (CLAHE) can be used to improve the image contrast, thereby generating a high-quality homochromatic image.
[0048] Define the illumination normalization function, the expression can be: ; in, The standard deviation is Two-dimensional Gaussian kernel, * represents the convolution operation, To prevent division by zero for small constants, is the normalized image.
[0049] The multi-scale Retinex enhancement algorithm is used to Perform multi-scale feature extraction to enhance the contrast of image details and define the enhanced image. The expression is: ; in, is the scale quantity, For the The weighted coefficients corresponding to the scales satisfy , For the The standard deviation of the Gaussian kernel at each scale, is a bias constant used to avoid taking the logarithm of zero, This is the first image obtained after multi-scale Retinex enhancement.
[0050] Adaptive histogram equalization algorithm is used to For local enhancement processing, the expression can be: ; in, is the minimum gray value in the local area, is the maximum grayscale value in the local area, is the target grayscale level, This function is used to limit the output value to within the grayscale range.
[0051] An image quality feedback mechanism is introduced to determine whether the enhanced image meets the requirements of subsequent key point detection. The expression is: ; in, To enhance the contrast of the image, it is defined as the difference between the maximum grayscale value and the minimum grayscale value. To enhance the uniformity of the image, it is defined as the inverse of the grayscale variance in the local area, 、 are the weight coefficients of contrast and uniformity, To enhance the quality of the image.
[0052] Set the second threshold ,like , then return to the image acquisition stage to readjust the imaging parameters and acquire a new image; otherwise, the image will be enhanced. The output serves as input for image recognition.
[0053] The positioning calibration method for surface mount equipment provided by an embodiment of the present invention combines illumination normalization processing with a multi-scale Retinex enhancement algorithm, which can significantly improve the contrast of image details without introducing excessive noise. The CLAHE algorithm further enhances the uniformity of grayscale distribution in local areas. After introducing an image quality feedback mechanism, the method can dynamically adjust image acquisition parameters according to the current image quality index, forming a closed-loop image preprocessing process, preventing low-quality images from entering subsequent processing links, thereby ensuring the stability and reliability of the entire visual system and improving the calibration accuracy and system robustness.
[0054] Based on the above embodiments, in the positioning and calibration method of the surface mount device provided in the embodiment of the present invention, the image recognition model can adopt an improved YOLOv7 network model. The improved YOLOv7 network model is based on the standard YOLOv7 and introduces a deformable convolution module in the backbone network to improve the perception ability of irregular-shaped targets such as pads and component pins.
[0055] Define the deformable convolution operation, the expression is: ; in, Represents the response value of position p in the output feature map, which is the number of convolution kernel sampling points. For the The weight of the sampling points, is the input feature map, is the standard convolution sampling offset, is a learnable spatial offset generated by additional convolutional layers.
[0056] In the network head, a multi-task output structure is adopted to simultaneously predict the target category, bounding box parameters and key point coordinates. The key point regression part is defined as: ; in, is the center coordinate of the target bounding box, are the target bounding box width and height, is the target rotation angle, For the Among the goals The predicted coordinates of key points, is a keypoint mapping function implemented using an affine transformation combined with a normalized offset. The i-th target is the i-th component or the i-th pad, depending on the object type being analyzed. A component's keypoint refers to the component pin, while a pad's keypoint can refer to the pad's center point.
[0057] For the two types of targets, pads and component pins, the improved YOLOv7 network model will output the category information, bounding box parameters (including position and size), and several key point coordinates of each target. In addition, it will also be accompanied by the key point confidence, which indicates the reliability of the key point identification. This information together constitutes the target detection result and provides a basis for subsequent analysis and processing.
[0058] In an embodiment of the present invention, a pre-trained improved YOLOv7 network model can be used for image recognition. In addition, an embodiment of the present invention also provides a method for training an image recognition model. The training steps of the image recognition model may include: inputting an image sample into the image recognition model, outputting key point type recognition results and key point position recognition results for multiple key points on the image sample; calculating a classification loss value based on the key point type recognition results and the corresponding true values; calculating a position loss value based on the key point position recognition results and the corresponding true values; calculating a geometric consistency loss value based on the key point position recognition results of the multiple key points; determining an image recognition loss value based on the classification loss value, the position loss value, and the geometric consistency loss value; and updating the model parameters of the image recognition model based on the image recognition loss value until the third iteration end condition is reached.
[0059] When training an image recognition model, the loss function can be: ; in, is the image recognition loss value, is the classification loss value, is the coefficient of the position loss value, is the position loss value, is the coefficient of the geometric consistency loss value, is the geometric consistency loss value.
[0060] The classification loss is used to measure the difference between the target category predicted by the model and the actual target category. In the multi-task output structure of the image recognition model adopted in the embodiment of the present invention, the classification loss can be calculated using the cross entropy loss function.
[0061] The position loss value can be a bounding box regression loss, which is used to measure the difference between the bounding box parameters predicted by the model and the true bounding box parameters. The mean square error loss can be used.
[0062] In order to improve the accuracy of key point positioning, an embodiment of the present invention introduces a geometric consistency loss function to constrain the relative position relationship between key points. Calculating a geometric consistency loss value based on the key point position recognition results of multiple key points can include: for an image sample input into the current iterative training of an image recognition model, calculating the first product of the difference between the key point position recognition results of two key points on the image sample and a rotation matrix rotated by a first angle around the target center of the image sample; calculating the first difference between the true values corresponding to the two key point position recognition results; calculating the second norm of the second difference of the first difference minus the first product to obtain a first result; and calculating the mean of the first results corresponding to each image sample of the current iterative training of the image recognition model to obtain a geometric consistency loss value.
[0063] The geometric consistency loss function can be defined as: ; in, is the total number of image samples, Rotation of the i-th image sample around the target center The rotation matrix of the angle, 、 is the position prediction result of the two predicted key points on the i-th image sample, 、 is its corresponding true value coordinate.
[0064] After the above processing, the target category, bounding box parameters and several key point coordinates of each pad and component pin are output, along with the key point confidence, which indicates the reliability of the key point recognition.
[0065] The output key point data will be used as input data for the next stage for subsequent matching optimization.
[0066] In the positioning and calibration method for surface mount equipment provided in an embodiment of the present invention, an improved YOLOv7 network model is adopted as the image recognition model. By introducing a deformable convolution module, the perception ability of irregular-shaped pads and component pins is effectively enhanced, so that the model can adapt to target recognition tasks under different angles and deformations. At the same time, the introduction of the geometric consistency loss function strengthens the spatial constraint relationship between key points and improves the structural consistency of the key point regression results. The method not only improves the key point detection accuracy, but also provides high-confidence data support for subsequent matching calculations. It is an important prerequisite for achieving high-precision spatial mapping.
[0067] Based on the above embodiment, the pad position recognition result may be corrected before entering the matching calculation.
[0068] The positioning and calibration method of the surface mount device provided by an embodiment of the present invention may also include: before entering the iterative calculation, establishing a graph structure according to the first position of each pad on the circuit image, the pad is a node in the graph structure, and the relationship between the pads is the edge between the nodes in the graph structure, and the node feature of the node includes at least the first position; for each node, respectively calculating the graph attention coefficient between the node and the node's neighbor node based on the graph attention network, and updating the node feature of the node according to the graph attention coefficient; determining the corrected first position from the updated node feature, and entering the iterative calculation with the corrected first position; wherein the neighbor node is a node that has an edge connection with the node; if the distance between the first positions corresponding to the two nodes meets the edge connection condition, then there is an edge connection between the two nodes.
[0069] During the target detection phase, the key point coordinates of pads and component pins can be obtained. However, due to various factors (such as image noise and occlusion), these raw detection results contain certain errors. In an embodiment of the present invention, by introducing geometric consistency constraints based on the graph structure and using a graph attention network (GAT) to learn the neighborhood dependencies between nodes, the graph attention network can correct the coordinates mainly because it can capture and model the complex relationships and dependencies between nodes, and can better understand the position and role of each key point in its local environment. This can correct these raw detection results and output more accurate key point coordinates.
[0070] In an embodiment of the present invention, after the first position of the pad (key point) on the circuit image is identified using the image recognition model, all pad key points can be regarded as nodes in the graph to construct an initial graph structure. The expression can be: ; in, Represents a set of nodes in the graph, Represents a set of edges, where the existence of an edge is determined by the spatial distance between nodes.
[0071] In an embodiment of the present invention, the distance between the first positions corresponding to two nodes satisfies the edge connection condition, which may include: the Euclidean distance between the first positions corresponding to the two nodes is less than the maximum connection distance threshold; the maximum connection distance threshold is determined according to the pad arrangement density of the circuit board.
[0072] That is, the edge connection condition can be expressed as: .in, , are the two-dimensional coordinates of the nodes, represents the Euclidean distance, The maximum connection distance threshold is set and can be dynamically adjusted according to the pad arrangement density.
[0073] In the graph structure, Defined as the maximum connection distance threshold, its physical meaning is the standard used to determine whether there is a direct connection between two nodes. In practical applications, such as the arrangement of pads on a circuit board, It can be dynamically adjusted according to the arrangement density of the pads to adapt to different layout situations.
[0074] When the Euclidean distance between two nodes (i.e. the straight-line distance between their two-dimensional coordinates) is less than When , it can be considered that the two nodes are close enough in space that there may be some form of interaction or dependency between them. This connection may be physical (such as electrical connection in a circuit) or logical (such as data flow or transmission of control signals). , which can effectively screen out meaningful node connections when constructing the graph structure, avoiding the introduction of excessive noise or irrelevant links, thereby improving the accuracy and efficiency of the graph model.
[0075] In the scenario of circuit image processing, the feature vector of a node may include but is not limited to visual features such as the node's position, shape, size, and color, as well as semantic information such as the category to which the node belongs and its connection relationship with other nodes.
[0076] The two-dimensional coordinates of key points are an important part of the node feature vector, which directly reflects the location information of the node in the image. When constructing the graph structure, the two-dimensional coordinates of the node are not only used to calculate the Euclidean distance between nodes, but also to determine whether Condition, and also participate in the subsequent graph attention coefficient calculation as input features.
[0077] To enhance the information interaction capability between graph nodes, a graph attention network is introduced on the graph structure, where the graph attention coefficient function is defined as follows: ; in, , are the feature vectors of node i and node j respectively, W is the learnable linear transformation matrix, a is the parameter vector in the attention mechanism, || represents the vector concatenation operation, Representation node The set of neighbor nodes of represents the attention weight of node j to node i.
[0078] Update the feature representation of each node in the graph, where the node feature update function is defined and the expression is: ; in, is the updated node feature, is the ReLU activation function.
[0079] A geometric consistency constraint based on the graph structure is introduced to correct the original detection results of the pad key points and output the corrected first position.
[0080] In the positioning and calibration method for surface mount equipment provided in an embodiment of the present invention, by constructing the key points of the pads as graph nodes and establishing a graph structure based on the spatial topological relationship, it is helpful to understand the relative position relationship between the pads from a global perspective. The graph attention network learns the neighborhood dependency relationship between nodes to achieve effective correction of mismatched key points, thereby improving the overall consistency and robustness of the alignment. In addition, the introduction of geometric consistency constraints further enhances the spatial rationality of key point matching, so that the system can maintain a high matching accuracy in the face of local occlusion or false detection, providing a more reliable key point set for the calculation of subsequent spatial mapping parameters.
[0081] In the embodiments of the present invention, a pair of key points refers to a pad key point and a component pin. Specifically, a pad key point is a specific location on a circuit board for soldering component pins, and has clear geometric features and coordinates. A component pin key point is the location of a pin on a component to be mounted, and also has clear geometric features and coordinates.
[0082] When performing spatial mapping and transformation, it is necessary to find the correspondence between the key points of the pad and the key points of the component pin, that is, "each pair of key points". Through this correspondence, a spatial mapping model from the component pin to the pad can be constructed, thereby achieving accurate component placement.
[0083] Then, on the basis of the above embodiments, in the positioning and calibration method of the surface mount device provided in the embodiment of the present invention, in S103, the transformed position error is calculated according to the first confidence level and / or the second confidence level until the first iteration end condition is reached, and the final matching result of the pad and the component pin and the corresponding final spatial mapping parameter are output, which may include: for each pair of the first position and the second position, calculating the first position error between the third position and the first position after the second position is transformed using the spatial mapping parameter; determining the first weight of the first position error according to the first confidence level and / or the second confidence level; performing weighted calculation on the first position error using the first weight to obtain the position error of the current iteration; until the first iteration end condition is reached, determining the iteration with the smallest position error in each iteration, and taking the matching relationship between the pad and the component pin as the final matching result, and taking the spatial mapping parameter obtained therein as the final spatial mapping parameter.
[0084] In a specific implementation, the weighted least squares method can be used to estimate the optimal spatial mapping parameters, where the weight factor is determined by the confidence level, and the random sampling consensus algorithm (RANSAC) is combined to eliminate mismatched points to obtain the spatial mapping matrix.
[0085] Define the spatial transformation model and construct the error function for each pair of key points. The expression is: ; Among them, the confidence of the key points is used As a weight factor, key points with high confidence have a larger proportion in the parameter estimation process; is the component pin coordinate after transformation based on the space mapping matrix, Coordinates of key points of pad.
[0086] Solving the error function minimization problem and obtain the optimal spatial mapping parameters.
[0087] Error function The purpose is to measure the quality of the affine transformation parameters A and the translation vector t, so that the transformed component pin key points are as close as possible to the corresponding pad key points.
[0088] By solving smallest , the optimal space mapping model can be obtained, thereby achieving accurate component placement.
[0089] In an embodiment of the present invention, to eliminate mismatched key points and more accurately match key point pairs, a random sampling consensus algorithm (RANSAC) can be used to eliminate mismatched points. The step S103 of calculating spatial mapping parameters based on multiple matched pairs of first and second positions may include: randomly selecting multiple pairs of first and second positions to calculate initial spatial mapping parameters; performing position transformation calculations on all matched first and second positions using the initial spatial mapping parameters, and calculating the position errors of the transformed key points; determining a pair of first and second positions with a key point position error less than a first threshold as an inlier (the remaining pairs are recorded as outliers); repeating the second iteration a number of times, recording the maximum set of inliers and the corresponding initial spatial mapping parameters in each iteration; and selecting the initial spatial mapping parameters corresponding to the largest number of inliers as the spatial mapping parameters.
[0090] In each iteration of the random sampling consensus algorithm, the step of randomly selecting key point pairs is repeated until the maximum inlier set of the current iteration is determined. The second iteration number can be 100 times.
[0091] When randomly selecting keypoint pairs, a minimum set of keypoint pairs can be selected, that is, the minimum number of keypoint pairs required to uniquely determine the affine transformation parameters. For example, for an affine transformation in two-dimensional space, at least three pairs of non-collinear keypoint pairs are required to uniquely determine the transformation parameters. Because an affine transformation contains six degrees of freedom (two translations, one rotation, one scale, and two shears), and each pair of keypoints can provide two constraints (x and y coordinates), at least three pairs of keypoints are required to satisfy the six constraints.
[0092] In an embodiment of the present invention, a random sampling consensus algorithm is used to eliminate mismatched points in the positioning and calibration task of the surface mount device, and the spatial mapping parameters containing the most inliers are selected as the global optimal solution, thereby further ensuring the stability and reliability of the spatial mapping parameters and improving the anti-interference ability. It is particularly suitable for industrial scenarios with outliers or multi-posture changes, and provides a guarantee for achieving high-precision spatial mapping.
[0093] Based on the above embodiments, the positioning calibration method of the surface mount device provided by the embodiment of the present invention may also include: calculating the posture deviation based on the final space mapping parameters and the standard space mapping parameters; inputting the posture deviation into the motion control model of the camera to obtain the calibration parameters of the camera.
[0094] Among them, calculating the posture deviation based on the final spatial mapping parameters and the standard spatial mapping parameters can include: training a prediction model based on the error of the final spatial mapping parameters compared with the standard spatial mapping parameters and the error of the historical final spatial mapping parameters compared with the standard spatial mapping parameters; and using the prediction model to predict the posture deviation at the next moment.
[0095] In an embodiment of the present invention, an LSTM time series can be used to train historical calibration error data to predict the posture deviation at the next moment, and the predicted value can be fed back to the motion control platform to drive the camera or platform to perform dynamic compensation actions to complete closed-loop online calibration.
[0096] In the specific implementation, the current spatial mapping matrix is extracted from each positioning calibration task and compared with the standard reference transformation matrix to calculate the pose deviation at that moment. The expression is: ; in, Indicates the current calibration time, represents the Frobenius norm of the matrix difference, Indicates the The overall pose deviation in the calibration, Represents the spatial mapping matrix at the current moment (i.e., the t-th calibration task), Represents the standard reference transformation matrix, which is a spatial mapping matrix in an ideal state that is predetermined or determined after multiple calibrations. It represents the positional relationship between targets such as pads and component pins under ideal conditions. 、 These two parameters act on each image acquisition device at the current moment.
[0097] The standard reference transformation matrix represents the ideal positional relationship between pads and target components, such as component pins. This ideal state is determined during the initial calibration phase or after multiple calibrations, and reflects the geometric alignment of the device under optimal operating conditions. When setting the standard reference transformation matrix, it is assumed that the placement of the circuit board and the initial positions of the components to be mounted are fixed. This is because a reference point is needed to measure deviations in actual operation. This does not mean that these positions will always remain unchanged in practice, but rather provides a theoretically optimal alignment state as a comparison benchmark.
[0098] The pose deviation refers to the actual space mapping matrix at the current moment Transformation moment with standard reference To address this posture deviation, an embodiment of the present invention uses an LSTM time series model to train historical calibration error data, predict the posture deviation at the next moment, and feed the predicted value back to the motion control platform, driving the camera or platform to perform dynamic compensation actions, completing closed-loop online calibration. In this way, the posture of the component can be adjusted in real time to ensure its accurate alignment with the pad, improving placement accuracy and production efficiency.
[0099] In this embodiment of the present invention, a time series prediction model based on long short-term memory network is constructed to learn the dynamic law of posture drift during the operation of surface mount equipment. The trained LSTM model is used to infer the current and historical posture deviation sequence and output the predicted deviation at the next moment; the predicted deviation is converted into the predicted deviation. Convert to specific mechanical adjustment instructions , sent to the motion control platform of the surface mount device, the expression is: ; in, is the gain coefficient matrix, which is set according to the response characteristics of the mechanical system. is the compensation instruction sent to the controller.
[0100] The above instructions can directly act on the X / Y / Z-axis motor or image acquisition module of the surface mount device to achieve online closed-loop calibration.
[0101] In the positioning calibration method for surface mount equipment provided in an embodiment of the present invention, the LSTM time series model can predict the posture deviation trend that may occur in the surface mount equipment in the future by learning historical calibration error data, thereby realizing early compensation rather than ex post correction. The closed-loop online calibration mechanism effectively alleviates the problem of accumulated positioning errors caused by factors such as thermal drift and mechanical vibration, and improves the positioning stability of the equipment under long-term operation. By converting the predicted deviation into actual mechanical control instructions, the method can complete adaptive calibration without human intervention, significantly improving the automation level and production efficiency of surface mount equipment.
[0102] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0103] An embodiment of the present invention also provides a positioning and calibration device for a surface mount device, which may include: an image acquisition module for acquiring a circuit image of a circuit board and a component image of a component to be mounted; a key point detection module for using an image recognition model to respectively identify the circuit image and the component image, and obtain a first position and a first confidence of a solder pad on the circuit board, and a second position and a second confidence of a component pin of the component to be mounted; a key point detection module for entering an iterative calculation, in which, in the current iteration, the solder pad and the component pin are matched, and spatial mapping parameters are calculated based on multiple matched pairs of first positions and second positions, position transformation calculation is performed on the matched first positions and second positions based on the spatial mapping parameters, and the transformed position error is calculated based on the first confidence and / or second confidence, until the end condition of the first iteration is reached, and the final matching result of the solder pad and the component pin and the corresponding final spatial mapping parameters are output.
[0104] In an embodiment of the present invention, the key point detection module calculates the spatial mapping parameters based on the matched multiple pairs of first positions and second positions, which may include: randomly selecting multiple pairs of first positions and second positions to calculate the initial spatial mapping parameters; using the initial spatial mapping parameters to perform position transformation calculation on all matched first positions and second positions, and calculating the key point position error after the transformation to determine a pair of first positions and second positions whose key point position error is less than a first threshold as the inliers; repeating the second iteration number, recording the maximum inlier point set and the corresponding initial spatial mapping parameters in each iteration; and selecting the initial spatial mapping parameters corresponding to the largest number of inliers as the spatial mapping parameters.
[0105] In an embodiment of the present invention, the key point detection module calculates the transformed position error according to the first confidence level and / or the second confidence level until the first iteration end condition is reached, and outputs the final matching result of the pad and the component pin and the corresponding final spatial mapping parameter, which may include: for each pair of the first position and the second position, calculating the first position error between the third position after the second position is transformed using the spatial mapping parameter and the first position; determining the first weight of the first position error according to the first confidence level and / or the second confidence level; performing weighted calculation on the first position error using the first weight to obtain the position error of the current iteration; until the first iteration end condition is reached, determining the iteration with the smallest position error in each iteration, and taking the matching relationship between the pad and the component pin as the final matching result, and taking the spatial mapping parameter obtained therein as the final spatial mapping parameter.
[0106] In an embodiment of the present invention, the training steps of the image recognition model may include: inputting an image sample into the image recognition model, and outputting key point type recognition results and key point position recognition results for multiple key points on the image sample; calculating a classification loss value based on the key point type recognition result and the corresponding true value; calculating a position loss value based on the key point position recognition result and the corresponding true value; calculating a geometric consistency loss value based on the key point position recognition results of multiple key points; determining an image recognition loss value based on the classification loss value, the position loss value and the geometric consistency loss value; and updating the model parameters of the image recognition model based on the image recognition loss value until the end condition of the third iteration is reached.
[0107] In an embodiment of the present invention, calculating the geometric consistency loss value based on the key point position recognition results of multiple key points can include: for the image sample input into the current iterative training of the image recognition model, calculating the first product of the difference between the key point position recognition results of two key points on the image sample and the rotation matrix rotated around the target center of the image sample by a first angle; calculating the first difference between the true values corresponding to the two key point position recognition results; calculating the second norm of the second difference of the first product minus the first difference to obtain a first result; calculating the mean of the first results corresponding to each image sample of the current iterative training of the image recognition model to obtain a geometric consistency loss value.
[0108] The positioning and calibration device for a surface mount device provided by an embodiment of the present invention may further include:
[0109] A graph structure modeling and optimization module is used to establish a graph structure based on the first position of each pad on the circuit image before entering the iterative calculation. The pads are nodes in the graph structure, and the relationship between the pads is the edge between the nodes in the graph structure. The node features of the nodes include at least the first position; for each node, the graph attention coefficient between the node and the node's neighbor nodes is calculated based on the graph attention network, and the node features of the node are updated according to the graph attention coefficient; the corrected first position is determined from the updated node features, and the iterative calculation is entered with the corrected first position; wherein the neighbor node is a node that has an edge connection with the node; if the distance between the first positions corresponding to the two nodes meets the edge connection condition, then there is an edge connection between the two nodes.
[0110] Among them, the distance between the first positions corresponding to the two nodes satisfies the edge connection condition, which may include: the Euclidean distance between the first positions corresponding to the two nodes is less than the maximum connection distance threshold; the maximum connection distance threshold is determined according to the pad arrangement density of the circuit board.
[0111] In an embodiment of the present invention, the image acquisition module may include: an image acquisition module for acquiring an initial image captured by a camera and calculating an image quality parameter of the initial image; an image enhancement processing module for, if the image quality parameter of the initial image satisfies a second threshold condition, entering a step of using an image recognition model to recognize the initial image; if the image quality parameter of the initial image does not satisfy the second threshold condition, performing enhancement processing on the initial image to obtain an enhanced image; calculating the image quality parameter of the enhanced image; if the image quality parameter of the enhanced image satisfies the second threshold condition, entering a step of using an image recognition model to recognize the enhanced image; if the image quality parameter of the enhanced image does not satisfy the second threshold condition, reacquiring the initial image captured by the camera and entering a step of calculating the image quality parameter of the initial image. The initial image includes a circuit image and a component image.
[0112] In an embodiment of the present invention, the image enhancement processing module performs enhancement processing on the initial image to obtain an enhanced image, which may include: normalizing the image features of the initial image to obtain a normalized image; extracting image features of multiple scales from the normalized image, and performing weighted fusion calculation on the image features of the multiple scales to obtain a first image; performing local enhancement processing on the first image based on the image features of the first image, the minimum grayscale value in the local area of the first image, the maximum grayscale value in the local area of the first image, and the target grayscale level, so as to limit the output image features to not exceed the grayscale range, thereby obtaining an enhanced image.
[0113] In an embodiment of the present invention, the image acquisition module obtains the initial image taken by the camera, which may include: obtaining a visible light image, a polarization image and a near-infrared image taken by a synchronously triggered visible light camera, a polarization camera and a near-infrared camera; and fusing the visible light image, the polarization image and the near-infrared image to obtain the initial image.
[0114] The positioning calibration device for the surface mount equipment provided by an embodiment of the present invention may also include: a compensation control module, used to calculate the posture deviation based on the final space mapping parameters and the standard space mapping parameters; input the posture deviation into the motion control model of the camera to obtain the calibration parameters for the camera.
[0115] In an embodiment of the present invention, the compensation control module calculates the posture deviation based on the final spatial mapping parameters and the standard spatial mapping parameters, which may include: training a prediction model based on the error of the final spatial mapping parameters compared to the standard spatial mapping parameters and the error of the historical final spatial mapping parameters compared to the standard spatial mapping parameters; and using the prediction model to predict the posture deviation at the next moment.
[0116] The description of the features in the embodiment corresponding to the positioning and calibration device of the surface mount device can be found in the relevant description of the embodiment corresponding to the positioning and calibration method of the surface mount device, and will not be repeated here.
[0117] An embodiment of the present invention further provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned positioning calibration method embodiments for surface mount devices.
[0118] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above-mentioned positioning and calibration method embodiments for surface mount devices when running.
[0119] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0120] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned positioning and calibration method embodiments for a surface mount device are implemented.
[0121] An embodiment of the present invention also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned positioning and calibration method embodiments of the surface mount device.
[0122] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0123] The above is a detailed introduction to the positioning and calibration method, equipment, medium and product of a surface mount device provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A positioning and calibration method for a surface mount device, characterized in that: include: Acquire a circuit image of a circuit board and a component image of a component to be mounted; Using an image recognition model to respectively identify the circuit image and the component image, obtain a first position and a first confidence of a pad on the circuit board, and a second position and a second confidence of a component pin of the component to be mounted; Entering an iterative calculation, in the current iteration, matching the pad and the component pin, calculating the spatial mapping parameters based on the matched multiple pairs of the first position and the second position, performing position transformation calculation on the matched first position and the second position according to the spatial mapping parameters, and calculating the transformed position error according to the first confidence level and / or the second confidence level, until the end condition of the first iteration is reached, outputting the final matching result of the pad and the component pin and the corresponding final spatial mapping parameters.
2. The positioning and calibration method of the surface mount device according to claim 1, characterized in that: Calculating a spatial mapping parameter based on the matched pairs of the first positions and the second positions includes: randomly selecting a plurality of pairs of the first position and the second position to calculate initial spatial mapping parameters; Performing position transformation calculation on all the matched first positions and second positions using the initial spatial mapping parameters, and calculating the position error of the key points after the transformation; Determine a pair of the first position and the second position whose position error of the key point is less than a first threshold as an inlier; Repeat the second iteration number, and record the maximum inlier point set and the corresponding initial space mapping parameters in each iteration; The initial spatial mapping parameters corresponding to the largest number of interior points are selected as the spatial mapping parameters.
3. The positioning and calibration method of the surface mount device according to claim 1, characterized in that: Calculating the transformed position error according to the first confidence level and / or the second confidence level until a first iteration end condition is reached, and outputting a final matching result of the pad and the component pin and a corresponding final spatial mapping parameter, including: For each pair of the first position and the second position, calculating a first position error between a third position obtained by performing position transformation calculation on the second position using the spatial mapping parameters and the first position; determining a first weight of the first position error according to the first confidence level and / or the second confidence level; Performing weighted calculation on the first position error using the first weight to obtain the position error of the current iteration; Until the end condition of the first iteration is reached, the iteration with the smallest position error among the iterations is determined, and the matching relationship between the pad and the component pin is used as the final matching result, and the spatial mapping parameters obtained therein are used as the final spatial mapping parameters.
4. The positioning and calibration method for surface mount equipment according to claim 1, wherein: The training steps of the image recognition model include: Inputting an image sample into the image recognition model, and outputting key point type recognition results and key point position recognition results for a plurality of key points on the image sample; Calculate the classification loss value based on the key point type recognition result and the corresponding true value; Calculating a position loss value based on the key point position recognition result and the corresponding true value; Calculating a geometric consistency loss value based on the key point position recognition results of the plurality of key points; Determining an image recognition loss value according to the classification loss value, the position loss value, and the geometric consistency loss value; The model parameters of the image recognition model are updated according to the image recognition loss value until the third iteration end condition is reached.
5. The positioning and calibration method of the surface mount device according to claim 4, characterized in that: Calculating a geometric consistency loss value according to the key point position recognition results of the plurality of key points includes: For the image sample inputted into the current iterative training of the image recognition model, calculating a first product of a difference between key point position recognition results of two key points on the image sample and a rotation matrix rotated around a target center of the image sample by a first angle; Calculating a first difference between the true values corresponding to the two key point position recognition results; Calculating a second norm of a second difference of the first product minus the first difference to obtain a first result; The mean of the first results corresponding to the image samples of the current iterative training of the image recognition model is calculated to obtain the geometric consistency loss value.
6. The method for positioning and calibrating a surface mount device according to claim 1, wherein: Also includes: Before entering iterative calculation, a graph structure is established based on the first position of each of the pads on the circuit image, wherein the pads are nodes in the graph structure, and the relationships between the pads are edges between the nodes in the graph structure, and node features of the nodes include at least the first position; For each node, the graph attention coefficient between the node and its neighboring nodes is calculated based on the graph attention network, and the node feature of the node is updated according to the graph attention coefficient; Determine a revised first position from the updated node features, and enter iterative calculation based on the revised first position; Among them, neighbor nodes are nodes that have edge connections with the node; If the distance between the first positions corresponding to two nodes meets the edge connection condition, then an edge connection exists between the two nodes.
7. The method for positioning and calibrating a surface mount device according to claim 6, wherein: The distance between the first positions corresponding to the two nodes satisfies an edge connection condition, including: The Euclidean distance between the first positions corresponding to the two nodes is less than a maximum connection distance threshold; The maximum connection distance threshold is determined according to the pad arrangement density of the circuit board.
8. The method for positioning and calibrating a surface mount device according to claim 1, wherein: Obtain circuit images of the circuit board and component images of the components to be mounted, including: Obtaining an initial image captured by a camera, and calculating image quality parameters of the initial image; If the image quality parameter of the initial image meets a second threshold condition, entering the step of recognizing using the image recognition model with the initial image; If the image quality parameter of the initial image does not meet the second threshold condition, performing enhancement processing on the initial image to obtain an enhanced image; calculating image quality parameters of the enhanced image; If the image quality parameter of the enhanced image meets the second threshold condition, the enhanced image is used to enter the step of image recognition model recognition; If the image quality parameter of the enhanced image does not meet the second threshold condition, reacquiring the initial image taken by the camera and entering the step of calculating the image quality parameter of the initial image; The initial image includes the circuit image and the component image.
9. The positioning and calibration method for a surface mount device according to claim 8, wherein: Performing enhancement processing on the initial image to obtain an enhanced image includes: Normalizing the image features of the initial image to obtain a normalized image; Extracting image features at multiple scales from the normalized image, and performing weighted fusion calculation on the image features at multiple scales to obtain a first image; Based on the image features of the first image, the minimum grayscale value within the local area of the first image, the maximum grayscale value within the local area of the first image, and the target grayscale level, the first image is locally enhanced to limit the output image features to not exceed the grayscale range, thereby obtaining the enhanced image.
10. The positioning and calibration method for surface mount equipment according to claim 8, wherein: Get the initial image captured by the camera, including: Acquire visible light images, polarization images, and near-infrared images captured by a synchronously triggered visible light camera, polarization camera, and near-infrared camera; The visible light image, the polarization image, and the near-infrared image are fused to obtain the initial image.
11. The positioning and calibration method of a surface mount device according to claim 1, wherein: Also includes: Calculating a posture deviation according to the final space mapping parameters and the standard space mapping parameters; The posture deviation is input into a motion control model of a camera to obtain calibration parameters for the camera.
12. The method for positioning and calibrating a surface mount device according to claim 11, wherein: Calculating the posture deviation according to the final space mapping parameters and the standard space mapping parameters includes: training a prediction model based on an error of the final spatial mapping parameter compared to the standard spatial mapping parameter and an error of a historical final spatial mapping parameter compared to the standard spatial mapping parameter; The prediction model is used to predict the posture deviation at the next moment.
13. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for positioning and calibrating a surface mount device according to any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the positioning and calibration method of the surface mount device according to any one of claims 1 to 12 are implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the positioning calibration method for a surface mount device according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Multi-layer circuit board drilling method and device based on machine vision
CN120186892A
PCB processing deviation correction method and system based on visual calibration
CN120431040A
Wafer location error indicating system and method using vision sensor
KR1020090114565A
Target detection method and apparatus
US20230072730A1
Cited By
Component mounting quality detection method for chip mounter
CN120876487A
A component mounting quality detection method for a chip mounter
CN120876487B
Chip patch positioning method and system based on machine vision
CN121190314A