Image-based circuit board electronic component positioning method and system

Through image processing and deep learning technology, combined with the solder point clustering algorithm, the problem of low positioning accuracy of circuit board components in traditional methods is solved, efficient component and solder joint identification is achieved, and the positioning accuracy of electronic components on the circuit board is improved. and reliability.

CN118762003AActive Publication Date: 2024-10-11NANTONG QINGLANG INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202411238501.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2024-10-11
Estimated Expiration
2044-09-05

AI Technical Summary

Technical Problem

Traditional circuit board image processing methods are difficult to accurately identify pins and solder joints in component-dense areas, resulting in low electronic component positioning accuracy and efficiency. Especially in complex environments, there is a lack of effective methods to analyze component body contours, pins, and solder joints. The geometric relationship between them affects the positioning accuracy.

Method used

An image-based circuit board electronic component positioning method is adopted, the histogram maximum entropy method and the Ttti method are used for image binarization and area segmentation, and the RetinaNet neural network combined with the deep learning model and self-attention mechanism is used for pin feature detection. Point clustering algorithm and least squares fitting algorithm identify solder joint locations and analyze the geometric relationship between component body, pins and solder joints to locate electronic components.

Benefits of technology

It improves the accuracy and efficiency of component positioning, enhances the accuracy and robustness of pin and solder joint identification, ensures the accurate position and direction of electronic components on the circuit board, and improves the accuracy and reliability of overall positioning. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118762003A_ABST
    Figure CN118762003A_ABST
Patent Text Reader

Abstract

The invention discloses a circuit board electronic component positioning method and system based on an image, and relates to the technical field of electronic component positioning. The circuit board electronic component positioning method based on the image comprises the following steps: carrying out region segmentation on circuit board image data; screening element dense image data from the segmented circuit board image data; identifying a contour position of the element body based on the contour edge of the element body; extracting pin features in the element dense image data to carry out target detection, and identifying pin positions based on pin types generated by the target detection; identifying a welding spot position in the welding spot area by using a least square fitting algorithm; and analyzing a geometrical relationship among the contour position, the pin position and the welding spot position of the element body, and positioning the position of the electronic element based on an analysis result. According to the method, clustering analysis can be carried out on the preliminarily positioned welding spot areas through the welding spot clustering algorithm, so that non-welding-spot areas are effectively removed, and the welding spot areas are accurately identified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic component positioning, and in particular to an image-based circuit board electronic component positioning method and system. Background Art

[0002] Circuit boards, also known as printed circuit boards (PCBs), are a core component in electronic engineering. They are used to support and connect electronic components. They achieve electrical connections between electronic components through pre-designed conductive paths, pads, etc., and are an indispensable foundation for assembling electronic devices and electronic systems. There are many types of circuit boards, including single-sided boards, double-sided boards, and multi-layer boards, which are widely used in consumer electronics, computer communications, industrial control, medical equipment, and other fields.

[0003] The position and welding quality of electronic components directly affect the performance of the circuit. Accurate component positioning can ensure that the functions of the circuit design are correctly implemented and avoid circuit failure or performance degradation caused by component position errors. During the testing and maintenance of circuit boards, accurate component positioning information helps to quickly locate problematic components and improve testing efficiency and maintenance accuracy.

[0004] Traditional methods often fail to effectively extract the foreground of the circuit board during the regional segmentation of the circuit board image, resulting in interference from noise and irrelevant areas, which not only reduces the accuracy of image processing, but also affects the efficiency and quality of subsequent processing. In the screening and positioning of component-dense areas, the lack of effective methods to accurately identify these areas often leads to low accuracy and efficiency in component positioning, which is particularly evident in the processing of high-density circuit boards. Traditional technologies often lack accuracy and robustness in the detection of pin features, especially in the pin identification problem in complex environments, which directly affects the accuracy and reliability of subsequent electronic component positioning and identification. The lack of effective methods to analyze the geometric relationship between the component body contour position, pin position and solder joint position leads to insufficient understanding of the spatial structure of electronic components, which in turn affects the accurate positioning and direction identification of the electronic component position, reducing the accuracy and reliability of the overall positioning.

[0005] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention

[0006] In view of the problems in the related art, the present invention proposes an image-based circuit board electronic component positioning method and system to overcome the above-mentioned technical problems existing in the existing related art.

[0007] To this end, the specific technical solution adopted by the present invention is as follows: According to one aspect of the present invention, a method for locating electronic components on a circuit board based on an image is provided. The method for locating electronic components on a circuit board based on an image comprises the following steps: S1, using an imaging device to collect circuit board image data, and performing regional segmentation on the circuit board image data, and filtering out component-dense image data from the segmented circuit board image data; S2, extracting the contour edge of the component body in the component dense image data, and identifying the contour position of the component body based on the contour edge of the component body; S3, extracting pin features from the component dense image data for target detection, and identifying pin positions based on the pin types generated by the target detection; S4, using a solder point clustering algorithm to remove non-solder point areas in the component dense image data, and using a least squares fitting algorithm to identify solder point locations in the solder point area; S5. Analyze the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locate the position of the electronic component based on the analysis result.

[0008] Preferably, collecting circuit board image data using an imaging device, and performing region segmentation on the circuit board image data, and filtering out component-dense image data from the segmented circuit board image data comprises the following steps: S11, using an imaging device to collect images of the circuit board to obtain circuit board image data; S12, using the histogram maximum entropy method to perform binarization processing on the circuit board image data to obtain a circuit board image pixel set, and combining the Ttti method to generate a circuit board salient area and a focal salient area; S13, calculating the average saliency of the salient regions of the circuit board, and taking a circuit board image pixel set with high saliency as a circuit board foreground set; S14, performing an erosion and then expansion process on the circuit board foreground set to remove noise areas and small areas in the circuit board image data; S15, calculating the ratio of the focus prominent area contained in the circuit board foreground set, if the ratio exceeds a preset threshold, it means that the focus prominent area is qualified, otherwise, it means that the focus prominent area is unqualified; S16, performing region growing on the qualified focal salient regions to segment the circuit board image data, and selecting dense regions from the segmented circuit board image data as component dense image data.

[0009] Preferably, extracting pin features from component dense image data for target detection, and identifying pin positions based on pin types generated by target detection comprises the following steps: S31, inputting the component dense image data into a deep learning model, using the deep learning model to detect the pin features in the component dense image data, and outputting the pin features of the electronic components; S32, constructing a pin dataset based on the pin features of the electronic components, inputting the pin dataset into a RetinaNet neural network based on a self-attention mechanism for optimization, and outputting the optimized pin features; S33, inputting the optimized pin features into the network pyramid for classification, and setting the pin positioning algorithm for the output pin types respectively; S34, using a pin positioning algorithm to obtain prior information of each pin type, integrating the prior information of all pin types, and identifying the pin position based on the prior information integration result.

[0010] Preferably, constructing a pin dataset based on the pin features of electronic components, inputting the pin dataset into a RetinaNet neural network based on a self-attention mechanism for optimization, and outputting the optimized pin features comprises the following steps: S321, marking pin features in the component dense image data, and combining the marked component dense image data to generate a pin data set; S322, adding a self-attention layer to the feature extraction layer of the RetinaNet neural network to generate a RetinaNet neural network based on the self-attention mechanism; S323, selecting a cross entropy loss function to implement training of the RetinaNet neural network, and using the pin dataset as input of the RetinaNet neural network; S324. Optimize the pin data set using the trained RetinaNet neural network and output optimized pin features.

[0011] Preferably, removing the non-solder point area in the component dense image data by using a solder point clustering algorithm, and identifying the solder point position in the solder point area by using a least squares fitting algorithm comprises the following steps: S41, extracting solder joint color features of the solder joint area and the background area in the component dense image data, establishing a color feature model, and determining the positioning standard of the solder joint area based on the color feature model to achieve preliminary positioning of the solder joint area; S42, performing cluster analysis on the initially located solder joint areas using a solder joint clustering algorithm, and removing non-solder joint areas in the component dense image data; S43, determining the distribution of misjudged solder joints and underjudged solder joints in the initially located solder joint area, and extracting neighborhood information of the initially located solder joint area by using a window scanning method; S44, performing filling filtering on the initially located solder joint area based on the neighborhood information of the initially located solder joint area to generate a morphological solder joint area; S45, taking the center point of the morphological solder joint area as the determination pixel point, calculating the center point and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center point and radius.

[0012] Preferably, using a solder joint clustering algorithm to perform cluster analysis on the initially located solder joint areas and removing non-solder joint areas in the component dense image data includes the following steps: S421, presetting the number of neighbors of the initially located solder joint regions, and calculating the similarity between the initially located solder joint regions in combination with the Gaussian kernel to obtain a similarity matrix; S422, calculating a diagonal matrix based on the similarity matrix, and constructing a Laplace matrix according to the diagonal matrix; S423, extracting the maximum vector feature in the Laplace matrix, and distributing the maximum vector feature to generate a solder joint decision attribute distribution; S424, estimating the mutation points of the distribution of the solder point decision attribute, taking the mutation points within a preset range of the distribution of the solder point decision attribute as cluster center points, and calculating the number of cluster centers using a mutation point estimation algorithm; S425 , performing cluster analysis on the initially located solder joint areas based on the cluster center points and the number of cluster centers, and removing areas in the component dense image data that are not classified into the cluster centers based on the cluster analysis results.

[0013] Preferably, taking the center point of the morphological solder joint area as the determination pixel point, calculating the center point and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center point and radius includes the following steps: S451, taking the center point of the morphological welding spot area as a determination pixel point, and scanning the determination pixel points point by point according to a preset scanning order to obtain statistics of the determination pixel points; S452, selecting a preset filling threshold and filtering threshold, and comparing the filling threshold and filtering threshold with the statistics of the determined pixel points respectively; if the statistics of the determined pixel points are less than or equal to the filling threshold, retaining the determined pixel points as the filling of the under-determined solder joints in the morphological solder joint area; if the statistics of the determined pixel points are less than or equal to the filtering threshold, removing the determined pixel points as the filtering of the mis-determined solder joints in the morphological solder joint area; S453, using a least squares fitting algorithm to obtain the center and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center and radius of the solder joint.

[0014] Preferably, analyzing the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locating the position of the electronic component based on the analysis result comprises the following steps: S51, establishing a geometric mapping relationship between the contour position of the component body, the pin position and the solder joint position, and analyzing the spatial structure of the electronic component based on the geometric mapping relationship; S52, extracting key geometric parameters based on the spatial structure of the electronic component, and calculating the spatial distance between the key geometric parameters using a geometric constraint algorithm; S53, establishing geometric constraints according to the spatial distance between the key geometric parameters, and using the geometric constraints as constraints for locating the position of the electronic component; S54. Based on the constraints of the electronic component positions, the spatial distance of the electronic components is calculated using trilateration, and the positions of the electronic components are located according to the spatial distance of the electronic components.

[0015] Preferably, the calculation formula for the solder joint position is: ; In the formula, f Indicates the location of the solder joint; ( a , b ) represents the center coordinates of the morphological solder joint area; r Indicates the radius of the morphological solder joint area; i , j Respectively represent rows and columns in component dense image data; Indicates the threshold value.

[0016] According to another aspect of the present invention, there is also provided an image-based circuit board electronic component positioning system, the image-based circuit board electronic component positioning system comprising a data acquisition module, a component body position recognition module, a pin position recognition module, a solder joint position recognition module and an electronic component positioning module: The data acquisition module is sequentially connected with the component body position recognition module, the pin position recognition module, the solder joint position recognition module and the electronic component positioning module; A data acquisition module is used to collect circuit board image data using an imaging device, and to perform region segmentation on the circuit board image data, and to filter out component-intensive image data from the segmented circuit board image data; A component body position recognition module is used to extract the contour edge of the component body in the component dense image data, and recognize the contour position of the component body based on the contour edge of the component body; A pin position recognition module is used to extract pin features from component dense image data for target detection, and to identify pin positions based on pin types generated by target detection; A solder joint position recognition module, used to remove non-solder joint areas in component dense image data using a solder joint clustering algorithm, and to identify solder joint positions in the solder joint area using a least squares fitting algorithm; The electronic component positioning module is used to analyze the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locate the electronic component position based on the analysis results.

[0017] The beneficial effects of the present invention are: 1. The present invention uses the histogram maximum entropy method and the Ttti method to perform binarization and region segmentation of the circuit board image, effectively extracts the foreground of the circuit board, reduces the interference of noise and irrelevant areas, and provides clear image data for subsequent processing. By calculating the significance of the focal significant area and the ratio to the foreground of the circuit board, the component-dense areas can be accurately screened out, thereby improving the accuracy and efficiency of component positioning.

[0018] 2. The present invention performs pin feature detection based on a deep learning model and uses a RetinaNet neural network based on a self-attention mechanism for optimization. It can effectively identify and optimize pin features, improve the accuracy and robustness of detection, and at the same time, through the classification in the network pyramid and the setting of the pin positioning algorithm, it can accurately identify and locate different types of pins, providing effective information for subsequent electronic component positioning and identification.

[0019] 3. The present invention can perform cluster analysis on the initially located solder joint area through the solder joint clustering algorithm, thereby effectively removing the non-solder joint area, accurately identifying the solder joint area, and improving the accuracy of the solder joint position. At the same time, by analyzing the distribution of misjudged solder joints and under-judged solder joints in the initially located solder joint area, and using the window scanning method to extract neighborhood information, it can effectively reduce misjudgments and missed judgments, and improve the reliability of solder joint identification. The center and radius of the solder joint are calculated based on the regional center point of the morphological solder joint area, and the position of the solder joint can be accurately determined, ensuring the accuracy and stability of the solder joint position.

[0020] 4. By analyzing the geometric relationship between the component body contour position, pin position and solder point position, the present invention can better understand the spatial structure of the electronic component, provide important geometric constraints for subsequent positioning, and thus effectively locate the position of the electronic component and improve the overall positioning accuracy. At the same time, based on the geometric constraints and triangulation, the position of the electronic component is located, which can accurately determine the position and direction of the electronic component on the circuit board, thereby improving the accuracy and reliability of the overall positioning. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. 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 paying creative work.

[0022] Figure 1 is a flow chart of a method for locating electronic components of a circuit board based on an image according to an embodiment of the present invention; Figure 2 The figure is a principle block diagram of an image-based circuit board electronic component positioning system according to an embodiment of the present invention.

[0023] In the figure: 1. Data acquisition module; 2. Component body position identification module; 3. Pin position identification module; 4. Solder point position identification module; 5. Electronic component positioning module. DETAILED DESCRIPTION

[0024] To further illustrate each embodiment, the present invention provides drawings, which are part of the disclosure of the present invention and are mainly used to illustrate the embodiments. They can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementation methods and advantages of the present invention.

[0025] According to an embodiment of the present invention, a method and system for positioning electronic components on a circuit board based on an image are provided.

[0026] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, according to an image-based circuit board electronic component positioning method according to an embodiment of the present invention, the image-based circuit board electronic component positioning method includes the following steps: S1. Using an imaging device to collect circuit board image data, and performing region segmentation on the circuit board image data, and filtering out component-intensive image data from the segmented circuit board image data.

[0027] The process of collecting circuit board image data by using an imaging device and performing region segmentation on the circuit board image data and filtering out component-intensive image data from the segmented circuit board image data includes the following steps: S11. Using an imaging device to capture images of the circuit board to obtain circuit board image data.

[0028] It should be noted that using imaging equipment to collect circuit board image data means using a camera, scanner or other imaging equipment to shoot or scan the circuit board to obtain the image data of the circuit board. These imaging devices can capture information such as the appearance, structure and component layout of the circuit board, and provide raw data for subsequent image processing and analysis. This step is the first step in the electronic component positioning method, laying the foundation for subsequent image processing and component positioning.

[0029] S12. Binarize the circuit board image data using the histogram maximum entropy method to obtain a circuit board image pixel set, and generate a circuit board salient area and a focus salient area in combination with the Ttti method.

[0030] It should be noted that the specific steps of the histogram maximum entropy method include: Calculate the grayscale histogram of the circuit board image and count the number of pixels at each grayscale level in the image; calculate the entropy of the image based on the grayscale histogram to measure the amount of information in the image. Within the range of pixel grayscale levels, determine a threshold with the goal of maximizing entropy and segment the image into background and foreground.

[0031] It should be noted that the Ttti method obtains the topological features of the image by performing topological analysis on the binarized image, and determines the salient areas and focal salient areas in the image based on the topological features.

[0032] It should be noted that the following steps are involved in binarizing the circuit board image data using the histogram maximum entropy method to obtain a circuit board image pixel set, and in combination with the Ttti method to generate a circuit board salient area and a focal salient area: The grayscale histogram of the circuit board image is counted to record the number of pixels at each grayscale level; the entropy of the image is calculated based on the histogram to measure the amount of information in the image; within the range of pixel grayscale levels, the threshold is iteratively adjusted until a threshold is found that maximizes the entropy of the image; the image is binarized according to the determined threshold to obtain two images, background and foreground; the binarized image is topologically analyzed to obtain the topological features of the image; based on the topological features, the salient areas and the focus salient areas in the image are determined, specifically, the salient areas can be determined by detecting the connected areas in the image and based on the size, shape and other features of the connected areas, and for the focus salient areas, the position and range of the focus areas are determined by further analyzing their position and distribution in the image.

[0033] S13, calculating the average saliency of the salient areas of the circuit board, and taking a set of circuit board image pixels with high saliency as a circuit board foreground set.

[0034] S14, performing an erosion and then dilation process on the circuit board foreground set to remove noise areas and small areas in the circuit board image data.

[0035] It should be noted that the circuit board foreground set is subjected to an erosion operation, that is, the pixels around the foreground pixels are set as background pixels, thereby reducing the boundary of the foreground area. The erosion operation can utilize the erosion algorithm in image processing, such as using a fixed-size structural element to traverse the foreground pixels in the image and update the pixel value according to the shape and size of the structural element.

[0036] The image after erosion is dilated, that is, the pixels around the foreground pixels are set as foreground pixels, thereby expanding the boundary of the foreground area. The dilation operation can also utilize the dilation algorithm in image processing, and also use a fixed-size structural element to traverse the foreground pixels in the image and update the pixel value according to the shape and size of the structural element.

[0037] S15, calculating the ratio of the focus prominent area contained in the circuit board foreground set, if the ratio exceeds a preset threshold, it means that the focus prominent area is qualified, otherwise, it means that the focus prominent area is unqualified; S16, performing region growing on the qualified focal salient regions to segment the circuit board image data, and selecting dense regions from the segmented circuit board image data as component dense image data.

[0038] It should be noted that performing region growing on qualified focal salient regions to segment the circuit board image data and selecting dense regions from the segmented circuit board image data as component dense image data includes the following steps: Select qualified focal salient areas as seed points and perform region growing operations. The region growing algorithm is based on pixel similarity or region merging. Adjacent pixels or regions are merged into a larger region according to similarity or merging conditions. In the process of region growing, the stop conditions of growth are set, such as pixel grayscale difference or region size.

[0039] After the region growing operation, the focal salient region will be segmented into multiple connected regions, representing different components or component groups. At the same time, the segmented regions will be marked or extracted for subsequent processing and analysis.

[0040] For the segmented circuit board image data, the dense area is screened out as the component dense image data according to the pixel density or the threshold of the number of pixels in the area. The selection criteria of the dense area can be determined according to the actual needs and the characteristics of the circuit board component layout, such as the minimum distance or density between components. The screened dense area is used as the component dense image data for subsequent component positioning and analysis.

[0041] S2. Extracting the contour edge of the component body in the component dense image data, and identifying the contour position of the component body based on the contour edge of the component body.

[0042] It should be noted that extracting the contour edge of the component body in the component dense image data and identifying the contour position of the component body based on the contour edge of the component body includes the following steps: The Sobel and Canny edge detection algorithms in the prior art are used to perform edge detection on the dense component image data to retain the main contour information of the component body; based on the edge detection result, the contour of the component body is extracted using the contour detection algorithm; the extracted contours are sorted and screened to remove irrelevant small contours and noise; the extracted component body contours are curve fitted by polygon fitting or Bezier curve fitting and the approximate contour of the component body is obtained according to the fitting result to improve the accuracy of the contour position; based on the fitted component body contour, the geometric center or centroid of the contour is calculated as the contour position of the component body.

[0043] S3. Extract pin features from component dense image data for target detection, and identify pin locations based on pin types generated by target detection.

[0044] The extraction of pin features in component dense image data for target detection and identification of pin positions based on pin types generated by target detection include the following steps: S31, inputting the component dense image data into a deep learning model, using the deep learning model to detect the pin features in the component dense image data, and outputting the pin features of the electronic components; S32. Construct a pin dataset based on the pin features of electronic components, input the pin dataset into the RetinaNet neural network based on the self-attention mechanism for optimization, and output the optimized pin features.

[0045] Among them, a pin dataset is constructed based on the pin features of electronic components, the pin dataset is input into the RetinaNet neural network based on the self-attention mechanism for optimization, and the output of the optimized pin features includes the following steps: S321, marking pin features in the component dense image data, and combining the marked component dense image data to generate a pin data set; S322. Add a self-attention layer to the feature extraction layer of the RetinaNet neural network to generate a RetinaNet neural network based on the self-attention mechanism.

[0046] It should be noted that adding a self-attention layer to the feature extraction layer of the RetinaNet neural network and generating a RetinaNet neural network based on the self-attention mechanism includes the following steps: Construct a basic RetinaNet structure, including a backbone feature extraction network and a feature pyramid network. The backbone feature extraction network selects a network structure, such as ResNet, EfficientNet, etc., to extract the features of the input image. The FPN network is used to construct a multi-scale feature pyramid to detect targets at different scales.

[0047] In the feature extraction layer of RetinaNet, a self-attention layer is added to enhance the representation ability of features and the expression of semantic information. The self-attention mechanism can learn the dependencies between positions in the input sequence through the attention matrix, thereby dynamically adjusting the feature weight of each position.

[0048] In the feature extraction layer of RetinaNet, a self-attention layer is added to each level of the feature pyramid network to enhance the feature expression capability at each scale. The input of the self-attention layer is the feature tensor from the previous layer, and the dimension and number of channels of the feature can be adjusted through convolution operations to adapt to the input requirements of the self-attention layer.

[0049] It should be noted that the self-attention layer usually consists of three parts: query, key, and value. The input features are mapped into feature tensors of query, key, and value respectively through convolution operations. Then the similarity between the query and the key is calculated to obtain the attention matrix. The attention matrix is ​​then multiplied by the value feature tensor to obtain the weighted feature representation. Finally, the weighted features are fused and adjusted through multi-head self-attention or other operations to obtain the final feature representation.

[0050] After adding the self-attention layer, the entire network is trained end-to-end, and an appropriate loss function (Focal Loss) is used to train the network in combination with the labeled data of the target detection task. The network parameters are optimized and adjusted through stochastic gradient descent (SGD) or Adam optimizer.

[0051] S323, selecting a cross entropy loss function to implement training of the RetinaNet neural network, and using the pin dataset as input of the RetinaNet neural network; S324. Optimize the pin data set using the trained RetinaNet neural network and output optimized pin features.

[0052] S33. Input the optimized pin features into the network pyramid for classification, and set the pin positioning algorithm for the output pin type respectively.

[0053] It should be noted that the optimized pin features are input into the network pyramid for classification, and the pin location algorithm is set for the output pin types respectively, including the following steps: The optimized pin features are input into the feature pyramid network of RetinaNet to ensure that the pin features are properly preprocessed and feature extracted to retain the important information and features of the pins.

[0054] Pin type classification is performed in the output layer of RetinaNet, that is, each detected pin is identified to which category it belongs, and the appropriate pin category is set according to the annotation information of the pin dataset, such as power pins, signal pins, ground pins, etc.; according to the pin classification results, the corresponding pin positioning algorithm is set for each pin type.

[0055] The pin positioning algorithm can be a method based on the target bounding box, such as pin positioning based on IoU (Intersection over Union), or a method based on pin feature points, such as pin center point positioning. For each pin type, a suitable pin positioning algorithm is selected according to its characteristics and shape, and implemented and optimized; the position and bounding box information of each pin is obtained according to the pin positioning algorithm.

[0056] S34, using a pin positioning algorithm to obtain prior information of each pin type, integrating the prior information of all pin types, and identifying the pin position based on the prior information integration result.

[0057] S4. Use a solder joint clustering algorithm to remove non-solder joint areas in the component dense image data, and use a least square fitting algorithm to identify solder joint positions in the solder joint area.

[0058] Among them, using the solder joint clustering algorithm to remove the non-solder joint area in the component dense image data, and using the least square fitting algorithm to identify the solder joint position in the solder joint area includes the following steps: S41, extracting solder joint color features of the solder joint area and the background area in the component dense image data, establishing a color feature model, and determining the positioning standard of the solder joint area based on the color feature model to achieve preliminary positioning of the solder joint area; S42, using a solder point clustering algorithm to perform cluster analysis on the initially located solder point areas, and remove non-solder point areas in the component dense image data.

[0059] The method of clustering the initially located solder joint areas using a solder joint clustering algorithm and removing non-solder joint areas in the component dense image data includes the following steps: S421, presetting the number of neighbors of the initially located solder joint regions, and calculating the similarity between the initially located solder joint regions in combination with the Gaussian kernel to obtain a similarity matrix.

[0060] It should be noted that the similarity between the initially located solder joint regions calculated by combining the Gaussian kernel includes the following steps: The solder joint area is extracted from the circuit board image through target detection or image segmentation; the feature extraction of each solder joint area is performed through HOG, SURF or convolutional neural network in deep learning; the feature similarity between the solder joint areas is calculated using the Gaussian kernel function, which can calculate the similarity based on the distance between the feature vectors, where the smaller the distance, the higher the similarity; the Gaussian kernel parameters are selected, including kernel size, kernel function type and kernel function parameters, and adjusted according to the actual situation and data characteristics to obtain better similarity measurement results.

[0061] A similarity threshold is set to determine whether two solder joint areas are similar. When the similarity of two solder joint areas is higher than the threshold, they are considered to be of the same type or have similar features. At the same time, based on the calculated similarity results, the solder joint areas with similarity higher than the threshold are preliminarily located, and the solder joint areas with high similarity are classified into the same category or clustered as the results of preliminary positioning.

[0062] S422. Calculate a diagonal matrix based on the similarity matrix, and construct a Laplacian matrix according to the diagonal matrix.

[0063] It should be noted that calculating the diagonal matrix based on the similarity matrix and constructing the Laplacian matrix according to the diagonal matrix includes the following steps: A similarity matrix is ​​constructed based on the similarity calculation method between data samples. The similarity calculation methods include Euclidean distance, cosine similarity, correlation coefficient, etc. Each element of the similarity matrix represents the degree of similarity between the corresponding samples. The larger the value, the higher the similarity.

[0064] According to the similarity matrix, a diagonal matrix is ​​calculated. A diagonal matrix is ​​usually a matrix whose diagonal elements are non-negative numbers and the remaining elements are zero. The diagonal elements of the diagonal matrix are usually the sum of the elements of each row or column of the similarity matrix, which is used to represent the sum of the similarities of each sample.

[0065] The Laplace matrix is ​​constructed based on the diagonal matrix. The Laplace matrix is ​​a symmetric positive definite matrix used to characterize the structural information and relationships between data samples. The Laplace matrix usually consists of two parts: the degree matrix and the adjacency matrix. The degree matrix is ​​a diagonal matrix whose diagonal elements represent the degree of each node (the number of edges connected to other nodes). The adjacency matrix represents the connection relationship between samples and can be constructed based on the similarity matrix.

[0066] S423, extracting the maximum vector feature in the Laplace matrix, and distributing the maximum vector feature to generate a solder joint decision attribute distribution; S424, estimating the mutation points of the distribution of the solder point decision attribute, taking the mutation points within a preset range of the distribution of the solder point decision attribute as cluster center points, and calculating the number of cluster centers using a mutation point estimation algorithm; S425 , performing cluster analysis on the initially located solder joint areas based on the cluster center points and the number of cluster centers, and removing areas in the component dense image data that are not classified into the cluster centers based on the cluster analysis results.

[0067] It should be noted that clustering analysis is performed on the initially located solder joint area based on the cluster center points and the number of cluster centers, and removing the area not classified into the cluster center in the component dense image data based on the cluster analysis result includes the following steps: The number of cluster centers is determined using a mutation point estimation algorithm. The determined cluster center points and number are used to perform cluster analysis on the initially located solder joint area. Clustering algorithms include K-means, DBSCAN, etc. Appropriate algorithms are selected for clustering based on specific needs. The clustering results are analyzed to evaluate the effect and quality of each cluster, and clustering evaluation indicators such as silhouette coefficient and DB index are used to evaluate the compactness and separation of clusters. Based on the clustering results, the areas that are not divided into any cluster centers are identified, and the removed image data is subsequently processed, such as filling and smoothing, to ensure the connectivity and accuracy of the solder joint area.

[0068] S43, determining the distribution of misjudged solder joints and underjudged solder joints in the initially located solder joint area, and extracting neighborhood information of the initially located solder joint area by using a window scanning method.

[0069] It should be noted that determining the distribution of misjudged solder joints and underjudged solder joints in the initially located solder joint area and extracting neighborhood information of the initially located solder joint area by using a window scanning method includes the following steps: The initially located solder joint areas are classified into correctly determined solder joint areas, misjudged solder joint areas and under-determined solder joint areas. The correctly determined solder joint areas refer to solder joints that are accurately identified and located, the misjudged solder joint areas refer to areas that are mistakenly identified as solder joints, and the under-determined solder joint areas refer to actual solder joint areas that are not identified as solder joints.

[0070] Statistics are collected on the distribution of various solder joint areas, including quantity, density and spatial distribution characteristics; the position distribution patterns of misjudged solder joints and underjudged solder joints are analyzed; and their distribution and reasons in the solder joint area are understood.

[0071] The window scanning method is used to extract the neighborhood information of the initially located solder joint area. A fixed-size window is set around each solder joint area, and the neighborhood information is extracted by scanning the pixels or feature information in the window.

[0072] Pixels or feature information are extracted inside the window, including grayscale value, color information, texture features, etc., and feature extraction algorithms such as SIFT and SURF are used to extract feature information inside the window. According to the results of neighborhood information analysis, the initially located solder joint area is further judged and corrected to reduce misjudgment and under-judgment.

[0073] S44, performing filling filtering on the initially located solder joint area based on the neighborhood information of the initially located solder joint area to generate a morphological solder joint area; S45, taking the center point of the morphological solder joint area as the determination pixel point, calculating the center point and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center point and radius.

[0074] The process of using the center point of the morphological solder joint area as a determination pixel point, calculating the center point and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center point and radius includes the following steps: S451, taking the center point of the morphological welding spot area as a determination pixel point, and scanning the determination pixel points point by point according to a preset scanning order to obtain statistics of the determination pixel points; S452, selecting a preset filling threshold and filtering threshold, and comparing the filling threshold and filtering threshold with the statistics of the determined pixel points respectively; if the statistics of the determined pixel points are less than or equal to the filling threshold, retaining the determined pixel points as the filling of the under-determined solder joints in the morphological solder joint area; if the statistics of the determined pixel points are less than or equal to the filtering threshold, removing the determined pixel points as the filtering of the mis-determined solder joints in the morphological solder joint area; S453, using a least squares fitting algorithm to obtain the center and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center and radius of the solder joint.

[0075] The calculation formula of the solder joint position is: ; In the formula, f Indicates the location of the solder joint; ( a , b ) represents the center coordinates of the morphological solder joint area; r Indicates the radius of the morphological solder joint area; i , j Respectively represent rows and columns in component dense image data; Indicates the threshold value.

[0076] S5. Analyze the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locate the position of the electronic component based on the analysis result.

[0077] The step of analyzing the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locating the electronic component position based on the analysis result includes the following steps: S51. Establish a geometric mapping relationship between the contour position of the component body, the pin position and the solder joint position, and analyze the spatial structure of the electronic component based on the geometric mapping relationship.

[0078] S52. Extract key geometric parameters based on the spatial structure of the electronic components, and calculate the spatial distances between the key geometric parameters using a geometric constraint algorithm.

[0079] It should be noted that a three-dimensional model of an electronic component is constructed by using CAD software, and the contours, pins, and solder joint positions of the component are annotated in the model, thereby establishing a geometric mapping relationship between them.

[0080] Use a 3D scanner, laser rangefinder or other sensor equipment to measure electronic components in real time and obtain the 3D coordinate data of the component surface to determine the spatial position relationship between the various parts of the component.

[0081] Match the CAD model of the electronic component with the actual component, and establish a geometric mapping relationship between the component outline, pins and solder joint positions by comparing the geometric features and size information of the two.

[0082] S53, establishing geometric constraints according to the spatial distance between the key geometric parameters, and using the geometric constraints as constraints for locating the position of the electronic component; S54. Based on the constraints of the electronic component positions, the spatial distance of the electronic components is calculated using trilateration, and the positions of the electronic components are located according to the spatial distance of the electronic components.

[0083] It should be noted that calculating the spatial distance of electronic components by using the trilateration method and locating the position of the electronic components according to the spatial distance of the electronic components includes the following steps: Select three reference edges or reference lines in space, including the contour edge of the component, the pin position, or other line segments at known positions; use measurement software to measure the distances between the three selected sides respectively to ensure the accuracy of the measurement results; according to the principle of triangulation, use the measured lengths of the three sides to calculate the spatial distance between electronic components, and use the triangle similarity principle in geometry or the Pythagorean theorem of right triangles to calculate the distance; locate and adjust the position of the electronic component based on the obtained spatial distance and combined with constraint conditions.

[0084] like Figure 2 As shown, according to another embodiment of the present invention, there is also provided an image-based circuit board electronic component positioning system, the image-based circuit board electronic component positioning system comprising a data acquisition module 1, a component body position recognition module 2, a pin position recognition module 3, a solder joint position recognition module 4 and an electronic component positioning module 5: The data acquisition module 1 is connected to the component body position recognition module 2, the pin position recognition module 3, the solder joint position recognition module 4 and the electronic component positioning module 5 in sequence; The data acquisition module 1 is used to collect circuit board image data by using an imaging device, and to perform region segmentation on the circuit board image data, and to filter out component-intensive image data from the segmented circuit board image data; The component body position recognition module 2 is used to extract the contour edge of the component body in the component dense image data, and recognize the contour position of the component body based on the contour edge of the component body; The pin position recognition module 3 is used to extract the pin features in the component dense image data for target detection, and recognize the pin position based on the pin type generated by the target detection; A solder joint position identification module 4 is used to remove non-solder joint areas in the component dense image data using a solder joint clustering algorithm, and to identify solder joint positions in the solder joint area using a least squares fitting algorithm; The electronic component positioning module 5 is used to analyze the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locate the electronic component position based on the analysis result.

[0085] In summary, with the aid of the above-mentioned technical scheme of the present invention, the present invention uses the histogram maximum entropy method and the Ttti method to perform binarization and region segmentation of the circuit board image, effectively extracts the foreground of the circuit board, reduces the interference of noise and irrelevant areas, and provides clear image data for subsequent processing. By calculating the significance of the focal significant area and the ratio to the foreground of the circuit board, the component-dense area can be accurately screened out, thereby improving the accuracy and efficiency of component positioning. The present invention performs pin feature detection based on a deep learning model, and uses a RetinaNet neural network based on a self-attention mechanism for optimization, which can effectively identify and optimize pin features, thereby improving the accuracy and robustness of detection. At the same time, through the classification in the network pyramid and the setting of the pin positioning algorithm, different types of pins can be accurately identified and positioned, providing effective information for subsequent electronic component positioning and identification. The present invention can perform cluster analysis on the initially located solder joint area through a solder joint clustering algorithm, thereby The non-solder point area is effectively removed, the solder point area is accurately identified, and the accuracy of the solder point location is improved. At the same time, by analyzing the distribution of misjudged solder points and missed solder points in the initially located solder point area, and using the window scanning method to extract neighborhood information, it can effectively reduce misjudgments and missed judgments, and improve the reliability of solder point identification. The center point and radius of the solder point are calculated based on the regional center point of the morphological solder point area, and the position of the solder point can be accurately determined, ensuring the accuracy and stability of the solder point position. The present invention can better understand the spatial structure of electronic components by analyzing the geometric relationship between the component body contour position, the pin position and the solder point position, and provide important geometric constraints for subsequent positioning, thereby effectively locating the position of the electronic component and improving the overall positioning accuracy. At the same time, based on the geometric constraints and the triangulation method, the position of the electronic component is located, and the position and direction of the electronic component on the circuit board can be accurately determined, thereby improving the accuracy and reliability of the overall positioning. The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for locating electronic components on a circuit board based on an image, characterized in that: The image-based circuit board electronic component positioning method comprises the following steps: S1, using an imaging device to collect circuit board image data, and performing regional segmentation on the circuit board image data, and filtering out component-dense image data from the segmented circuit board image data; S2, extracting the contour edge of the component body in the component dense image data, and identifying the contour position of the component body based on the contour edge of the component body; S3, extracting pin features from the component dense image data for target detection, and identifying pin positions based on the pin types generated by the target detection; S4, using a solder point clustering algorithm to remove non-solder point areas in the component dense image data, and using a least squares fitting algorithm to identify solder point locations in the solder point area; S5. Analyze the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locate the position of the electronic component based on the analysis result.

2. The image-based circuit board electronic component positioning method according to claim 1, characterized in that: The method of collecting circuit board image data by using an imaging device, segmenting the circuit board image data into regions, and filtering out component-dense image data from the segmented circuit board image data comprises the following steps: S11, using an imaging device to collect images of the circuit board to obtain circuit board image data; S12, using the histogram maximum entropy method to perform binarization processing on the circuit board image data to obtain a circuit board image pixel set, and combining the Ttti method to generate a circuit board salient area and a focal salient area; S13, calculating the average saliency of the salient regions of the circuit board, and taking a circuit board image pixel set with high saliency as a circuit board foreground set; S14, performing an erosion and then expansion process on the circuit board foreground set to remove noise areas and small areas in the circuit board image data; S15, calculating the ratio of the focus prominent area contained in the circuit board foreground set, if the ratio exceeds a preset threshold, it means that the focus prominent area is qualified, otherwise, it means that the focus prominent area is unqualified; S16, performing region growing on the qualified focal salient regions to segment the circuit board image data, and selecting dense regions from the segmented circuit board image data as component dense image data.

3. The image-based circuit board electronic component positioning method according to claim 2, characterized in that: The method of extracting pin features from component dense image data to perform target detection and identifying pin positions based on pin types generated by target detection includes the following steps: S31, inputting the component dense image data into a deep learning model, using the deep learning model to detect the pin features in the component dense image data, and outputting the pin features of the electronic components; S32, constructing a pin dataset based on the pin features of the electronic components, inputting the pin dataset into a neural network based on a self-attention mechanism for optimization, and outputting the optimized pin features; S33, inputting the optimized pin features into the network pyramid for classification, and setting the pin positioning algorithm for the output pin types respectively; S34, using a pin positioning algorithm to obtain prior information of each pin type, integrating the prior information of all pin types, and identifying the pin position based on the prior information integration result.

4. The image-based circuit board electronic component positioning method according to claim 3, characterized in that: The pin dataset is constructed based on the pin features of the electronic components, the pin dataset is input into a neural network based on the self-attention mechanism for optimization, and the optimized pin features are outputted, including the following steps: S321, marking pin features in the component dense image data, and combining the marked component dense image data to generate a pin data set; S322, adding a self-attention layer to the feature extraction layer of the neural network to generate a neural network based on the self-attention mechanism; S323, selecting a cross entropy loss function to implement training of the neural network, and using the pin data set as input of the neural network; S324. Optimize the pin data set using the trained neural network and output optimized pin features.

5. The image-based circuit board electronic component positioning method according to claim 4, characterized in that: The method of removing non-solder point areas in the component dense image data by using a solder point clustering algorithm and identifying solder point locations in the solder point area by using a least squares fitting algorithm comprises the following steps: S41, extracting solder joint color features of the solder joint area and the background area in the component dense image data, establishing a color feature model, and determining the positioning standard of the solder joint area based on the color feature model to achieve preliminary positioning of the solder joint area; S42, performing cluster analysis on the initially located solder joint areas using a solder joint clustering algorithm, and removing non-solder joint areas in the component dense image data; S43, determining the distribution of misjudged solder joints and underjudged solder joints in the initially located solder joint area, and extracting neighborhood information of the initially located solder joint area by using a window scanning method; S44, performing filling filtering on the initially located solder joint area based on the neighborhood information of the initially located solder joint area to generate a morphological solder joint area; S45, taking the center point of the morphological solder joint area as the determination pixel point, calculating the center point and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center point and radius.

6. The image-based circuit board electronic component positioning method according to claim 5, characterized in that: The method of performing cluster analysis on the initially located solder joint areas by using a solder joint clustering algorithm and removing non-solder joint areas in the component dense image data comprises the following steps: S421, presetting the number of neighbors of the initially located solder joint regions, and calculating the similarity between the initially located solder joint regions in combination with the Gaussian kernel to obtain a similarity matrix; S422, calculating a diagonal matrix based on the similarity matrix, and constructing a Laplace matrix according to the diagonal matrix; S423, extracting the maximum vector feature in the Laplace matrix, and distributing the maximum vector feature to generate a solder joint decision attribute distribution; S424, estimating the mutation points of the distribution of the solder point decision attribute, taking the mutation points within a preset range of the distribution of the solder point decision attribute as cluster center points, and calculating the number of cluster centers using a mutation point estimation algorithm; S425 , performing cluster analysis on the initially located solder joint areas based on the cluster center points and the number of cluster centers, and removing areas in the component dense image data that are not classified into the cluster centers based on the cluster analysis results.

7. The image-based circuit board electronic component positioning method according to claim 6, characterized in that: The method of using the center point of the morphological solder joint area as a determination pixel point, calculating the center point and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center point and radius includes the following steps: S451, taking the center point of the morphological welding spot area as a determination pixel point, and scanning the determination pixel points point by point according to a preset scanning order to obtain statistics of the determination pixel points; S452, selecting a preset filling threshold and filtering threshold, and comparing the filling threshold and filtering threshold with the statistics of the determined pixel points respectively; if the statistics of the determined pixel points are less than or equal to the filling threshold, retaining the determined pixel points as the filling of the under-determined solder joints in the morphological solder joint area; if the statistics of the determined pixel points are less than or equal to the filtering threshold, removing the determined pixel points as the filtering of the mis-determined solder joints in the morphological solder joint area; S453, using a least squares fitting algorithm to obtain the center and radius of the solder joint in the morphological solder joint area, and calculating the solder joint position based on the center and radius of the solder joint.

8. The image-based circuit board electronic component positioning method according to claim 7, characterized in that: The step of analyzing the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locating the position of the electronic component based on the analysis result comprises the following steps: S51, establishing a geometric mapping relationship between the contour position of the component body, the pin position and the solder joint position, and analyzing the spatial structure of the electronic component based on the geometric mapping relationship; S52, extracting key geometric parameters based on the spatial structure of the electronic component, and calculating the spatial distance between the key geometric parameters using a geometric constraint algorithm; S53, establishing geometric constraints according to the spatial distance between the key geometric parameters, and using the geometric constraints as constraints for locating the position of the electronic component; S54. Based on the constraints of the electronic component positions, the spatial distance of the electronic components is calculated using trilateration, and the positions of the electronic components are located according to the spatial distance of the electronic components.

9. The image-based circuit board electronic component positioning method according to claim 8, characterized in that: The calculation formula of the solder joint position is: ; In the formula, f Indicates the location of the solder joint; ( a , b ) represents the center coordinates of the morphological solder joint area; r Indicates the radius of the morphological solder joint area; i , j Respectively represent rows and columns in component dense image data; Indicates the threshold value.

10. An image-based circuit board electronic component positioning system, used to implement the image-based circuit board electronic component positioning method according to any one of claims 1 to 9, characterized in that: The image-based circuit board electronic component positioning system includes a data acquisition module, a component body position recognition module, a pin position recognition module, a solder joint position recognition module and an electronic component positioning module: The data acquisition module is sequentially connected to the component body position recognition module, the pin position recognition module, the solder joint position recognition module and the electronic component positioning module; The data acquisition module is used to collect circuit board image data using an imaging device, and to perform region segmentation on the circuit board image data, and to filter out component-intensive image data from the segmented circuit board image data; The component body position recognition module is used to extract the contour edge of the component body in the component dense image data, and recognize the contour position of the component body based on the contour edge of the component body; The pin position recognition module is used to extract pin features in the component dense image data for target detection, and recognize the pin position based on the pin type generated by the target detection; The solder joint position identification module is used to remove non-solder joint areas in the component dense image data using a solder joint clustering algorithm, and identify solder joint positions in the solder joint area using a least squares fitting algorithm; The electronic component positioning module is used to analyze the geometric relationship between the contour position of the component body, the pin position and the solder joint position, and locate the electronic component position based on the analysis result.

Citation Information

Patent Citations

  • Detection and positioning method for PLCC component

    CN104915963A

  • Patch element positioning identification method based on minimum enclosing rectangle

    CN105809705A

  • Automatic visual inspection system for appearance of electronic component

    CN115561247A

  • Circuit board detection method and electronic device

    US20220164943A1

Cited By

  • Relay node identification method and system, electronic equipment and storage medium

    CN120374986A

  • Relay node identification method, system, electronic device and storage medium

    CN120374986B

  • Circuit board automatic scoring method and device, electronic equipment and storage medium

    CN120746994A

  • Auxiliary positioning method and system for turnover mounting of PCB (Printed Circuit Board)

    CN121505039A