A method and apparatus for detecting an electrical connector pin

By analyzing the regularity of the pin arrangement structure and the reflective effect of electrical connectors under multiple light source brightness and multiple angles, and combining the reliability and performance of offset, the problem of low pin offset detection accuracy in the prior art is solved, and more efficient pin offset detection is achieved to ensure the stability of electrical connectors.

CN121409959BActive Publication Date: 2026-07-10GUANGDONG WENYICHUANG ELECTRONIC TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG WENYICHUANG ELECTRONIC TECHNOLOGY CO LTD
Filing Date
2025-10-11
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In the existing technology, the accuracy of determining the pin offset based on the positional distribution pattern of a single electrical connector pin image is low, resulting in poor detection effect of electrical connector pins.

Method used

By acquiring the center point of the pin area under multiple light source brightness and multiple shooting angles, and combining the regularity of the pin arrangement structure, the reliability of the offset, and the offset performance, the pin offset is comprehensively determined. Template matching algorithm and line fitting technology are used to analyze the regularity of the horizontal and vertical arrangement of the pins, and the reliability of the offset is determined by using the reflective effect feature value and the relative overall regularity. Finally, the pin offset is detected.

Benefits of technology

It improves the accuracy and efficiency of pin offset detection, enabling better identification of abnormal pin offsets and ensuring the stability and reliability of electrical connectors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121409959B_ABST
    Figure CN121409959B_ABST
Patent Text Reader

Abstract

This invention relates to the field of electronic component defect detection technology, specifically to a method and apparatus for detecting electrical connector pins. Based on the arrangement pattern of the electrical connector pins, at each shooting angle and under each light source brightness, the linear fitting deviation of the center point of each pin in the pin image and the characteristic of equal interval distribution are used to initially determine the regularity of the corresponding arrangement structure. Then, based on the reflection effect at each shooting angle, and according to the significance of the regularity of the arrangement structure under each light source brightness, the corresponding offset reliability is determined. Finally, based on the offset reliability and combined with the deviation of the regularity of each pin compared to other pins, a more accurate pin offset is determined for each pin, resulting in better detection of electrical connector pins based on pin offset.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic component defect detection technology, specifically to a method and apparatus for detecting electrical connector pins. Background Technology

[0002] Electrical connectors play a crucial role in the electrical connection of electronic devices, and the quality of their pins directly affects the stability and reliability of signal transmission. As electronic products become increasingly miniaturized and denser, the number of connector pins is constantly increasing, while the spacing is gradually decreasing. This places higher demands on pin positional accuracy, straightness, and assembly consistency. Any abnormalities such as bending or misalignment in the pins can easily lead to poor contact, short circuits, or even system failure. Therefore, efficient and accurate pin inspection is essential. Traditional pin inspection methods mainly rely on manual visual inspection or geometric analysis using a single camera. Currently, through multi-sensor, multi-angle acquisition and intelligent analysis, it is possible to quickly and accurately detect the presence, correct positioning, and presence of deformation or damage of pins, thereby improving inspection efficiency and accuracy.

[0003] Considering that pins usually exhibit bending or misalignment when abnormal, which indirectly disrupts the regular arrangement of pins on electrical connectors, existing technologies typically determine the pin offset of each pin based on the pin position distribution pattern in the electrical connector pin image; and then perform electrical connector pin detection based on the pin offset.

[0004] However, when detecting the pins of an electrical connector under a single light source and a single shooting angle, the slight offset of the pins may appear similar to the projection shape of normal pins in the image, which may lead to the inability to accurately identify the pin offset. As a result, the accuracy of the pin offset obtained by the existing technology based on the pin position distribution pattern in a single electrical connector pin image is low, making the detection of electrical connector pins based on pin offset less effective. Summary of the Invention

[0005] To address the problem that existing technologies, which rely on the positional distribution of pins in a single electrical connector pin image, yield low accuracy in pin offset detection, this application aims to provide a method and apparatus for detecting electrical connector pins. The specific technical solution adopted is as follows:

[0006] The first aspect of this application provides a method for detecting electrical connector pins, including:

[0007] Under each light source brightness, acquire the center point of each pin area in the electrical connector pin image at each shooting angle;

[0008] In the image of the electrical connector pins, the regularity of the arrangement structure of each pin under each shooting angle at each light source brightness is determined based on the position distribution pattern of the regional center points of each pin; the corresponding offset reliability is determined based on the significance of the distribution pattern of the arrangement structure under each light source brightness at each shooting angle.

[0009] At each shooting angle for each light source brightness, the corresponding offset performance is determined based on the deviation of the regularity of the arrangement structure of each pin compared to the regularity of the arrangement of other pins; the pin offset of each pin is determined based on the offset reliability and the offset performance; and the pin detection of the electrical connector is performed based on the pin offset.

[0010] Furthermore, the process of obtaining the center point of the region includes:

[0011] The template matching algorithm is used to match and identify the pin image of the electrical connector to determine the pixel area corresponding to each pin in the pin image of the electrical connector; the centroid point of the pixel area is then determined to determine the corresponding center point of the area.

[0012] Furthermore, the process of obtaining the regularity of the arrangement structure includes:

[0013] In the image of the electrical connector pins, the horizontal arrangement regularity of each pin is determined based on the relative linear regularity of the center point of each pin's region compared to the overall arrangement of the center points of all pins' regions; the vertical arrangement regularity of each pin is determined based on the distribution regularity of the intervals between the center points of adjacent pins' regions.

[0014] Based on the product of the horizontal and vertical arrangement regularities, the arrangement structure regularity of each pin at each shooting angle under each light source brightness is determined.

[0015] Furthermore, the process of obtaining the horizontal arrangement regularity includes:

[0016] In the pixel coordinate system of the electrical connector pin image, a straight line is fitted to the center point of the region of all pins to determine the corresponding center fitting line;

[0017] By performing a negative correlation mapping between the Euclidean distance of the region center point of each pin and the center fitted line, the corresponding horizontal arrangement regularity is determined.

[0018] Furthermore, the process of obtaining the vertical arrangement regularity includes:

[0019] Arrange all the center points of all regions of all the pins in order from left to right along the central fitting line to determine the sequence of region center points;

[0020] In the sequence of region center points, the Euclidean distance between each region center point and the next region center point is used as the reference interval distance for each region center point;

[0021] Calculate the mean of the reference interval distances between the center points of all regions in the electrical connector pin image to determine the corresponding overall interval distance; perform a negative correlation mapping between the difference between the reference interval distance and the overall interval distance to determine the vertical arrangement regularity of the pins corresponding to the center point of each region.

[0022] Furthermore, the process of obtaining the offset confidence level includes:

[0023] At each shooting angle for each light source brightness, the corresponding overall reference regularity is determined based on the average value of the regularity of the arrangement structure of all pins in the corresponding electrical connector pin image.

[0024] At each shooting angle, the regular variation value of the brightness of each light source is determined based on the difference between the reference overall regularity of the brightness of each light source and the reference overall regularity of the brightness of the next light source; wherein, the brightness of the light sources is arranged in ascending order; and the corresponding reflection effect characteristic value is determined based on the average of the regular variation values ​​of the brightness of all light sources at each shooting angle.

[0025] At each shooting angle, the overall angular regularity is determined based on the average of the reference overall regularity corresponding to the brightness of all light sources; the difference between the reference overall regularity and the overall angular regularity is normalized to determine the relative overall regularity of the brightness of each light source at each shooting angle; the reliability of the offset of the brightness of each light source at each shooting angle is determined based on the product between the negative correlation mapping value of the reflection effect characteristic value and the relative overall regularity.

[0026] Furthermore, the process of obtaining the offset representation includes:

[0027] At each shooting angle and at each light source brightness, the relative offset of each pin is determined based on the difference between the regularity of the arrangement structure of each pin and the regularity of the corresponding overall reference. The product of the negative correlation mapping value of the standard deviation of the regularity of the arrangement structure of all pins and the relative offset is normalized to determine the offset performance of each pin in the connector pin image at each shooting angle and at each light source brightness.

[0028] Furthermore, the process of obtaining the pin offset includes:

[0029] At each shooting angle, the reliability of the brightness shift of each light source is normalized to determine the corresponding brightness weight;

[0030] Based on the product of the brightness weight and the offset performance, the weighted offset of each pin under each light source brightness at each shooting angle is determined; based on the cumulative value of the weighted offset of each pin under all light source brightness at each shooting angle, the local offset of each pin under each shooting angle is determined.

[0031] The mean of the local offset of each pin under all shooting angles is normalized to determine the corresponding pin offset.

[0032] Furthermore, the process of detecting the electrical connector pins based on the pin offset includes:

[0033] Pins with offsets greater than a preset offset threshold are identified as abnormal pins; connector pin detection is performed based on these abnormal pins.

[0034] Secondly, this application provides an electrical connector pin detection device, the device comprising:

[0035] The data acquisition and preprocessing module is used to acquire the center point of each pin in the electrical connector pin area at each shooting angle under each light source brightness.

[0036] The parameter determination module is used to determine the regularity of the arrangement structure of each pin under each shooting angle at each light source brightness in the image of the electrical connector pins, based on the position distribution pattern of the regional center points of each pin; and to determine the corresponding offset confidence level based on the significance of the distribution of the regularity of the arrangement structure under each light source brightness at each shooting angle.

[0037] The pin detection module is used to determine the corresponding offset performance degree based on the deviation of the regularity of the arrangement structure of each pin from the regularity of the arrangement of other pins at each shooting angle under each light source brightness; determine the pin offset degree of each pin based on the offset reliability and the offset performance degree; and perform electrical connector pin detection based on the pin offset degree.

[0038] Thirdly, this application provides a computer device including a memory and a processor. The memory is used to store computer program code, and the processor is used to call and run the computer program code from the memory to perform the method as described in the first aspect of this application or any embodiment of the first aspect.

[0039] Fourthly, this application provides a computer program product comprising computer program code, which, when executed, performs the method as described in the first aspect of this application or any embodiment thereof.

[0040] Fifthly, this application provides a computer-readable storage medium that stores computer program code, which, when executed, performs the method as described in the first aspect of this application or any embodiment thereof.

[0041] This application has the following beneficial effects:

[0042] First, based on the arrangement pattern of the electrical connector pins, at each shooting angle and under each light source brightness, the linear fitting deviation of the center point of each pin in the image and the characteristic of equal interval distribution are used to initially determine the regularity of the arrangement structure. Then, based on the reflection effect at each shooting angle, the significance of the regularity of the arrangement structure under each light source brightness is used to determine the corresponding offset reliability. Finally, based on the offset reliability and combined with the deviation of the regularity of each pin compared with other pins, a more accurate pin offset is determined for each pin, making the detection of electrical connector pins based on pin offset more effective. Attached Figure Description

[0043] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a flowchart of a method for detecting electrical connector pins according to an embodiment of the present invention;

[0045] Figure 2 This is a schematic diagram of the structure of an electrical connector pin image acquisition device according to an embodiment of the present invention;

[0046] Figure 3 This is a structural diagram of an electrical connector pin detection device provided in one embodiment of the present invention;

[0047] Figure 4 This is a schematic diagram of a computer device structure provided in one embodiment of the present invention;

[0048] exist Figure 2 It includes: 1-rotatable gimbal; 2-telescopic bracket; 3-industrial camera; 4-adjustable light source; 5-electrical connector; 6-conveyor belt and 7-inspection table. Detailed Implementation

[0049] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of an electrical connector pin detection method and apparatus according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment, and specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature.

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0051] The following description, in conjunction with the accompanying drawings, details the specific scheme of the electrical connector pin detection method and apparatus provided by the present invention.

[0052] This application provides a method for detecting electrical connector pins. Please refer to [link to relevant documentation]. Figure 1 The diagram illustrates a flowchart of an electrical connector pin detection method according to an embodiment of the present invention, the method comprising:

[0053] Step S101: Under each light source brightness, obtain the center point of each pin area in the electrical connector pin image at each shooting angle.

[0054] Please see Figure 2 It shows a schematic diagram of the structure of an electrical connector pin image acquisition device provided in an embodiment of the present invention; Figure 2A corresponding electrical connector pin image acquisition device includes: a rotatable pan-tilt head 1, a telescopic bracket 2, an industrial camera 3, an adjustable brightness light source 4, an electrical connector 5, a conveyor belt 6, and a testing table 7. The electrical connector 5 is transported to the testing table 7 via the conveyor belt 6. The telescopic bracket 2 extends and retracts to position the mobile industrial camera 3 directly above the electrical connector 5. By rotating the rotatable pan-tilt head 1, the industrial camera 3 acquires initial images of the electrical connector from various shooting angles. Simultaneously, an adjustable brightness light source 4 with different brightness levels is provided and fixed on the bracket 2. Then, the electrical connector pin image acquisition device acquires initial images of the electrical connector at each shooting angle for each light source brightness. The initial image of the electrical connector includes a complete electrical connector and includes at least two pins. In a specific implementation of this invention, the light source brightness includes 40lx, 80lx, 120lx, 160lx, and 200lx. The shooting angle is divided into all shooting angle ranges that can capture the connector pin area in 5-degree increments to obtain all shooting angles. These can be adjusted according to the specific implementation environment and will not be further elaborated here.

[0055] Considering that the pins in an electrical connector are typically arranged in a matrix or parallel pattern, to enable more accurate pin detection using linear and equally spaced features, target detection is performed on the initial image of the electrical connector, dividing the initial image into pin images corresponding to each row of pins. That is, the pin images in this embodiment include a row of pins arranged in a straight line. In one specific implementation of this embodiment, the target detection model uses the YOLOv5 target detection model, which can be adjusted according to the specific implementation environment and will not be further elaborated here. It should be noted that this embodiment only analyzes one row of pins; the analysis method for other rows of pins is the same as in this embodiment. Therefore, the pin images in subsequent analysis processes all correspond to the same row of pins and will not be further elaborated here.

[0056] For electrical connectors with normal pin configurations, the shape of each pin is usually consistent, and the pins in each row exhibit a strict linear distribution and equal spacing. When an abnormality such as bending or misalignment occurs in each pin, the overall shape of the corresponding pin area will shift, thereby indirectly disrupting the regular arrangement of the pins under normal circumstances. When the overall shape of the pin area shifts, the position of the center point of the corresponding area will usually change. Therefore, the center point of each pin area can be determined first for subsequent arrangement pattern analysis.

[0057] Preferably, in some possible implementations of the embodiments of the present invention, the process of obtaining the region center point includes:

[0058] Template matching algorithms are used to match and identify the pin images of electrical connectors, determining the pixel region corresponding to each pin in the image. The pixel region corresponds to the area representing the overall shape of the pin. Therefore, the center of the pixel region is further determined. In this embodiment, the center point of the region is determined based on the centroid of the pixel region, which can be adjusted according to the specific implementation environment. For example, the centroid can be used as the center point, which will not be elaborated further here. Since the positions of the pins in the electrical connector are fixedly distributed, the template matching algorithm can determine the pixel regions corresponding to the same pin in electrical connector pin images under different shooting angles and different light source brightness. It should be noted that the template matching algorithm is a well-known technique to those skilled in the art and will not be elaborated further here.

[0059] Step S102: In the image of the electrical connector pins, based on the position distribution pattern of the center point of each pin's region, determine the regularity of the arrangement structure of each pin under each shooting angle at each light source brightness; based on the significance of the distribution of the regularity of the arrangement structure under each light source brightness at each shooting angle, determine the corresponding offset reliability.

[0060] In an image of an electrical connector pin, under normal circumstances, the height of each pin in the horizontal direction is usually consistent, and the center points of each corresponding region are on the same straight line. If the position of a pin is offset, it will disrupt the straightness. In addition, according to the normal pin arrangement of an electrical connector, the spacing between adjacent pins in the image of an electrical connector pin usually shows a high degree of consistency. The offset of the pin position will also disrupt this spacing feature. Therefore, based on the above characteristics, in the embodiment of the present invention, the arrangement structure regularity of each pin under each shooting angle at each light source brightness is determined according to the position distribution pattern of the center points of each pin in the image of an electrical connector pin.

[0061] Preferably, in some possible implementations of the embodiments of the present invention, the process of obtaining the regularity of the arrangement structure includes:

[0062] Firstly, regarding the linear arrangement of the pins, in the electrical connector pin image, the horizontal arrangement regularity of each pin is determined based on the relative linear regularity of the center point of each pin's region compared to the overall linear arrangement of the center points of all pins' regions. In a specific implementation of this invention, the process of obtaining the horizontal arrangement regularity includes: in the pixel coordinate system of the electrical connector pin image, performing linear fitting on the center points of all pins' regions to determine the corresponding center-fitted line; and performing negative correlation mapping on the Euclidean distance between the center point of each pin's region and the center-fitted line to determine the corresponding horizontal arrangement regularity.

[0063] In one specific implementation of this invention, the line fitting method uses the least squares method; the Euclidean distance between the center point of each pin's region and the fitted line is equivalent to the residual. The larger the residual, the greater the deviation between the corresponding center point of the region and the linear trend of the arrangement of all pin center points, the worse the regularity of the linear arrangement of the corresponding pin, the smaller the regularity of the horizontal arrangement, and the more likely an abnormal deviation has occurred.

[0064] Then, based on the distribution pattern of the center points of adjacent pins along the dimension of equally spaced pins, the vertical arrangement regularity of each pin is determined; in a specific implementation of this invention, the process of obtaining the vertical arrangement regularity includes:

[0065] Along the fitted center line from left to right, the center points of all regions of all pins are arranged sequentially to determine the region center point sequence. In this sequence, the Euclidean distance between each region center point and the next is used as the reference interval distance for each region center point. The mean of the reference interval distances for all region center points in the connector pin image is calculated to determine the corresponding overall interval distance. The difference between the reference interval distance and the overall interval distance is negatively correlated to determine the vertical arrangement regularity of the pins corresponding to each region center point. It should be noted that in this embodiment, the reference interval distance of the last region center point is obtained by averaging the reference interval distances of all other region center points to avoid endpoint issues.

[0066] First, the arrangement order of the pins is determined based on the fitted straight line at the center, thus providing guidance for the calculation of the pin spacing. Based on the principle of equal interval, under normal circumstances, the reference interval distance of the center points of each region is usually highly consistent. That is, under normal circumstances, the reference interval distance of the center points of each region of the pin is usually equal to or close to the overall interval distance. Therefore, for each pin, the greater the deviation between the reference interval distance of its corresponding region center point and the overall interval distance, the less the pin conforms to the law of equal interval distribution, and the smaller the regularity of the vertical arrangement, which means that abnormal deviation is more likely to have occurred.

[0067] Furthermore, by combining the horizontal and vertical arrangement regularities of each pin, and based on the product of these regularities, the arrangement structure regularity of each pin under each light source brightness and each shooting angle is comprehensively determined. This results in the smaller the regularity of the arrangement structure, the more severe the abnormal deviation of the corresponding pin under the corresponding light source brightness and shooting angle, and vice versa.

[0068] In one specific implementation of this invention, the process of obtaining the regularity of the arrangement structure is expressed by the following formula: : For insert pins In the The brightness of the first light source Regularity of the arrangement structure under different shooting angles; For the first The brightness of the first light source Images of electrical connector pins taken from various shooting angles. The Euclidean distance between the center point of the region and the corresponding center fitted line; It is a minimum-maximum normalization function; For insert pins In the The brightness of the first light source The regularity of horizontal arrangement under various shooting angles; For the first The brightness of the first light source Images of electrical connector pins taken from various shooting angles. Reference interval distance; For the first The brightness of the first light source The average of the reference interval distances between the center points of all regions in the image of the electrical connector pins under each shooting angle, which is also the overall interval distance; For insert pins In the The brightness of the first light source The regularity of vertical arrangement under different shooting angles.

[0069] Since electrical connector pins are typically made of metal, their surfaces exhibit significant reflectivity to light. When pins shift or tilt, subtle differences in reflectivity, shadow position, and outline sharpness occur under varying light source brightness. By analyzing the changes in the pin arrangement under different brightness conditions, these optical characteristic differences caused by minute pin shifts can be amplified, making them easier to distinguish from normal pins. Therefore, based on the reflective effect, the reliability of the shift can be determined by observing the significant distribution of the arrangement pattern under each light source brightness at each shooting angle.

[0070] Preferably, in some possible implementations of the embodiments of the present invention, the process of obtaining the offset confidence level includes:

[0071] At each shooting angle for each light source brightness, a corresponding overall reference regularity is determined based on the average of the regularity of the arrangement structure of all pins in the corresponding electrical connector pin image. At each shooting angle, the regular variation value of each light source brightness is determined based on the difference between the overall reference regularity of each light source brightness and the overall reference regularity of the next light source brightness; wherein, the light source brightness is arranged in ascending order; the corresponding reflective effect characteristic value is determined based on the average of the regular variation values ​​of all light source brightness at each shooting angle. It should be noted that the regular variation value of the last light source brightness is set as the average of the regular variation values ​​of all other light source brightness at the corresponding shooting angle, which will not be further elaborated here. In addition, it should be noted that the difference in the embodiments of the present invention represents the absolute value of the difference.

[0072] While analyzing pin offset under different light source brightness can amplify the offset characteristics, illumination may simultaneously affect the arrangement of all pins. To distinguish between genuine pin offset and spurious offset due to illumination interference, it's necessary to analyze the overall influence of illumination on the pin arrangement at each shooting angle. The greater the difference in the arrangement of all pins under different brightness at each shooting angle, the greater the reflection effect at that angle. This means that when analyzing at the corresponding shooting angle, it's easier to identify spurious offset due to illumination interference as pin offset. Therefore, the weight of illumination offset analysis at the corresponding shooting angle needs to be reduced. In other words, for each connector pin image, the smaller the reflection effect at its corresponding shooting angle, the less it is affected by illumination interference, and the higher the reliability of the pin offset analysis.

[0073] Since illumination can affect the arrangement of all pins simultaneously, a greater overall regularity of the reference under a given light source brightness compared to the overall reference regularity of other light source brightness indicates a greater overall regularity of the pin arrangement in the connector pin image. This means a lower probability that all pins are disturbed under the corresponding illumination intensity, thus increasing the reliability of pin offset analysis in the corresponding connector pin image. Therefore, further, at each shooting angle, the overall regularity of the angle is determined based on the average of the overall regularity of the references corresponding to all light source brightness. The difference between the overall regularity of the references and the overall regularity of the angle is normalized to determine the relative overall regularity of each light source brightness at each shooting angle. A greater relative overall regularity results in higher reliability of the analyzed pin offset performance at the corresponding shooting angle's light source brightness.

[0074] Furthermore, by combining the characteristic values ​​of the reflection effect and the relative overall regularity, the reliability of the shift in brightness of each light source at each shooting angle is determined based on the product between the negative correlation mapping value of the characteristic values ​​of the reflection effect and the relative overall regularity. This ensures that when the reliability of the shift is higher, the reliability of the shift performance is higher when the corresponding electrical connector pin image shows pin shift.

[0075] In one specific implementation of this invention, the process of obtaining the offset confidence level includes: ;in, For the first The first shooting angle The reliability of the brightness deviation of individual light sources; For the first The average value of the regular variation of the brightness of all light sources under a shooting angle, that is, the characteristic value of the reflection effect; It is an exponential function with the natural constant as its base; For the first The first shooting angle The mean of the regularity of the arrangement structure of all pins in the pin image of the electrical connector with a light source brightness, that is, the corresponding overall regularity of the reference. For the first The average of the reference overall regularity of the brightness of all light sources under a shooting angle, that is, the overall regularity of the angle; For the first The first shooting angle The relative overall regularity of the brightness of individual light sources.

[0076] Step S103: At each shooting angle for each light source brightness, determine the corresponding offset performance based on the deviation of the regularity of the arrangement structure of each pin compared to the regularity of the arrangement of other pins; determine the pin offset of each pin based on the offset reliability and offset performance; and perform connector pin detection based on the pin offset.

[0077] Considering that the regularity of the arrangement structure of the offset pins in the electrical connector pin image is smaller than that of other pins, we can analyze the deviation of the regularity of the arrangement structure of each pin from that of other pins at each shooting angle for each light source brightness to determine the degree of offset of each pin under the same light source brightness and shooting angle. The greater the degree of offset, the greater the degree of offset of the corresponding pin under the corresponding light source brightness and shooting angle, which means that it is more likely to be an abnormal pin.

[0078] Preferably, in some possible implementations of the embodiments of the present invention, the process of obtaining the offset performance includes: at each light source brightness at each shooting angle, determining the relative offset of each pin based on the difference between the regularity of the arrangement structure of each pin and the regularity of the corresponding reference whole; normalizing the product between the negative correlation mapping value of the standard deviation of the regularity of the arrangement structure of all pins and the relative offset, and determining the offset performance of each pin in the connector pin image at each light source brightness at each shooting angle.

[0079] For each pin, the greater its relative offset and the smaller the standard deviation of the regularity of the arrangement structure of all pins, the more obvious the discrete deviation characteristics of the regularity of the arrangement structure of the pin are. This is more in line with the characteristic that the regularity of the arrangement structure of the pin with the offset anomaly is larger than that of the regularity of the arrangement structure of other pins. Therefore, the greater the offset performance, the more likely the corresponding pin is to be an offset anomaly.

[0080] In one specific implementation of this invention, the process of obtaining the offset performance is expressed by the formula: ;in, For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The degree of offset performance; For the first The first shooting angle The standard deviation of the regularity of the arrangement structure of all pins in the connector pin image of each light source brightness; For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The regularity of the arrangement structure; For the first The first shooting angle The overall regularity of the brightness of individual light sources; For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The relative offset.

[0081] Since offset performance only characterizes the abnormal offset features of each pin in a single electrical connector pin image, and the reliability of the offset performance of each pin varies in electrical connector pin images with different light source brightness and different shooting angles; therefore, in order to determine a more accurate pin offset for each pin, a more accurate and comprehensive pin offset is determined by combining the offset reliability and offset performance; so that the larger the pin offset, the more likely it is to be an abnormal pin. In some possible implementations of this invention, the process of obtaining the pin offset includes:

[0082] At each shooting angle, the reliability of the offset of each light source brightness is normalized to determine the corresponding brightness weight. Based on the product between the brightness weight and the offset performance, the weighted offset of each pin at each shooting angle under each light source brightness is determined. In a specific implementation of this invention, the normalization function for normalizing the offset reliability is the softmax function. That is, the sum of the offset reliability of all light source brightness at each shooting angle is used as the denominator, and the offset reliability of each light source brightness at the corresponding shooting angle is used as the numerator to determine the corresponding current brightness weight. This makes the sum of the brightness weights of all light source brightness at each shooting angle equal to 1. Therefore, after weighting the offset performance through the brightness weight, the obtained weighted offset more accurately integrates the reliability information. Furthermore, combined with the accumulation algorithm, the final local offset is more accurate.

[0083] Therefore, this embodiment of the invention further determines the local offset of each pin at each shooting angle based on the cumulative weighted offset of each pin under all light source brightness at each shooting angle; finally, by combining all shooting angles, the mean of the local offset of each pin at all shooting angles is normalized to determine the corresponding more accurate pin offset.

[0084] In one specific implementation of this invention, the process of obtaining the pin offset is expressed by the following formula: ;in, For insert pins Pin offset; The number of shooting angles; The quantity of light source brightness; For the first The first shooting angle The reliability of the brightness deviation of individual light sources; It is the softmax function; For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The degree of offset performance; For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The weighted offset; For insert pins In the Local offset at various shooting angles.

[0085] In another specific implementation of this invention, considering that the reflection effect varies at different angles, and the greater the reflection effect, the greater the impact of illumination interference, and the lower the reliability of the pin offset analysis, the more effective the reflection effect is. Therefore, the reflection effect feature values ​​at each angle are negatively correlated and normalized to determine the corresponding reflection effect weights. The corresponding normalization method uses the softmax function; the negative correlation mapping method can be... Alternatively, it can be used The specific implementation environment can be selected independently; the product between the local offset of each pin at each shooting angle and the reflection effect of the corresponding shooting angle is taken as the final offset of each pin at each shooting angle; the cumulative value of the final offset of each pin at all shooting angles is normalized to determine the pin offset of each pin; further details are not provided here.

[0086] Finally, the connector pins are detected based on the pin offset. Specifically, pins with offsets greater than a preset offset threshold are identified as abnormal pins; the connector pins are then detected based on these abnormal pins. In one specific implementation of this invention, the preset offset threshold is set to 0.6, which can be adjusted according to the specific implementation environment and will not be elaborated further here.

[0087] In summary, a method for detecting electrical connector pins first determines the regularity of the pin arrangement based on the linear fitting deviation of the center point of each pin in the pin image and the characteristics of equal interval distribution at each light source brightness at each shooting angle. Then, based on the reflection effect at each shooting angle, the method determines the corresponding offset reliability based on the significance of the regularity of the arrangement at each light source brightness. Finally, based on the offset reliability and the deviation of the regularity of each pin compared to other pins, a more accurate pin offset is determined for each pin, resulting in better detection of electrical connector pins based on pin offset.

[0088] This application also provides an electrical connector pin detection device, please refer to [link to relevant documentation]. Figure 3The diagram shows a structural diagram of an electrical connector pin detection device according to an embodiment of the present invention. The device includes: a data acquisition and preprocessing module 301, a parameter determination module 302, and a pin detection module 303.

[0089] The data acquisition and preprocessing module 301 is used to acquire the center point of each pin in the electrical connector pin area image at each shooting angle under each light source brightness.

[0090] The parameter determination module 302 is used to determine the regularity of the arrangement structure of each pin under each shooting angle at each light source brightness in the image of the electrical connector pins, based on the position distribution pattern of the regional center points of each pin; and to determine the corresponding offset confidence level based on the significance of the distribution of the regularity of the arrangement structure under each light source brightness at each shooting angle.

[0091] The pin detection module 303 is used to determine the corresponding offset performance degree based on the deviation of the regularity of the arrangement structure of each pin from the regularity of the arrangement of other pins at each shooting angle under each light source brightness; determine the pin offset degree of each pin based on the offset reliability and offset performance degree; and perform pin detection of the electrical connector based on the pin offset degree.

[0092] It should be noted that the apparatus provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the electrical connector pin detection device and the electrical connector pin detection method embodiment provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiment, which will not be repeated here.

[0093] This application also provides a computer device; please refer to [link / reference]. Figure 4 The illustration shows a schematic diagram of a computer device structure according to an embodiment of the present invention. The computer device includes a memory 401, a processor 402, and a computer program 403 stored in the memory 401 and running on the processor 402. When the processor 402 executes the computer program 403, the computer device can execute any of the electrical connector pin detection methods described above.

[0094] This application also provides a computer program product that, when run on a computer device, enables the computer device to execute any of the aforementioned electrical connector pin detection methods.

[0095] This application also provides a computer-readable storage medium storing computer program code. When the computer program code is run on a computer device, the computer device can execute any of the aforementioned electrical connector pin detection methods.

[0096] In the embodiments provided in this application, it should be understood that the computer device, computer program product and computer-readable storage medium provided are all used to perform the corresponding methods provided above, and therefore the beneficial effects they can achieve can be referred to the beneficial effects of the methods provided above, which will not be repeated here.

[0097] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0098] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

Claims

1. A method for detecting the pins of an electrical connector, characterized in that, The method includes: Under each light source brightness, acquire the center point of each pin area in the electrical connector pin image at each shooting angle; In the image of the electrical connector pins, the regularity of the arrangement structure of each pin under each shooting angle at each light source brightness is determined based on the position distribution pattern of the regional center points of each pin; the corresponding offset reliability is determined based on the significance of the distribution pattern of the arrangement structure under each light source brightness at each shooting angle. At each shooting angle for each light source brightness, the corresponding offset performance is determined based on the deviation of the regularity of the arrangement structure of each pin compared to the regularity of the arrangement of other pins; the pin offset of each pin is determined based on the offset reliability and the offset performance; and the connector pin detection is performed based on the pin offset. The process of obtaining the regularity of the arrangement structure includes: In the image of the electrical connector pins, the horizontal arrangement regularity of each pin is determined based on the relative linear regularity of the center point of each pin's region compared to the overall arrangement of the center points of all pins' regions; the vertical arrangement regularity of each pin is determined based on the distribution regularity of the intervals between the center points of adjacent pins' regions. Based on the product of the horizontal and vertical arrangement regularities, the arrangement structure regularity of each pin under each shooting angle at each light source brightness is determined; the process of obtaining the arrangement structure regularity is expressed by the formula: : For insert pins In the The brightness of the first light source Regularity of the arrangement structure under different shooting angles; For the first The brightness of the first light source Images of electrical connector pins taken from various shooting angles. The Euclidean distance between the center point of the region and the corresponding center fitted line; It is a minimum-maximum normalization function; For insert pins In the The brightness of the first light source The regularity of horizontal arrangement under various shooting angles; For the first The brightness of the first light source Images of electrical connector pins taken from various shooting angles. Reference interval distance; For the first The brightness of the first light source The average of the reference interval distances between the center points of all regions in the image of the electrical connector pins under each shooting angle, which is also the overall interval distance; For insert pins In the The brightness of the first light source The regularity of vertical arrangement under various shooting angles; The process of obtaining the offset confidence level includes: ;in, For the first The first shooting angle The reliability of the brightness deviation of individual light sources; For the first The average value of the regular variation of the brightness of all light sources under a shooting angle, that is, the characteristic value of the reflection effect; It is an exponential function with the natural constant as its base; For the first The first shooting angle The mean of the regularity of the arrangement structure of all pins in the pin image of the electrical connector with a light source brightness, that is, the corresponding overall regularity of the reference. For the first The average of the reference overall regularity of the brightness of all light sources under a shooting angle, that is, the overall regularity of the angle; For the first The first shooting angle The relative overall regularity of the brightness of individual light sources; The process of obtaining the offset representation can be expressed by the formula: ;in, For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The degree of offset performance; For the first The first shooting angle The standard deviation of the regularity of the arrangement structure of all pins in the connector pin image of each light source brightness; For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The regularity of the arrangement structure; For the first The first shooting angle The overall regularity of the brightness of individual light sources; For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The relative offset; The process of obtaining the pin offset is expressed by the formula: ;in, For insert pins Pin offset; The number of shooting angles; The quantity of light source brightness; For the first The first shooting angle The reliability of the brightness deviation of individual light sources; It is the softmax function; For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The degree of offset performance; For the first The first shooting angle The pins in the image of the electrical connector pins for each light source brightness. The weighted offset; For insert pins In the Local offset at various shooting angles.

2. The method for detecting electrical connector pins according to claim 1, characterized in that, The process of obtaining the center point of the region includes: The template matching algorithm is used to match and identify the pin image of the electrical connector to determine the pixel area corresponding to each pin in the pin image of the electrical connector; the centroid point of the pixel area is then determined to determine the corresponding center point of the area.

3. The method for detecting electrical connector pins according to claim 1, characterized in that, The process of obtaining the horizontal arrangement regularity includes: In the pixel coordinate system of the electrical connector pin image, a straight line is fitted to the center point of the region of all pins to determine the corresponding center fitting line; By performing a negative correlation mapping between the Euclidean distance of the region center point of each pin and the center fitted line, the corresponding horizontal arrangement regularity is determined.

4. The method for detecting electrical connector pins according to claim 3, characterized in that, The process of obtaining the vertical arrangement regularity includes: Arrange all the center points of all regions of all the pins in order from left to right along the central fitting line to determine the sequence of region center points; In the sequence of region center points, the Euclidean distance between each region center point and the next region center point is used as the reference interval distance for each region center point; Calculate the mean of the reference interval distances between the center points of all regions in the electrical connector pin image to determine the corresponding overall interval distance; perform a negative correlation mapping between the difference between the reference interval distance and the overall interval distance to determine the vertical arrangement regularity of the pins corresponding to the center point of each region.

5. The method for detecting electrical connector pins according to claim 1, characterized in that, The process of obtaining the reliability of the offset includes: At each shooting angle for each light source brightness, the corresponding overall reference regularity is determined based on the average value of the regularity of the arrangement structure of all pins in the corresponding electrical connector pin image. At each shooting angle, the regular variation value of the brightness of each light source is determined based on the difference between the reference overall regularity of the brightness of each light source and the reference overall regularity of the brightness of the next light source; wherein, the brightness of the light sources is arranged in ascending order; and the corresponding reflection effect characteristic value is determined based on the average of the regular variation values ​​of the brightness of all light sources at each shooting angle. At each shooting angle, the overall angular regularity is determined based on the average of the reference overall regularity corresponding to the brightness of all light sources; the difference between the reference overall regularity and the overall angular regularity is normalized to determine the relative overall regularity of the brightness of each light source at each shooting angle; the reliability of the offset of the brightness of each light source at each shooting angle is determined based on the product between the negative correlation mapping value of the reflection effect characteristic value and the relative overall regularity.

6. The method for detecting electrical connector pins according to claim 5, characterized in that, The process of obtaining the offset representation includes: At each shooting angle and at each light source brightness, the relative offset of each pin is determined based on the difference between the regularity of the arrangement structure of each pin and the regularity of the corresponding overall reference. The product of the negative correlation mapping value of the standard deviation of the regularity of the arrangement structure of all pins and the relative offset is normalized to determine the offset performance of each pin in the connector pin image at each shooting angle and at each light source brightness.

7. The method for detecting electrical connector pins according to claim 1, characterized in that, The process of obtaining the pin offset includes: At each shooting angle, the reliability of the brightness shift of each light source is normalized to determine the corresponding brightness weight; Based on the product of the brightness weight and the offset performance, the weighted offset of each pin under each light source brightness at each shooting angle is determined; based on the cumulative value of the weighted offset of each pin under all light source brightness at each shooting angle, the local offset of each pin under each shooting angle is determined. The mean of the local offset of each pin under all shooting angles is normalized to determine the corresponding pin offset.

8. The method for detecting electrical connector pins according to claim 1, characterized in that, The process of detecting the connector pins based on the pin offset includes: Pins with offsets greater than a preset offset threshold are identified as abnormal pins; connector pin detection is performed based on these abnormal pins.

9. A device for detecting electrical connector pins, the device being used to implement the electrical connector pin detection method according to any one of claims 1 to 8, characterized in that, The device includes: The data acquisition and preprocessing module is used to acquire the center point of each pin in the electrical connector pin area at each shooting angle under each light source brightness. The parameter determination module is used to determine the regularity of the arrangement structure of each pin under each shooting angle at each light source brightness in the image of the electrical connector pins, based on the position distribution pattern of the regional center points of each pin; and to determine the corresponding offset confidence level based on the significance of the distribution of the regularity of the arrangement structure under each light source brightness at each shooting angle. The pin detection module is used to determine the corresponding offset performance degree based on the deviation of the regularity of the arrangement structure of each pin from the regularity of the arrangement of other pins at each shooting angle under each light source brightness; determine the pin offset degree of each pin based on the offset reliability and the offset performance degree; and perform electrical connector pin detection based on the pin offset degree.