A method and system for detecting solder pad of adapter
By equivalently equating the pads to a circle and building an improved key point detection model, the problem of welding through area and position detection in pad detection of lithium-ion battery adapter sheet is solved, and high-precision pad detection is achieved.
Patent Information
- Application Number
- CN202411061320.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-08-05
AI Technical Summary
During the pad detection process of lithium-ion battery adapter pads, traditional methods are difficult to accurately detect the true area of the soldered-through part and accurately position the pad position, and have poor flexibility and applicability.
Using disc marking method, the pad is equivalent to a circle, the real center coordinate and radius value are calculated through the annotation tool, and an improved key point detection model is built, the regression term of the regression circle radius is added, and the model is trained to output the solder pad Thermogram, offset value and radius value of the center of the circle, used for positioning and area calculations.
It realizes accurate positioning of pad position and accurate detection of area, avoids the difficulty of segmenting irregular pads, and can naturally include defects such as soldering, greatly reducing the detection complexity.
Smart Images

Figure CN118570284B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pad detection, and in particular to a method and system for detecting a pad of a transfer plate. Background Art
[0002] Lithium-ion batteries are usually composed of a cell, a cover, and a shell. The cell is used to store electrical energy, and the cover is provided with positive and negative poles that can be connected to external devices. Usually, the cell is provided with positive and negative pole ears. An adapter is required as an intermediate connector to connect the positive and negative pole ears on the cell with the positive and negative poles on the cover to achieve electrical energy transmission.
[0003] During the inspection of the adapter pad, the pad may be soldered through, and the traditional image segmentation algorithm cannot consider the soldered through part as part of the pad, resulting in the inability to accurately detect the actual area of the pad. At the same time, these algorithms also have difficulty in accurately locating the position of the pad in the image.
[0004] Commonly used pad detection methods in the prior art include traditional machine vision methods based on template matching, edge detection, shape matching, and semantic segmentation based on deep learning. However, these methods are either constrained by manually designed features, with poor flexibility and applicability; or because the focine semantic segmentation algorithm ignores the solder penetration part, it is impossible to fully detect the pad area. Therefore, there is an urgent need for a transfer pad detection method that can simultaneously accurately locate the pad position and fully calculate the pad area (including the solder penetration part) to solve the defects of the prior art. Summary of the invention
[0005] In view of the above-mentioned problems, the present invention is proposed.
[0006] Therefore, the technical problem solved by the present invention is: how to accurately detect the actual area of the solder-through pad and precisely locate the pad position during the detection process of the lithium-ion battery adapter pad.
[0007] To solve the above technical problems, the present invention provides the following technical solutions: a method for detecting adapter pads, comprising: defining a circular disk marking method; the circular disk marking method refers to treating the entire adapter pad as a circular whole, with the positioning of the center of the circular pad and the radius of the regressed circular pad as the detection direction; annotating the center point and the circle boundary point of the circular pad by a marking tool, and calculating the true center coordinates and the true radius value based on the marked data; constructing a key point detection model, rewriting the detection head in the key point detection algorithm, and adding a regression term based on the regression circle radius; training the key point detection model until the heat map of the pad center, the offset value of the center relative to the heat map position, and the radius value of the circular pad are output simultaneously; applying the trained key point detection model to the adapter image to be detected, locating the pad position according to the center heat map, correcting the center coordinates using the offset value, and using the regressed radius value to calculate the true area of the pad.
[0008] As a preferred embodiment of the adapter pad detection method of the present invention, the specific process of the disk marking method is as follows: assuming that the pad area of any shape is A , using an ideal circle C and the ideal circle C The center coordinates of and radius r To represent the pad area equivalently A ; If any in the pad area A Points in To the center coordinates The Euclidean distance does not exceed the radius r , then it is considered that point In the ideal circle C Within the range; if the pad area A All boundary points to the ideal circle C The sum of the distances is minimized, indicating that the optimal center coordinates and radius have been found, making the ideal circle C To pad area A There is optimal coverage and equivalency.
[0009] As a preferred scheme of the adapter pad detection method described in the present invention, the calculation process of the true circle center coordinates and the true radius value is as follows: arbitrarily select three non-collinear circle boundary point coordinates from the marked circle boundary point coordinate set to determine a unique circle equation; establish three standard circle equations based on the selected three circle boundary point coordinates, and use the circle center coordinates and radius in the three standard circle equations as unknowns; subtract the three standard circle equations from each other, eliminate the quadratic term of the radius, and only retain the linear equation group about the circle center coordinates, and express the constraint relationship of the circle center coordinates by the linear equation group; analyze the linear equation group to obtain the circle center coordinate value, that is, the true circle center coordinate; substitute the true circle center coordinate into the coordinates of any known boundary point, and solve the true radius value according to the distance calculation formula from the point to the center of the circle.
[0010] As a preferred solution of the adapter pad detection method described in the present invention, the detection head in the key point detection algorithm is rewritten to include the following steps: adding a new 3x3 convolution layer to generate a regression prediction value of the circle radius:
[0011] ;
[0012] in, is the feature map tensor; is the convolution kernel weight; is the bias term; Tensor for radius regression predictions; B is the number of channels of the feature map; H is the height of the feature map; W is the width of the feature map; R The radius of the circle.
[0013] During the forward propagation process of the key point detection model, the radius prediction value is calculated and obtained based on the new 3x3 convolutional layer.
[0014] Calculate the loss function, assuming that in the key point detection model, the true radius is marked as ;in, , represents the true radius annotation value tensor, with a dimension of 1× H × W , in each ( h , w ) position, the corresponding true radius annotation value is stored; here, .
[0015] Use smooth L1 loss function:
[0016] ;
[0017] in, For the key point detection model in ( h , w ) The radius value of the position prediction; For the key point detection model in ( h , w ) The actual radius annotation value of the position; is the radius regression loss term, that is, the regression term based on the radius of the regression circle; is the regression loss function, the specific formula is:
[0018] ;
[0019] When | x When |<1, square loss is used. When | x When |>=1, the absolute value loss is used.
[0020] As a preferred solution of the adapter pad detection method described in the present invention, the radius regression loss term Add to the total loss function:
[0021] ;
[0022] in, is the classification loss; is the offset regression loss; is the weight coefficient of radius regression loss.
[0023] As a preferred solution of the adapter pad detection method described in the present invention, the process of training the key point detection model includes the following steps: calculating the total loss After that, back propagation is performed to update the weights, which specifically includes the following steps: about and Take the derivative; according to the chain rule, the loss is about The gradient of is calculated by back propagation of the convolution kernel. The calculated gradient is substituted into the optimizer to update and The value of is optimized in the direction of reducing the loss.
[0024] As a preferred solution of the adapter pad detection method described in the present invention, wherein: the adapter image to be detected is input into the trained key point detection model to obtain three outputs: a center heat map, an offset value of the center relative to the heat map position, and a regressed circle radius value; the coordinates of the maximum value point on the center heat map are found and used as the preliminary coordinates of the pad center; the preliminary coordinates are corrected using the offset value to obtain the final center coordinates; the radius value corresponding to the center coordinates is taken out from the regressed radius value, thereby calculating the actual area of the pad.
[0025] To solve the above technical problems, the present invention further provides the following technical solutions: a system for detecting adapter pads, comprising: a data annotation module, used to annotate circular pads in adapter images, calculate the true circle center coordinates and radius values based on the annotations, and use them as training data; a model construction module, used to construct a key point detection model, rewrite the detection head of the key point detection algorithm to add a regression branch based on the regression circle radius; a model training module, used to train the key point detection model; an image prediction module, used to apply the trained key point detection model to the input adapter image to be detected, and obtain the pad center heat map, offset value and radius value; a result analysis module, used to analyze according to the output result of the image prediction module.
[0026] A computer device includes a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of the adapter pad detection method as described above when executing the computer program.
[0027] A computer-readable storage medium stores a computer program thereon, wherein the computer program, when executed by a processor, implements the steps of the adapter pad detection method as described above.
[0028] Beneficial effects of the present invention: The present invention converts the traditional complex pad detection problem into a simple circle center positioning and radius regression problem, greatly reducing the complexity of the problem. The present invention constructs an improved key point detection model and adds a branch of the regression circle radius, which can simultaneously output the pad center heat map, offset value and radius value, avoiding the difficulty of segmenting irregular pads, and can naturally include defects such as solder penetration, and accurately calculate the true area of the pad. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0030] Figure 1 An overall flow chart of a method for detecting a solder pad of an adapter provided by the first embodiment of the present invention;
[0031] Figure 2 FIG. 4 is a schematic diagram of the structure of a computer device in a third embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0033] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0034] Example 1, reference Figure 1 , is an embodiment of the present invention, and provides a method for detecting a transfer pad, which specifically includes the following steps:
[0035] S1: Define the disc marking method, specifically, the entire adapter pad is regarded as a circular whole, and the center of the circular pad is located and the radius of the circular pad is returned as the detection direction.
[0036] First, in the detection of the adapter pad, because of the possible phenomenon of solder penetration, the segmentation algorithm (such as semantic segmentation) cannot accurately detect the area of the pad in the adapter, that is, the detection of solder black will be ignored during the segmentation process, and the real pad area cannot be fully obtained. Therefore, the present invention regards the pad as a whole circle to calculate the area of the pad including the area of the solder penetration part, and locates the position of the adapter in the image. After being equivalent to a circle, it is only necessary to calculate the area of the circle according to the regressed radius, which naturally includes the solder penetration part. Secondly, the ideal shape of the pad itself is circular or close to a circle. During the manufacturing process, although some deformation will occur, the circular feature should still be maintained as a whole. Then, the pad is equivalent to a circle, which can greatly simplify the problem. The two parameters of the center coordinates and the radius can accurately describe and locate the pad. Finally, the circle has higher geometric symmetry and is more stable and robust during model training and prediction.
[0037] Furthermore, the specific process of S1 is: let the pad area of any shape be A , using an ideal circle C and ideal circle C The center coordinates of and radius r To equivalently represent the pad area A , then for any point ,have: , which means point P To the center The Euclidean distance does not exceed the radius r , thus falling on the circle C In which, .
[0038] If the pad area A All boundary points to the ideal circle C The sum of the distances is minimized, indicating that the optimal center coordinates and radius have been found, making the ideal circle C To pad area A There is optimal coverage and equivalence, the specific formula is:
[0039] ;
[0040] in, is the objective function to be minimized; For the pad area A All boundary points Perform summation; Represents the loss function, which is used in this embodiment , which is the absolute value function, and the minimum absolute deviation fit is obtained. What is calculated is: For the boundary point To the center The Euclidean distance of .
[0041] S2: Use the annotation tool to mark the center point and boundary point of the circular pad, and calculate the true center coordinates and radius value based on the annotation data.
[0042] Specifically, in this step, for the pad area that has been equivalent to an ideal circle, the real center point and several points on the circle boundary are manually or semi-automatically marked using a marking tool. Based on these marked points, the real center coordinates and radius value of the pad are obtained through mathematical calculations as the "standard answer" for comparison and evaluation.
[0043] Furthermore, the calculation process of the true center coordinates and the true radius value is:
[0044] 1. Randomly select three non-collinear circle boundary point coordinates from the marked circle boundary point coordinate set to determine a unique circle equation. Specifically, use the marked circle center point and at least three circle boundary points To calculate the true center coordinates of the pad and the true radius value .
[0045] 2. Establish three standard circle equations based on the coordinates of the three selected circle boundary points, and use the coordinates of the center and radius in these three standard circle equations as unknowns. Specifically, to determine the circle equation: Let the circle equation be , Substitute the three points into the equation system:
[0046] ;
[0047] in, are the coordinates of the center of the circle, is the radius, both are unknown.
[0048] 3. Subtract the three standard circle equations from each other, eliminate the quadratic term of the radius, and only keep the linear equations about the coordinates of the center of the circle. The linear equations are used to represent the constraints of the coordinates of the center of the circle. The formula of the linear equations is:
[0049] .
[0050] 4. Use Gaussian elimination method to solve this linear equation system and get the coordinate value of the center of the circle, that is, the true coordinate value of the center of the circle. The specific formula is:
[0051] ;
[0052] .
[0053] 5. Substitute the coordinates of the true center of the circle into the coordinates of any known boundary point, and solve the true radius value according to the distance calculation formula from the point to the center of the circle. Specifically, according to the marked center point , get the true center coordinates 、The true radius value is:
[0054] .
[0055] It should be noted that annotation tools usually consist of a graphical interface in which the operator can load image / video data and then use interactive tools such as mouse and keyboard to accurately mark points, lines, boxes and other features of interest on the data. Some common annotation tools include MicrosoftVoTT (Visual Object Tagging Tool), LabelImg, RectLabel, Labelbox, Dataturks, Amazon SageMaker Ground Truth, etc. These tools support a variety of different annotation tasks, such as object detection, instance segmentation, key point annotation, etc. For circular pads, it is mainly necessary to use the key point annotation function to mark the precise pixel coordinates of the center and boundary points.
[0056] S3: Build a key point detection model, rewrite the detection head in the key point detection algorithm, and add a regression term based on the radius of the regression circle in addition to the original classification regression and offset regression branches. The specific process is as follows:
[0057] 1. Add a new 3x3 convolutional layer to generate regression predictions for the circle radius:
[0058] ;
[0059] in, is the feature map tensor; is the convolution kernel weight; is the bias term; Tensor for radius regression predictions; B is the number of channels of the feature map; H is the height of the feature map; W is the width of the feature map; R The radius of the circle.
[0060] 2. During the forward propagation of the key point detection model, the radius prediction value is calculated and obtained based on the new 3x3 convolutional layer.
[0061] 3. Calculate the loss function, assuming that in the key point detection model, the true radius is marked as .in, , represents the true radius annotation value tensor, with a dimension of 1× H × W , in each ( h , w ) position, the corresponding true radius annotation value is stored; here, ,Right now Corresponding to S2 . Using the smooth L1 loss function:
[0062] ;
[0063] in, For the key point detection model in ( h , w ) The radius value of the position prediction; For the key point detection model in ( h , w )’s true radius dimension value; is the regression loss function, the specific formula is:
[0064] ;
[0065] When | x When |<1, square loss is used. When | xWhen |>=1, the absolute value loss is used. This makes the loss function less penalizing for outliers and enhances the robustness of the model. h , w ) The SmoothL1 loss of the position is summed to get the total radius regression loss .
[0066] The radius regression loss term Add to the total loss function:
[0067] ;
[0068] in, is the classification loss; is the offset regression loss. is the weight coefficient of radius regression loss.
[0069] S4: Train the key point detection model so that it can simultaneously output the heat map of the center of the pad, the offset value of the center relative to the heat map, and the radius value of the circular pad.
[0070] Specifically, the total loss about and Take the derivative:
[0071] According to the chain rule, the loss is about The gradient of is calculated by back propagation of the convolution kernel.
[0072] Substitute the calculated gradient into an optimizer (such as SGD) to update and The value of is optimized in the direction of reducing the loss.
[0073] S5: Apply the trained model to the adapter image to be detected, and analyze the three outputs of the model, namely, locate the pad position according to the circle center heat map, correct the circle center coordinates using the offset value, and calculate the actual area of the pad using the regressed radius value.
[0074] 1. Get the model output. Input the adapter image to be tested into the trained model and obtain the three outputs of the model:
[0075] 1) Circle center heat map.
[0076] 2) The offset value of the circle center relative to the heat map position.
[0077] 3) The radius of the circle obtained by regression.
[0078] 2. Extract the preliminary coordinates of the circle center from the heat map. Find the coordinates of the maximum value point on the circle center heat map and use them as the preliminary coordinates of the pad circle center.
[0079] 3. Correct the coordinates of the center of the circle. Use the offset value to correct the preliminary coordinates to obtain the final accurate coordinates of the center of the circle.
[0080] 4. Calculate the pad area. From the regression radius value, take the radius value at the corresponding circle center coordinate to get the actual pad area.
[0081] In summary, the present invention converts the traditional complex pad detection problem into a simple circle center positioning and radius regression problem, which greatly reduces the complexity of the problem. By constructing an improved key point detection model and adding a branch of the regression circle radius, the present invention can simultaneously output the pad center heat map, offset value and radius value, avoiding the difficulty of segmenting irregular pads, and can naturally include defects such as solder penetration, and accurately calculate the true area of the pad.
[0082] Example 2, reference Figure 1 , as an embodiment of the present invention, provides a transfer pad detection system, including a data annotation module, a model construction module, a model training module, an image prediction module, and a result analysis module.
[0083] Specifically, the data annotation module is used to annotate the circular pads in the adapter image, calculate the true center coordinates and radius value based on the annotations, and use them as training data.
[0084] The model building module is used to build a key point detection model and rewrite the detection head of the key point detection algorithm to add a regression branch based on the regression circle radius.
[0085] The model training module uses the training data obtained by the data annotation module to train the key point detection model.
[0086] The image prediction module is used to apply the trained key point detection model to the input adapter image to be detected to obtain the pad center heat map, offset value and radius value.
[0087] The result analysis module is used to analyze the output result of the image prediction module.
[0088] In summary, the data annotation module provides high-quality supervision information for subsequent model training. Its annotation method avoids the difficulty of semantic segmentation and annotation of complex irregular pads, greatly simplifying the data preparation process. The model construction module constructs an improved key point detection algorithm, adds a regression branch based on the radius of the regression circle to the detection head, so that the model can simultaneously output the pad center heat map, offset value and radius value, and achieve high-precision detection of circular pads, effectively solving the bottleneck of the existing algorithm when dealing with defective pads. The model training module uses the training data provided by the data annotation module to comprehensively train the improved key point detection model, so that the model output can approach the ground truth, thereby obtaining high-precision detection capabilities and ensuring the high performance of the algorithm model. The image prediction module applies the trained model to the actual adapter image, and can efficiently obtain key parameters such as the pad center heat map, offset value and radius value, laying the foundation for subsequent result analysis. This module realizes the practical application of the algorithm model in industrial scenarios. The result analysis module can accurately analyze the parameters such as the actual position and area of the pad based on the output results of the image prediction module. This not only meets the needs of adapter pad detection, but can also serve as an important means to improve PCB product quality and manufacturing efficiency, and has broad application prospects in industrial production practice.
[0089] Example 3, reference Figure 2 , is an embodiment of the present invention, which is different from the previous embodiment in that:
[0090] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0091] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0092] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0093] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0094] Example 4 is an embodiment of the present invention, which provides a method for detecting the pad of an adapter. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0095] A dataset of 1,000 pad images of adapters with the center coordinates and radius of the pads manually annotated is used as the ground truth. The evaluation indicators are: Center Position Error (EPE): The Euclidean distance between the predicted center and the true center. The smaller the better. Area Relative Error (ARE): (Predicted Area - True Area) / True Area. The smaller the absolute value, the better. Mean Average Precision (mAP): The average precision of detection under different area thresholds. The higher the better.
[0096] The comparison methods are: baseline method: instance segmentation based on Mask R-CNN, traditional method: traditional algorithm based on Hough circle detection, and the present invention.
[0097] Table 1 Comparison with existing technology
[0098]
[0099] As can be seen from Table 1, the proposed method has the best accuracy in detecting the center of the circle, with an EPE of only 3.78 pixels, which is significantly better than the other two methods. The area relative error ARE is only 0.094, which is much lower than the benchmark 0.186 and the traditional 0.224, indicating that it is more accurate. On mAP@0.5, the proposed method achieves a high accuracy of 0.892, while the other two methods are relatively low.
[0100] The present invention avoids the problem of missing the soldering area by the segmentation algorithm by directly regressing the center and radius of the pad as a whole circle. In addition, the thermal map mechanism and correction mechanism of key point detection make the prediction of the center and radius more accurate. Therefore, it can better solve the challenges faced by pad detection and show excellent performance in multiple evaluation indicators, verifying the effectiveness and superiority of this method.
[0101] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for detecting a solder pad of an adapter, characterized in that: include: A disc marking method is defined; the disc marking method refers to treating the entire adapter pad as a circular whole, and locating the center of the circular pad and returning to the radius of the circular pad as the detection direction; Annotate the center point and the boundary point of the circular pad by using an annotation tool, and calculate the true center coordinates and the true radius value based on the annotation data; Build a key point detection model, rewrite the detection head in the key point detection algorithm, and add a regression term based on the radius of the regression circle; The key point detection model is trained until a heat map of the center of the pad, an offset value of the center relative to the heat map, and a radius value of the circular pad are output simultaneously; Apply the trained key point detection model to the adapter image to be detected, locate the pad position according to the circle center heat map, use the offset value to correct the circle center coordinates, and use the regressed radius value to calculate the actual area of the pad; Rewriting the detection head in the key point detection algorithm includes the following steps: Add a new 3x3 convolutional layer to generate regression predictions for the circle radius: r=Conv2d(F,W r )+b r ; F∈R B×H×W ; IN r ∈R B×1×3×3 ; b r ∈R 1×H×W ; r∈R 1×H×W ; Among them, F is the feature map tensor; W r is the convolution kernel weight; b r is the bias term; r is the radius regression prediction tensor; B is the number of channels of the feature map; H is the height of the feature map; W is the width of the feature map; R is the radius of the circle; In the forward propagation process of the key point detection model, a radius prediction value is calculated and obtained based on the new 3x3 convolutional layer; Calculate the loss function, assuming that in the key point detection model, the true radius is marked as r gt ; Among them, r gt ∈R 1×H×W , represents the true radius annotation value tensor, with a dimension of 1×H×W. At each (h,w) position, the corresponding true radius annotation value is stored; here, r gt =r t ; Use smooth L1 loss function: Among them, r h,w is the radius value predicted by the key point detection model at the position (h, w); The true radius annotation value of the key point detection model at the position (h, w); is the radius regression loss term, that is, the regression term based on the radius of the regression circle; SmoothL1 is the regression loss function, and the specific formula is: When |x|<1, square loss is used, and when |x|>=1, absolute value loss is used; The radius regression loss term Add to the total loss function: in, is the classification loss; is the offset regression loss; r is the weight coefficient of radius regression loss.
2. The method for detecting the solder pad of the adapter according to claim 1, wherein: The specific process of the disc marking method is as follows: Assume a pad area A of arbitrary shape, and use an ideal circle C and the coordinates of the center of the ideal circle C (x0, y0) and the radius r to equivalently represent the pad area A; If the Euclidean distance from any point P(x,y) in the pad area A to the center coordinate (x0,y0) does not exceed the radius r, then the point P(x,y) is considered to be within the range of the ideal circle C; If the sum of the distances from all boundary points of the pad area A to the ideal circle C is minimized, it means that the optimal center coordinates and radius have been found, so that the ideal circle C has the best coverage and equivalence to the pad area A.
3. The method for detecting the adapter pad according to claim 2, wherein: The calculation process of the true center coordinates and true radius value is as follows: Randomly select three non-collinear circle boundary point coordinates from the marked circle boundary point coordinate set to determine a unique circle equation; Establish three standard circle equations according to the coordinates of the three selected circle boundary points, and use the coordinates of the center and the radius in the three standard circle equations as unknown variables; Subtract the three standard circle equations from each other, eliminate the quadratic term of the radius, and only retain the linear equation group about the coordinates of the circle center, and use the linear equation group to express the constraint relationship of the coordinates of the circle center; Analyze the linear equations to obtain the center coordinates, i.e., the true center coordinates; Substitute the coordinates of the true center of the circle into the coordinates of any known boundary point, and solve the true radius value according to the distance calculation formula from the point to the center of the circle.
4. The method for detecting the solder pad of the adapter according to claim 3, wherein: Calculate total loss After that, back propagation is performed to update the weights, which specifically includes the following steps: For total loss About W r and b r To perform derivation; According to the chain rule, the gradient of the loss with respect to r is calculated by back propagation of the convolution kernel; Substitute the calculated gradient into the optimizer to update W r and b r The value of is optimized in the direction of reducing the loss.
5. The method for detecting the solder pad of the adapter according to claim 4, wherein: Input the adapter image to be detected into the trained key point detection model to obtain three outputs: the center heat map, the offset value of the center relative to the heat map position, and the regressed circle radius value; Find the coordinates of the maximum value point on the circle center heat map and use them as the preliminary coordinates of the pad center; Use the offset value to correct the preliminary coordinates to obtain the final coordinates of the circle center; The radius value at the corresponding circle center coordinate is taken out from the regression radius value to calculate the actual area of the pad.
6. A system using the adapter pad detection method according to any one of claims 1 to 5, characterized in that: include: A data annotation module is used to annotate the circular pads in the adapter image, calculate the true center coordinates and radius value based on the annotations, and use them as training data; The model building module is used to build a key point detection model and rewrite the detection head of the key point detection algorithm to add a regression branch based on the radius of the regression circle; A model training module, using the training data obtained by the data annotation module to train the key point detection model; The image prediction module is used to apply the trained key point detection model to the input adapter image to be detected to obtain the pad center heat map, offset value and radius value; The result analysis module is used to analyze the output result of the image prediction module.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the adapter pad detection method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the adapter pad detection method according to any one of claims 1 to 5 are implemented.
