PCB path planning method based on component information
Patent Information
- Application Number
- CN202610008211.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-06
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2046-01-06
AI Technical Summary
[0004]本申请实施例提供了一种基于元件信息的PCB路径规划方法,可以解决现有拍摄方式容易出现无效拍摄,检测效率低且容易出现大尺寸元件位于FOV边缘,导致出现畸变,影响图像质量的问题
本申请提供的基于元件信息的PCB路径规划方法根据元件信息获取元件分类和区域划分信息,元件信息包括PCB设计文件、贴片机坐标文件中的至少一种,元件分类包括常规元件、超大元件;根据元件信息和元件分类构建拍摄节点,基于拍摄节点和区域划分信息构建启发函数;根据启发函数计算拍摄路径,基于拍摄路径拍摄元件的元件图像,本申请实施例能够根据元件的分布区域以及尺寸分类进行路径规划,减少无效拍摄的出现,提升检测效率,并能考虑大尺寸元件的影响,减少图像畸变的可能,有效提升图像质量,降低对缺陷检测流程的干扰,大大提升检测精度和满足生产需求。
Smart Images

Figure CN121600233B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of printed circuit board manufacturing technology, and more specifically, to a PCB path planning method based on component information. Background Technology
[0002] In the printed circuit board (PCB) manufacturing industry, as electronic products continue to become smaller and more multifunctional, the size and complexity of PCBs are constantly increasing. In order to realize the production and inspection of PCBs, small field-of-view (FOV) cameras are often used to capture images of each component in the PCB, and these images are used for inspection.
[0003] However, when using a small field-of-view (FOV) camera for inspection, the shooting path is planned based on the camera's field of view and the PCB size to cover the components on the PCB. But this method does not fully consider the distribution and size information of the components, resulting in the camera taking a large number of invalid shots in areas with no components or small components, which greatly reduces the inspection efficiency. On the other hand, large components are prone to severe distortion when shooting because they are at the edge of the FOV, which seriously affects the image quality and interferes with subsequent defect inspection processes, making it difficult to meet the increasing production demands in terms of inspection accuracy. Summary of the Invention
[0004] This application provides a PCB path planning method based on component information, which can solve the problems of invalid shooting, low detection efficiency, and large-size components being located at the edge of the field of view (FOV), leading to distortion and affecting image quality, which are common in existing shooting methods. To achieve this objective, this application provides the following solutions.
[0005] According to one aspect of the embodiments of this application, a PCB path planning method based on component information is provided, the method comprising: Based on the component information, obtain component classification and area division information. The component information includes at least one of PCB design files and pick-and-place machine coordinate files. The component classification includes regular components and oversized components. Based on the component information and the component classification, a shooting node is constructed, and a heuristic function is constructed based on the shooting node and the region division information; The shooting path is calculated based on the heuristic function, and the component image of the component is captured based on the shooting path.
[0006] In one possible implementation, obtaining component classification and region division information based on component information includes: The component information is preprocessed, and component size information is obtained based on the preprocessed component information. The component classification is determined based on the component size information and the field of view of the camera. The component size information includes the component center coordinates and the component package size. A grid coordinate system is established based on the component information, and the region is divided based on the grid coordinate system to generate region division information.
[0007] In one possible implementation, the step of establishing a grid coordinate system based on the component information and dividing the region based on the grid coordinate system includes: The PCB board center point is determined based on the component information. A grid coordinate system is established based on the PCB board center point, and the density value corresponding to each grid cell of the grid coordinate system is obtained. The grid cells are clustered based on the density values, and region division information is obtained based on the clustering results.
[0008] In one possible implementation, constructing the shooting node based on the component information and the component classification includes: The classification of the component is obtained, and the shooting position corresponding to the component is determined based on the classification, the component size information, and the field of view parameter. The component corresponds to one or more shooting positions, and the shooting range corresponding to the one or more shooting positions covers the component. The shooting location is determined as the shooting node.
[0009] In one possible implementation, the construction of the heuristic function based on the shooting node and the region segmentation information includes: Obtain the Manhattan distance, coordinates, element distribution density, and additional movement distance corresponding to the shooting node; A heuristic function is constructed based on the Manhattan distance, coordinate values, component distribution density, and additional movement distance. When the nth shooting node corresponds to a super-large component, the heuristic function is:
[0010] In the formula, Let be the heuristic function for the nth shooting node. , , These are the weighting coefficients. Let n be the Manhattan distance of the nth shooting node. Let n be the element distribution density of the nth shooting node. The additional distance of movement required to photograph the aforementioned large component.
[0011] In one possible implementation, calculating the shooting path based on the heuristic function includes: An open list and a closed list are constructed based on the shooting nodes. The shooting starting point is added to the open list as the starting node. The cost function of each shooting node in the open list is obtained. The cost function is constructed based on the heuristic function and the cost of the movement distance from the starting node to the shooting node. Based on the cost function and the open and closed list paths, a shooting path is generated.
[0012] In one possible implementation, the image captured based on the capturing path includes: Move the camera based on the shooting path, determine the current shooting node, and obtain the component category and region corresponding to the shooting node; The camera's shooting parameters are adjusted according to the component classification and the region.
[0013] In one possible implementation, the method includes: Acquire captured component images and input the component images into a pre-trained image quality assessment model. The image quality assessment model is trained based on PCB image samples containing different lighting conditions, component densities, and distortion types. Adjust the camera's shooting parameters and / or the shooting path based on the image quality information output by the image quality assessment model.
[0014] In one possible implementation, adjusting the camera's shooting parameters and / or the shooting path based on the image quality information output by the image quality assessment model includes: Image problems are determined based on the quality score in the image quality information and the image information of the element. The image problems include at least one of image blurring, exposure abnormality, distortion, and perspective distortion. Adjust the camera's shooting parameters and / or the shooting path based on the image problem and the component classification corresponding to the component image.
[0015] In one possible implementation, the method includes: Obtain the pixel coordinates of the component image, and update the pixel coordinates according to the distortion control model and the pixel coordinates. The distortion control model is as follows:
[0016] In the formula, For the updated pixel coordinates, , The radial distortion coefficient is... The tangential distortion coefficient is... These are the pixel coordinates before the update.
[0017] The beneficial effects of the technical solutions provided in this application are: The PCB path planning method based on component information provided in this application obtains component classification and region division information based on component information, including at least one of PCB design files and pick-and-place machine coordinate files. Component classification includes regular components and oversized components. The method constructs shooting nodes based on component information and component classification, and constructs a heuristic function based on shooting nodes and region division information. It calculates shooting paths based on the heuristic function and captures component images based on the shooting paths. This application's embodiments can perform path planning based on the component distribution area and size classification, reducing invalid shooting, improving detection efficiency, and considering the impact of large-sized components, reducing the possibility of image distortion, effectively improving image quality, reducing interference with the defect detection process, greatly improving detection accuracy, and meeting production needs. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.
[0019] Figure 1 A flowchart of a PCB path planning method based on component information provided in an embodiment of this application. Detailed Implementation
[0020] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.
[0021] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” indicates implementation as “A,” or implementation as “A,” or implementation as “A and B.”
[0022] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0023] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, learned from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.
[0024] The PCB path planning method based on component information provided in this application aims to solve at least one technical problem existing in the prior art.
[0025] This application provides a PCB path planning method based on component information. This method can be used in a pick-and-place machine, a control computer in the pick-and-place machine, a host computer connected to the pick-and-place machine, and other objects that can acquire component information during PCB production and perform path planning based on the component information.
[0026] Optionally, such as Figure 1 As shown, the PCB path planning method based on component information in this application includes: S101: Obtain component classification and region division information based on component information.
[0027] Optionally, the component information includes at least one of PCB design files and pick-and-place machine coordinate files, and the component classification includes regular components and oversized components.
[0028] Optionally, PCB design files may include Gerber files, ODB++ files, and other files containing PCB design information. The pick-and-place machine coordinate file can be in ASCII format and includes component center coordinates. Information such as component package dimensions (w, h) indicates the information for the pick-and-place machine to place components.
[0029] Optionally, component classification and region division information are obtained based on component information, including: preprocessing component information, obtaining component size information based on preprocessed component information, determining component classification based on component size information and camera field of view, the component size information including component center coordinates and component package size; establishing a grid coordinate system based on component information, performing region division based on the grid coordinate system, and generating region division information.
[0030] Optionally, the width and height of the component can be obtained based on the component size information, and the width and length of the field of view can be obtained based on the field of view information. If the width of the component is greater than the width of the field of view and / or the length of the component is greater than the length of the field of view, then the component is determined to be an oversized component; otherwise, the component is determined to be a regular component.
[0031] In one embodiment, after obtaining the component information, the component package dimensions (w, h) of each component are read from the pick-and-place machine coordinate file, where w is the width and h is the height. If it is determined that a certain component meets the requirements... and / or If so, then the component is determined to be a very large component, where, and Based on the width and height of the FOV, and the conditions, oversized components are accurately identified.
[0032] Optionally, preprocessing includes data verification and cleaning of component dimension information. Specifically, the component center coordinates and component package dimensions can be converted into a predetermined format. The conversion method is as follows: Coordinate normalization: Converts the component center coordinates to relative coordinates (unit: millimeters) with the bottom left corner of the PCB as the origin. Package coding: Classify component package sizes by dimensions (e.g., 0402, 0603, QFN-48) and assign a unique category ID; Data structure: A standardized JSON file is generated based on the component's center coordinates and component package dimensions. Fields may include: { "component_id": "C1", "type": "0603", "x": 12.5, "y": 8.2, "rotation": 90, "region": "high_density" / / Region category } Then, format verification is used to ensure that the component center coordinates and component package dimensions conform to the specifications (a predetermined format), and logical verification is used to ensure the physical rationality of the component information. Specifically, when using the 3σ principle for verification, the mean and standard deviation of the component center coordinates and component package dimensions are calculated, and data exceeding ±3σ is discarded. Hash table technology uses open addressing to resolve collisions, storing unique records of component size information with the component ID as the key.
[0033] Optionally, a grid coordinate system is established based on the component information, and the region is divided based on the grid coordinate system, including: determining the center point of the PCB board based on the component information, establishing a grid coordinate system based on the center point of the PCB board, and obtaining the density value corresponding to each grid cell in the grid coordinate system; performing clustering processing on the grid cells based on the density values, and obtaining region division information based on the clustering results.
[0034] Optionally, the center point of the PCB board can be determined according to the PCB design file, and a grid coordinate system can be established with the center point as the origin. The components corresponding to each grid cell in the grid coordinate system and the positions of the components in the grid cells can be determined according to the PCB design file and the pick-and-place machine coordinate file.
[0035] In one embodiment, the density value can be calculated as follows: a grid coordinate system is established with the center of the PCB board as the origin, and the number of components in each grid cell (e.g., 1cm×1cm) is calculated based on the grid coordinate system, and the number of components is determined as the density value.
[0036] Optionally, the zoning information may include high-density areas, medium-density areas, and low-density areas.
[0037] Optionally, the DBSCAN algorithm can be used to cluster high-density (density values greater than a predetermined density threshold) grid cells, thereby merging adjacent high-density regions to form a core region. The clustering algorithm can also be any algorithm capable of obtaining the core region (i.e., the high-density region), such as k-means, Gaussian mixture model, BIRCH, Mean-Shift clustering, or aggregate / split hierarchical clustering.
[0038] Optionally, for sparsely spaced grid cells, they can be merged into adjacent core regions according to the nearest neighbor principle. Based on different density values, grid cells are merged to form three types of regions: high-density regions, medium-density regions, and low-density regions.
[0039] S102: Construct shooting nodes based on component information and component classification, and construct heuristic functions based on shooting nodes and region division information.
[0040] Optionally, a shooting node is constructed based on component information and component classification, including: obtaining the component classification; determining the shooting position corresponding to the component based on the classification, component size information, and field of view parameters; the component corresponds to one or more shooting positions and the shooting range corresponding to one or more shooting positions covers the component; and determining the shooting position as a shooting node.
[0041] Optionally, when a component is determined to be a conventional component based on its classification, the component's range is determined based on its center coordinates and package dimensions. The shooting position is then determined based on this range and the field of view (FOV). When the camera is positioned at this shooting position, the component is completely within the camera's FOV, and this shooting position is designated as the shooting node.
[0042] Optionally, when a component is determined to be an oversized component based on its classification, and its size exceeds the size of the field of view (e.g., the width and / or height are too large), multiple shooting nodes can be divided according to the component size information and the field of view parameters, and these multiple shooting nodes can be used to shoot the oversized component.
[0043] In one embodiment, for an oversized component whose size exceeds the field of view (FOV), it can be divided into multiple parts, each corresponding to a shooting position, which is designated as a node. The shooting ranges corresponding to all shooting nodes are combined to form a shooting range covering the oversized component. For example, for a long, narrow oversized component, multiple overlapping shooting positions (shooting nodes) can be determined based on its length and the width of the FOV to ensure complete shooting. Simultaneously, each shooting node is labeled with information about the component it belongs to and its position within the component.
[0044] Specifically, when the width of a large element is less than or equal to the height of the field of view, the steps for dividing the shooting nodes for large elements are as follows: 1. Parameter acquisition; Obtain component parameters, FOV parameters, and overlap ratio settings. Component parameters include the component's length (L) and width (W), while FOV parameters include width (FW) and height (FH). The overlap ratio setting can range from 10% to 30%.
[0045] 2. Effective coverage calculation; Wherein, effective coverage width = FW × (1 - overlap rate), and the number of shooting positions required = max(1, ceil (L / effective coverage width)), where ceil(x) is the rounding function, which means rounding up the decimal part of x (e.g., ceil(2.3) = 3).
[0046] 3. Coordinate generation; The center coordinates of the first shooting position are: component origin + FW / 2, where the component origin refers to the reference positioning point of the component in the PCB design file. The center coordinates of subsequent shooting positions are: center coordinates of the previous shooting position + effective coverage width.
[0047] 4. Coverage verification; Total coverage length = (num_positions - 1) × effective coverage width + FW. If the total coverage length is guaranteed to be ≥ L + 2 × FW (reserved edge coverage), then it is determined that all images of the oversized element can be obtained at these shooting positions.
[0048] Optionally, a heuristic function is constructed based on the shooting node and region division information, including: obtaining the Manhattan distance, coordinate value, component distribution density, and additional movement distance corresponding to the shooting node; constructing a heuristic function based on the Manhattan distance, coordinate value, component distribution density, and additional movement distance, wherein when the nth shooting node corresponds to a super-large component, the heuristic function is:
[0049] In the formula, Let be the heuristic function for the nth shooting node. , , These are the weighting coefficients. Let n be the Manhattan distance of the nth shooting node. Let n be the element distribution density of the nth shooting node. The additional movement distance required to photograph the oversized component can be determined based on the distance from the nth shooting node to the edge of the oversized component. Sure.
[0050] Alternatively, when the component is not a very large component, the heuristic function can be: .
[0051] Alternatively, the Manhattan distance can be calculated as follows: Where n represents the current shooting node, This represents the coordinates of the current shooting node n on the x-axis and y-axis (which can be determined based on the coordinate system established based on the component information). This represents the x-axis and y-axis coordinates of the target shooting node (the next shooting node to be reached from the current shooting node) corresponding to the current shooting node.
[0052] Optionally, component distribution density , where A is the area of the region where element n is located, and N is the number of elements in the region.
[0053] In one embodiment, , , The specific values can be adjusted based on experimental results (such as verifying the shooting effect of the shooting path under different values) and actual needs, such as... =0.5, =0.3, =0.2.
[0054] Optionally, after constructing the heuristic function, the weight coefficients can be dynamically adjusted based on the path search results. For example, when entering the region where a large component is located, the weight coefficients can be increased. This allows the algorithm to focus more on the imaging needs of ultra-large components; in sparse regions, it reduces... This reduces the impact of component density factors.
[0055] S013: Calculate the shooting path based on the heuristic function, and capture the component image of the component based on the shooting path.
[0056] Optionally, the shooting path is calculated based on a heuristic function, including: constructing an open list and a closed list based on the shooting nodes; adding the shooting starting point as the starting node to the open list; obtaining the cost function for each shooting node in the open list, the cost function being constructed based on the heuristic function and the cost of the travel distance from the starting node to the shooting node; and generating a shooting path based on the search results using the cost function and the open and closed lists. The open list is the set of shooting nodes to be checked in the path search, containing all discovered but not yet fully evaluated shooting nodes. The closed list stores all fully evaluated shooting nodes, which will not be re-checked to avoid redundant calculations and infinite loops.
[0057] Alternatively, the cost function can be f(n) is a comprehensive evaluation function used to measure the estimated total cost of the camera at the starting node, the current shooting node n, to reach the target node. g(n) is the actual distance traveled from the starting node to the current node n. The target node is the shooting node that the camera last reaches. This is the heuristic function for capturing node n. The cost function is initialized to h(n) (because g(n) = 0 at this point).
[0058] In one embodiment, an open list and a closed list are constructed based on the acquired shooting nodes, and the camera shooting starting point is set as the starting node and added to the open list.
[0059] The node with the smallest f-value (cost function value) from the open list is selected as the current node for expansion. During the selection process, for shooting nodes related to oversized components, if there are multiple shooting nodes with the smallest f-value, the node that can better cover the oversized components (the node with the most oversized components) is prioritized. All adjacent shooting nodes of the current node are checked, and the actual cost of reaching adjacent nodes from the starting node through the current node is calculated. Where g(current) is the actual movement distance cost from the starting node to the current node, and d(current, neighbor) is the distance between the current node and its neighboring nodes. If the current node's neighboring node is not in the open or closed list, add it to the open list, set its parent node to the current node, and calculate its f and h values. If the neighboring node is already in the open list, compare the distances to reach that neighboring node via the current path. The value is the same as the original (current) value. If the value is smaller, update the parent node of the adjacent node to the current node, and update its g and f values accordingly; otherwise, the g and f values remain unchanged. If the adjacent node is already in the closed list, and the current path leads to that adjacent node... If the value is smaller, the node is moved back from the closed list to the open list, and the above update operation is performed; otherwise, the above update operation is not performed.
[0060] Repeat the node selection and expansion steps based on the above selection method until a target node is found (which can be the shooting node corresponding to the bottom right component of the PCB board) or the open list is empty. If a target node is found, the optimal shooting path from the starting node to the target node is obtained by tracing back the parent node of the target node.
[0061] Optionally, after generating the optimal shooting path, a local search is performed on each node in the path. A local search range centered on each node is defined (the size of this range can be adjusted empirically and experimentally). Within this range, neighboring nodes are sorted in ascending order of their f-values according to a heuristic function. If a better neighboring node exists (i.e., with a smaller f-value), the node in the original path is replaced, thus optimizing the path.
[0062] Optionally, a global path adjustment can also be performed. Specifically, considering the integrity of capturing large components and the requirements for stitching, the global path is adjusted. The shooting order and position of large components in the shooting path are checked to ensure that the overlap between adjacent shooting positions is reasonable (e.g., the overlap rate is within 0-30%), which facilitates subsequent image stitching and reduces stitching errors and distortion; otherwise, the path is replanned.
[0063] Optionally, capturing images of components based on the shooting path includes: moving the camera along the shooting path, determining the current shooting node, and obtaining the component category and region corresponding to the shooting node; adjusting the camera's shooting parameters based on the component category and region. The shooting parameters include parameters such as exposure time, aperture size, depth of field, shooting angle, and shooting position.
[0064] In one embodiment, shooting parameters can be adjusted based on the characteristics of the components corresponding to each node on the shooting path and the density of the area (for each area, the proportion of the area occupied by the components is calculated, and the density is determined based on this proportion). Specifically, for densely populated areas (such as high-density areas), the exposure time is reduced to avoid overexposure; for sparsely populated areas (such as low-density areas), the exposure time is appropriately increased to ensure uniform image brightness. For large-sized components (such as components whose edges are close to the boundary of the field of view) and ultra-large components, the aperture size is precisely adjusted to increase the depth of field and ensure that the components are clearly imaged. Simultaneously, for multiple shots of ultra-large components, the shooting angle and position are adjusted to ensure that the edges of the ultra-large components have appropriate overlap with the images of adjacent shooting areas (generally, the overlap rate is controlled between 10% and 30%), while avoiding too much or too little overlap, in order to obtain the best stitching effect.
[0065] Optionally, to obtain the posture of the material grasped by the material grasping module 3 and to facilitate adjustment of the posture of the material grasped by the material grasping execution end 314, the material grasping module 3 also includes a positioning system 34, which is fixed on the base plate 331 and has its image acquisition end facing upward to acquire the image of the material grasping execution end 314.
[0066] Optionally, to reduce the impact of distortion, the method of this application includes: obtaining the pixel coordinates of the component image, updating the pixel coordinates according to the distortion control model and the pixel coordinates, wherein the distortion control model is:
[0067] In the formula, For the updated pixel coordinates, , The radial distortion coefficient is... The tangential distortion coefficient is... The pixel coordinates before the update are used. The radial distortion coefficient and the tangential distortion coefficient are determined based on the camera's shooting parameters and the shooting results of the element image.
[0068] Optionally, camera lens distortion is mainly divided into two categories: radial distortion and tangential distortion. Radial distortion is caused by the shape of the lens element, manifesting as a radial shift of image points, commonly known as "barrel distortion" and "pincushion distortion." Its mathematical model is typically described by a series of radial distortion coefficients (e.g., k1, k2, k3...). Tangential distortion is caused by lens manufacturing and installation errors (the lens is not parallel to the imaging plane), manifesting as a tangential shift of image points. Its mathematical model is typically described by tangential distortion coefficients (e.g., p1, p2). Distortion control models are established based on these distortion types.
[0069] Optionally, the captured image includes the degree of distortion of the component image. The distortion degree can be obtained by measuring the positional changes of key points on the component boundary. The distortion control model can be further adjusted based on the distortion degree, shooting parameters, and distortion coefficients. Specifically, camera intrinsic parameters and distortion coefficients can be obtained using the Zhang Zhengyou calibration method, and the model can be corrected by combining the actual imaging results (including the distortion degree). For large-sized components, the distortion degree D of the component can be determined by calculating the coordinate changes of multiple key points on the component boundary (these key points are pad corner points, which can be identified using corner point algorithms) before and after distortion. Assume there are n key points on the component boundary. The distorted coordinates of this key point are The formula for calculating the distortion degree D is: .
[0070] Optionally, to further optimize the shooting path, the method of this application includes: acquiring captured component images; inputting the component images into a pre-trained image quality assessment model, wherein the image quality assessment model is trained based on PCB image samples containing different lighting conditions, component densities, and distortion types; and adjusting the camera's shooting parameters and / or shooting path according to the image quality information output by the image quality assessment model.
[0071] In one embodiment, the image instruction evaluation model can be an image quality evaluation model based on a convolutional neural network (CNN). It collects 10,000 PCB images, covering different lighting conditions, component densities, and distortion types. These images are used as training samples and divided into training, validation, and test sets in a 7:2:1 ratio to obtain a quality evaluation model for real-time evaluation of captured image quality. This model can accurately provide image quality information, offering strong support for the dynamic adjustment of shooting parameters and shooting paths, thereby comprehensively improving system performance. Specifically, the model may include: Input layer: The input layer receives raw image data (component image) captured by the camera. The size of this image is adjusted according to the actual application scenario and camera resolution. It can be adjusted to a uniform size of 224×224×3 (height×width×number of channels, the number of channels of the model can be 3, representing RGB channels) so that subsequent network layers can process it.
[0072] Convolutional Layers: These layers contain multiple convolutional layers, each extracting features by sliding a convolutional kernel across the image. For example, the first few convolutional layers might use a 3×3 kernel with 64 channels, a stride of 1, and padding of 1 to maintain the size of the feature map. Each convolutional layer is followed by a LeakyReLU activation function to address the vanishing gradient problem; its expression is:
[0073] This activation function is used to introduce non-linearity and enhance the model's expressive power. As the network deepens, the number of convolutional kernels in the convolutional layers is gradually increased, from the initial 32 kernels to 64, 128, 256, etc., to extract richer image features.
[0074] Pooling layers: Interspersed between convolutional layers, used to perform max pooling operations. Layer interleaving rule: Adopting the basic module of "convolution → convolution → pooling". Layers 1-2: 3×3 convolution → LeakyReLU activation function → 3×3 convolution → LeakyReLU activation function; Layer 3: 2×2 max pooling (step size = 2); Repeat the above module 3 times to gradually compress the feature map size to 1 / 8 of the original image.
[0075] The pooling kernel size can be set to 2×2 with a stride of 2. Pooling layers can reduce the resolution of feature maps, decrease computation, and preserve the main features of the image. For example, after a 2×2 max pooling layer, the height and width of the feature map will be halved.
[0076] Fully connected layer: After feature extraction through multiple convolutional and pooling layers, the resulting feature maps are unfolded and connected to the fully connected layer. The fully connected layer contains multiple neurons, and feature mapping is achieved through a weight matrix W and a bias vector b.
[0077] in The Sigmoid activation function is used to output the defect probability value, where x represents the feature. This fully connected layer connects to the features input from the previous layer, enabling further integration and classification of the features. The model uses two fully connected layers: the first layer contains 512 neurons, and the second layer contains 1 neuron, used to output the image quality score Q.
[0078] Optionally, a high-resolution industrial camera can be used to acquire PCB image samples. During the acquisition process, a pre-defined S-shaped path is strictly followed to capture images of the PCB board from multiple angles, ensuring full coverage. The ambient light intensity is kept constant (5000±100 Lux) to avoid glare interference. A large number of PCB image samples are collected, including both high-quality and low-quality images. High-quality images are defined as clear, distortion-free, evenly lit images that accurately reflect component characteristics; low-quality images include blurry, distorted, overexposed or underexposed images, noise interference, and other quality issues. Three senior engineers independently assess the defects in each PCB image, determining the defect level according to the IPC-A-610 standard. 0 points: No defects (Complies with Class 3 standards) 1 point: Minor defect (acceptable, Class 2 standard) 2 points: Serious defects (rejection) The final score is the average of the three scores, which serves as the label for supervised learning. The dataset is divided into training, validation, and test sets according to a certain ratio, for example, 70%, 15%, and 15%. The training set is used for training the model, the validation set is used to tune the model's hyperparameters, and the test set is used to evaluate the model's performance.
[0079] Optionally, during model training, stochastic gradient descent (SGD) can be used as the optimizer, with a learning rate of 0.001 and a momentum of 0.9. During training, image samples from the training set are sequentially input into the model, and the loss between the model's output quality score and the true label is calculated. Here, the mean squared error (MSE) loss function is used to calculate the loss, i.e. Where L is the loss, It's a real label. is the quality score predicted by the model, and n is the number of samples. The gradient of the loss with respect to the model parameters is calculated using the backpropagation algorithm, and the model weights are updated according to the gradient. The training is iterated continuously until the loss of the model on the validation set no longer decreases or reaches the preset number of training rounds.
[0080] Alternatively, to prevent overfitting, L2 regularization can be used to add a regularization term to the loss function. ,in, The loss function after adding the regularization term, It is the regularization coefficient. This is the set of model weights. Meanwhile, early stopping is employed during training; training stops when the model's loss on the validation set no longer decreases for several consecutive epochs, preventing overfitting on the training set and improving the model's generalization ability. Furthermore, data augmentation techniques, such as random flipping, rotation, and scaling, can be used to expand the training dataset, further enhancing the model's robustness and generalization ability.
[0081] Optionally, adjusting the camera's shooting parameters and / or shooting path based on the image quality information output by the image quality assessment model includes: determining image problems based on the quality score in the image quality information and the image information of the components, whereby image problems include at least one of image blur, exposure anomaly, distortion, and perspective; and adjusting the camera's shooting parameters and / or shooting path based on the image problems and the component classification corresponding to the component images.
[0082] In one embodiment, after the camera captures an image, it inputs the image quality assessment model in real time to obtain a quality score Q (typically ranging from 0 to 1, with higher values indicating better quality). The image problem is then categorized based on a comparison of this score with a preset threshold (e.g., severe quality problem, minor quality problem, or high quality). The preset threshold includes a minimum score threshold. Moderate score threshold Specifically, the threshold determination and problem classification methods can be as follows: Serious quality issues: If This indicates a serious quality issue triggering emergency adjustments (such as refocusing or adding illumination). .
[0083] Minor quality issues: If If so, it is determined to be a minor quality issue, and parameters are fine-tuned (such as adjusting the exposure). .
[0084] High quality: If If the image is determined to be of high quality, the current shooting parameters are maintained, and shooting continues.
[0085] In one embodiment, the shooting parameter adjustment based on the Q value can be: (1) Image blur (common causes: focal length / motion blur) Adjust strategy: If Q is below the threshold (e.g.) If there are few high-frequency components in the image (which can be determined by the results of image spectrum analysis), autofocus will be triggered, the shooting speed will be reduced (exposure time will be increased), or image stabilization will be enabled.
[0086] (2) Abnormal exposure (overexposure / underexposure) Adjust strategy: If Q is low (e.g.) Furthermore, if the image is generally too bright or too dark, the exposure compensation value can be determined by analyzing the image's histogram (such as the brightness analysis results).
[0087] (3) Distortion and perspective problems Adjust strategy: If Q is low (e.g.) or Furthermore, the edges of the components in the image appear distorted, so the shooting angle or position is adjusted in conjunction with the distortion coefficient.
[0088] For very large components, if distortion makes splicing difficult, increase the number of local shooting points or use multi-angle shooting.
[0089] Optionally, path dynamic optimization can also be performed based on the Q value. Specifically, if the Q value of a certain node is lower than the set threshold after it is captured, within the local search range, an alternative capturing node is searched in a radius area of 5mm (or other radius) centered on that node. If no alternative capturing node is found, the search radius area is expanded in increments of 0.5mm until an alternative capturing node is found.
[0090] If three consecutive (or four or other preset values) If the Q values of nodes with high component coverage and low distortion in the neighborhood are all below a threshold, and local adjustments are ineffective, then global replanning is initiated. The optimization method can be: starting from the current position, rerun the shooting path planning method, and when selecting shooting nodes for the shooting path, prioritize shooting nodes in the path region with high historical Q values.
[0091] The PCB path planning method based on component information provided in this application has the following advantages: Shooting efficiency is greatly improved: The shooting path planning algorithm based on component information precision control effectively avoids invalid shooting, significantly reduces the number of shots, and greatly improves detection efficiency.
[0092] Excellent distortion control: The optimization strategy for large-sized components effectively reduces distortion during the imaging process, significantly improving image clarity and accuracy, and providing a high-quality data foundation for subsequent defect detection.
[0093] Image quality is comprehensively improved: the shooting parameters are evaluated and dynamically adjusted in real time through a deep learning network model, ensuring stable and reliable image quality and effectively guaranteeing detection accuracy.
[0094] Strong adaptability: The improved path planning algorithm and intelligent parameter adjustment mechanism can automatically optimize the shooting scheme according to the layout and component distribution of different PCBs, making it highly adaptable.
[0095] The terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the illustrations or text descriptions.
[0096] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.
[0097] The above description is only an optional implementation method for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application without departing from the technical concept of this application also fall within the protection scope of the embodiments of this application.
Claims
1. A PCB path planning method based on component information, characterized in that, The method includes: Based on the component information, obtain component classification and area division information. The component information includes at least one of PCB design files and pick-and-place machine coordinate files. The component classification includes regular components and oversized components. Based on the component information and the component classification, a shooting node is constructed, and a heuristic function is constructed based on the shooting node and the region division information; The shooting path is calculated based on the heuristic function, and the component image of the component is captured based on the shooting path; The construction of the heuristic function based on the shooting node and the region division information includes: Obtain the Manhattan distance, coordinates, element distribution density, and additional movement distance corresponding to the shooting node; A heuristic function is constructed based on the Manhattan distance, coordinate values, component distribution density, and additional movement distance. When the nth shooting node corresponds to a super-large component, the heuristic function is: In the formula, Let be the heuristic function for the nth shooting node. , , These are the weighting coefficients. Let n be the Manhattan distance of the nth shooting node. Let n be the element distribution density of the nth shooting node. The additional movement distance required to photograph the oversized component is based on the distance from the nth photographing node to the edge of the oversized component. Determined component distribution density A is the area of the region where the shooting node n is located, and N is the number of elements in the region.
2. The PCB path planning method based on component information according to claim 1, characterized in that, The step of obtaining component classification and region division information based on component information includes: The component information is preprocessed, and component size information is obtained based on the preprocessed component information. The component classification is determined based on the component size information and the field of view of the camera. The component size information includes the component center coordinates and the component package size. A grid coordinate system is established based on the component information, and the region is divided based on the grid coordinate system to generate region division information.
3. The PCB path planning method based on component information according to claim 2, characterized in that, The step of establishing a grid coordinate system based on the component information and dividing the region based on the grid coordinate system includes: The PCB board center point is determined based on the component information. A grid coordinate system is established based on the PCB board center point, and the density value corresponding to each grid cell of the grid coordinate system is obtained. The grid cells are clustered based on the density values, and region division information is obtained based on the clustering results.
4. The PCB path planning method based on component information according to claim 2, characterized in that, The process of constructing shooting nodes based on the component information and component classification includes: The classification of the component is obtained, and the shooting position corresponding to the component is determined based on the classification, the component size information, and the field of view parameter. The component corresponds to one or more shooting positions, and the shooting range corresponding to the one or more shooting positions covers the component. The shooting location is determined as the shooting node.
5. The PCB path planning method based on component information according to claim 1, characterized in that, The step of calculating the shooting path based on the heuristic function includes: An open list and a closed list are constructed based on the shooting nodes. The shooting starting point is added to the open list as the starting node. The cost function of each shooting node in the open list is obtained. The cost function is constructed based on the heuristic function and the cost of the movement distance from the starting node to the shooting node. Based on the cost function and the open and closed list paths, a shooting path is generated.
6. The PCB path planning method based on component information according to claim 1, characterized in that, The image captured based on the shooting path includes: Move the camera based on the shooting path, determine the current shooting node, and obtain the component category and region corresponding to the shooting node; The camera's shooting parameters are adjusted according to the component classification and the region.
7. The PCB path planning method based on component information according to claim 6, characterized in that, The method includes: Acquire captured component images and input the component images into a pre-trained image quality assessment model. The image quality assessment model is trained based on PCB image samples containing different lighting conditions, component densities, and distortion types. Adjust the camera's shooting parameters and / or the shooting path based on the image quality information output by the image quality assessment model.
8. The PCB path planning method based on component information according to claim 7, characterized in that, Adjusting the camera's shooting parameters and / or the shooting path based on the image quality information output by the image quality assessment model includes: Image problems are determined based on the quality score in the image quality information and the image information of the element. The image problems include at least one of image blurring, exposure abnormality, distortion, and perspective distortion. Adjust the camera's shooting parameters and / or the shooting path based on the image problem and the component classification corresponding to the component image.
9. The PCB path planning method based on component information according to claim 6, characterized in that, The method includes: Obtain the pixel coordinates of the component image, and update the pixel coordinates according to the distortion control model and the pixel coordinates. The distortion control model is as follows: In the formula, For the updated pixel coordinates, , The radial distortion coefficient is... The tangential distortion coefficient is... These are the pixel coordinates before the update.
Citation Information
Patent Citations
Optimal point calculation method for automatic detection of electronic components of PCB (Printed Circuit Board)
CN118470281A