Automatic plugging method and device of USB type connector, electronic equipment and storage medium

By performing global binarization and principal component analysis on USB images, combined with an adaptive classifier, the problem of automating the pose detection of USB cable connectors was solved, achieving high-precision and reliable automatic insertion that can adapt to different lighting environments.

CN117011383BActive Publication Date: 2026-07-21TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TSINGHUA UNIVERSITY
Filing Date
2023-08-08
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In the existing technology, it is difficult to automate the pose detection of USB cable connectors, resulting in low efficiency and unstable quality of manual assembly, as well as high labor intensity and safety hazards for workers.

Method used

By acquiring USB images and performing global binarization, the basic regions of holes, slots, and structural identification are identified. Principal component analysis and an adaptive classifier are combined to calculate the USB's orientation and perform difference operations to adjust the insertion angle, thereby achieving automatic insertion.

Benefits of technology

It achieves high-precision and reliable pose detection for USB cable connectors, is robust and reusable, can work stably under different lighting conditions, and achieves a 100% automated mating success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117011383B_ABST
    Figure CN117011383B_ABST
Patent Text Reader

Abstract

The application relates to an automatic plugging method and device of a USB connector, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a USB image containing a central region, performing global binarization processing, obtaining a hole slot recognition primitive region and a structure recognition primitive region according to the processed USB image, and calculating the center of the primitive region to obtain the posture direction of the USB; performing principal component analysis (PCA) operation on the structure recognition primitive region, obtaining the USB posture according to the operation result and the posture direction of the USB, performing difference set operation on the USB image to obtain a difference set image, calculating the angle adjustment amount of the USB and a to-be-plugged socket according to the difference set image, the operation result and a USB image coefficient, and plugging the USB and the to-be-plugged socket. Therefore, the problems that related technologies cannot be used for USB cable connector pose detection are solved, and the method has the advantages of high detection precision, high reliability, strong robustness to image quality, strong multiplicity and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of visual inspection technology, and in particular to an automatic mating method, apparatus, electronic device and storage medium for USB (Universal Serial Bus) type connectors. Background Technology

[0002] Cables are a general term for conductors, cables, and bundles of them. As the carrier of energy and signal transmission on equipment, cables are considered the nervous system of the equipment and play a vital role in the normal operation of the equipment.

[0003] In current industrial production, cable assembly is entirely manual, with no reports of its practical application. On one hand, manual assembly is inefficient, and assembly quality is largely determined by the worker's skill level and condition, making its stability difficult to guarantee. On the other hand, cable assembly involves a large workload, numerous procedures, and often harsh working conditions, placing a significant burden on workers' health and creating safety hazards. Furthermore, the quality and efficiency of assembly operations are significantly influenced by factors such as the openness and accessibility of the workspace, posture comfort, and labor intensity.

[0004] The manual assembly method has greatly affected the quality and efficiency of cable assembly, and has become a bottleneck problem in the production of many equipment, which urgently needs to be solved. Summary of the Invention

[0005] This application provides an automatic mating method, apparatus, electronic device, and storage medium for USB connectors to solve the problem that related technologies are difficult to use for pose detection of USB cable connectors. It can realize effective pose detection of USB cable connectors and has the advantages of high detection accuracy, high detection reliability, strong robustness to image quality, and strong reusability.

[0006] The first aspect of this application provides an automatic mating method for a USB connector, comprising the following steps:

[0007] Obtain an image of the Universal Serial Bus (USB) containing the central region;

[0008] The USB image is subjected to global binarization, and the slot recognition primitive region and the structure recognition primitive region are obtained from the processed USB image. The center of the slot recognition primitive region and the center of the structure recognition primitive region are calculated, and the orientation direction of the USB is obtained from the center of the slot region and the center of the structure region.

[0009] Principal Component Analysis (PCA) is performed on the structural recognition primitive region, and the USB orientation is obtained based on the calculation result and the orientation direction of the USB. Based on the slot recognition primitive region and the structural recognition primitive region, a difference operation is performed on the USB image to obtain a difference image. The angle adjustment between the USB and the socket to be plugged in is calculated based on the difference image, the calculation result, and the image coefficients of the USB image. The USB is then plugged into the socket according to the angle adjustment.

[0010] Optionally, in some embodiments, obtaining the slot recognition primitive region and the structure recognition primitive region based on the processed USB image includes:

[0011] The processed USB image is input into a preset adaptive classifier to generate the hole and slot recognition primitive region and the structure recognition primitive region.

[0012] Optionally, in some embodiments, before inputting the processed USB image into the preset adaptive classifier, the method further includes:

[0013] Acquire training images under different lighting conditions, and perform thresholding on the training images to generate multiple training datasets;

[0014] For each training image in the training dataset, a support vector machine (SVM) is used to learn the objective function set.

[0015] Based on the feature mean of the image to be trained, linear regression is performed on the target function set to generate an adaptive projection function;

[0016] Multiple target boundary functions are generated based on the adaptive projection function, and linear regression is performed on the multiple target boundary functions based on the feature mean to obtain multiple adaptive boundary functions.

[0017] Optionally, in some embodiments, after obtaining the slot recognition primitive region and the structure recognition primitive region based on the processed USB image, the method further includes:

[0018] Determine whether both the hole and slot identification element region and the structure identification element region meet the preset detection conditions;

[0019] If the slot identification element region or the structure identification element region does not meet the preset detection conditions, then the identification threshold of the slot identification element region and the structure identification element region is initialized.

[0020] The recognition threshold is input into a preset discriminant function to obtain the output result, and the recognition region of the output result is divided. Morphological calculations are then performed based on the recognition region to generate morphological calculation results.

[0021] The recognition threshold is updated based on the morphological calculation results until the morphological calculation results meet the recognition requirements.

[0022] Optionally, in some embodiments, before performing global binarization on the USB image, the following steps are further included:

[0023] The USB image is preprocessed based on a preset preprocessing strategy, wherein the preset preprocessing strategy is:

[0024]

[0025] in, Here, x represents the feature components after pixel calibration, and x represents the original feature components of the pixel. 0.05 x is the 0.05 quantile of the corresponding feature component of the image. 0.95 x is the 0.95 quantile of the corresponding feature components of the image. 0.05 (ref) represents the 0.05 quantile of the corresponding feature component in the reference image, x 0.95 (ref) is the 0.95 quantile of the corresponding feature component of the reference image.

[0026] A second aspect of this application provides an automatic mating device for USB connectors, comprising:

[0027] The acquisition module is used to acquire a Universal Serial Bus (USB) image containing the central area;

[0028] The processing module is used to perform global binarization processing on the USB image, and obtain the slot recognition primitive region and the structure recognition primitive region based on the processed USB image, and calculate the center of the slot recognition primitive region and the center of the structure recognition primitive region, and obtain the orientation direction of the USB based on the center of the slot region and the center of the structure region.

[0029] The plug-in module is used to perform principal component analysis (PCA) on the structure recognition primitive region, obtain the USB posture based on the calculation result and the USB posture direction, perform difference operation on the USB image based on the slot recognition primitive region and the structure recognition primitive region to obtain a difference image, calculate the angle adjustment amount between the USB and the socket to be plugged in based on the difference image, the calculation result and the image coefficients of the USB image, and plug the USB into the socket to be plugged in based on the angle adjustment amount.

[0030] Optionally, in some embodiments, the processing module includes:

[0031] The input unit is used to input the processed USB image into a preset adaptive classifier to generate the hole and slot recognition primitive region and the structure recognition primitive region.

[0032] Optionally, in some embodiments, before inputting the processed USB image to the preset adaptive classifier, the input unit further includes:

[0033] The acquisition subunit is used to acquire training images under different lighting conditions, and to perform thresholding on the training images to generate multiple training datasets.

[0034] The SVM learning subunit is used to perform support vector machine (SVM) learning on the training images in each training dataset to generate a set of objective functions.

[0035] The linear regression subunit performs linear regression on the target function set based on the feature mean of the image to be trained, and generates an adaptive projection function;

[0036] A sub-unit is generated to generate multiple target boundary functions based on the adaptive projection function, and to perform linear regression on the multiple target boundary functions based on the feature mean to obtain multiple adaptive boundary functions.

[0037] Optionally, in some embodiments, after obtaining the slot recognition primitive region and the structure recognition primitive region based on the processed USB image, the processing module is further configured to:

[0038] Determine whether both the hole and slot identification element region and the structure identification element region meet the preset detection conditions;

[0039] If the slot identification element region or the structure identification element region does not meet the preset detection conditions, then the identification threshold of the slot identification element region and the structure identification element region is initialized.

[0040] The recognition threshold is input into a preset discriminant function to obtain the output result, and the recognition region of the output result is divided. Morphological calculations are then performed based on the recognition region to generate morphological calculation results.

[0041] The recognition threshold is updated based on the morphological calculation results until the morphological calculation results meet the recognition requirements.

[0042] Optionally, in some embodiments, before performing global binarization on the USB image, the processing module is further configured to:

[0043] The USB image is preprocessed based on a preset preprocessing strategy, wherein the preset preprocessing strategy is:

[0044]

[0045] in, Here, x represents the feature components after pixel calibration, and x represents the original feature components of the pixel. 0.05 x is the 0.05 quantile of the corresponding feature component of the image. 0.95 x is the 0.95 quantile of the corresponding feature components of the image. 0.05 (ref) represents the 0.05 quantile of the corresponding feature component in the reference image, x 0.95 (ref) is the 0.95 quantile of the corresponding feature component of the reference image.

[0046] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the automatic insertion method of a USB connector as described in the above embodiments.

[0047] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement the automatic mating method for a USB-type connector as described in the above embodiments.

[0048] Therefore, by acquiring a Universal Serial Bus (USB) image containing the central region and performing global binarization on the USB image, the hole / slot recognition primitive region and the structure recognition primitive region are obtained from the processed USB image. The center of the hole / slot recognition primitive region and the center of the structure region in the structure recognition primitive region are calculated. Based on the center of the hole / slot region and the center of the structure region, the orientation direction of the USB is obtained. Principal Component Analysis (PCA) is performed on the structure recognition primitive region, and the USB orientation is obtained based on the calculation result and the orientation direction of the USB. Based on the hole / slot recognition primitive region and the structure recognition primitive region, a difference operation is performed on the USB image to obtain a difference image. Based on the difference image, the calculation result, and the image coefficients of the USB image, the angle adjustment amount between the USB and the socket to be plugged in is calculated, and the USB is plugged into the socket according to the angle adjustment amount. This solves the problem that related technologies are difficult to use for pose detection of USB cable connectors, and can achieve effective pose detection of USB cable connectors. It has the advantages of high detection accuracy, high detection reliability, strong robustness to image quality, and strong reusability.

[0049] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0050] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0051] Figure 1 This is a flowchart of an automatic mating method for a USB connector according to an embodiment of this application;

[0052] Figure 2 This is a schematic diagram of a robot USB connector platform provided according to an embodiment of this application;

[0053] Figure 3 This is a schematic diagram of a USB connector according to an embodiment of this application;

[0054] Figure 4 This is a schematic diagram of the actual region center and the identified region center according to an embodiment of this application;

[0055] Figure 5 This is a schematic diagram of the center of an erroneous extraction region according to an embodiment of this application;

[0056] Figure 6 This is a schematic diagram showing the spatial distribution of pixel features of primitives and background under different brightness levels according to an embodiment of this application;

[0057] Figure 7 This is a histogram of the grayscale distribution of the hole and slot recognition primitive region and the structure recognition primitive region in a typical image provided according to an embodiment of this application;

[0058] Figure 8 This is a schematic diagram of the accumulated projection area and projection edge line of a USB cable connector according to an embodiment of this application;

[0059] Figure 9 This is a flowchart of an automatic mating method for a USB connector according to an embodiment of this application;

[0060] Figure 10 This is a schematic diagram of images captured under different lighting conditions and the algorithm detection results according to an embodiment of this application;

[0061] Figure 11 This is a schematic diagram illustrating the principle of an automatic insertion method for a USB connector according to an embodiment of this application;

[0062] Figure 12 This is a block diagram of an automatic mating device for a USB connector according to an embodiment of this application;

[0063] Figure 13This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0064] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0065] Before introducing the automatic insertion method of the USB connector according to the embodiments of this application, let's first introduce the image-based target detection method.

[0066] Image-based object detection methods are mainly divided into two categories: traditional image processing methods and neural network-based methods. Traditional image processing methods include feature operator-based estimation methods, template matching methods, and threshold segmentation-based morphological analysis methods. These methods offer high accuracy but typically require auxiliary labeling and are suitable for simple scenes with designed contrast and homogeneous objects. Neural network-based methods are more robust and adaptable to images and environments, but model training is time-consuming, accuracy is limited by dataset completeness, and accuracy is generally lower.

[0067] USB cables have important applications in industry. Developing an automated USB cable splicing and assembly system and using robots for splicing operations is also of great application value for building an automated cable operating system.

[0068] The detection methods in related technologies are difficult to apply to USB cable connections that are not terminal types and are difficult to capture in their pre-insertion state. Addressing the problems in related technology research, proposing a robust and adaptive USB cable connector detection algorithm is valuable. This application's embodiments achieve effective detection and algorithm adaptation to shooting and lighting environments through detection framework construction, feature analysis, and robust algorithm design. It can effectively detect the pose of USB cable connectors and has advantages such as high detection accuracy, high detection reliability, strong robustness to image quality, and strong reusability.

[0069] Specifically, Figure 1 This is a flowchart illustrating an automatic insertion method for a USB connector provided in an embodiment of this application.

[0070] like Figure 1 As shown, the automatic mating method for this USB connector includes the following steps:

[0071] In step S101, a Universal Serial Bus (USB) image containing the central region is obtained.

[0072] Specifically, such as Figure 2 As shown, this embodiment of the application can use a rotatable industrial camera and an industrial robot to build a cable plugging operation platform, move the robot holding the USB cable to the shooting position, adjust the camera angle to shoot the original image, and obtain a USB image containing the central area.

[0073] In step S102, the USB image is globally binarized, and the slot recognition primitive region and the structure recognition primitive region are obtained based on the processed USB image. The center of the slot recognition primitive region and the center of the structure recognition primitive region are calculated, and the orientation direction of the USB is obtained based on the center of the slot recognition primitive region and the center of the structure recognition primitive region.

[0074] Specifically, considering the system's versatility and portability, this application embodiment uses an industrial array camera to achieve clear acquisition of the original image. For example... Figure 3 As shown, in pose detection research, a USB can be divided into an outer shell and a central region. Different USB shells can have different geometries, sizes, and colors, while the central region has a standard geometry and size. Within the central region, two types of recognition primitives can be defined based on internal structural characteristics: slot / hole recognition primitives and structural recognition primitives.

[0075] As can be seen from the USB size standard, the slot and hole recognition primitives and the structure recognition primitives are heterogeneous recognition primitives. Therefore, theoretically, the pose of the USB can be directly determined from the state of the recognition primitives. This process is as follows: Figure 3 As shown in the figure, C0 is the center of the hole and slot recognition primitive region Ar0, and C1 is the center of the structure recognition primitive region Ar1. The above calculation process is as follows, where the USB orientation is defined by the identification primitive:

[0076]

[0077]

[0078] Where, x i x j S0 and S1 are the pixel coordinates of points belonging to regions Ar0 and Ar1, respectively; S0 and S1 are the areas of Ar0 and Ar1, respectively.

[0079] Therefore, the calculation process of the basic pose detection algorithm (Algorithm 1) for USB is as follows:

[0080] (1) Obtain a USB image Img0 containing the central region;

[0081] (2) Global binarization is performed on Img0, and the hole and slot identification primitive region Ar0 and the structure identification primitive region Ar1 are obtained according to the structural size and the connected domain analysis results.

[0082] (3) Calculate the regional centers C0 and C1 of the slot and structure, as well as the orientation direction of the USB, from Ar0 and Ar1.

[0083] (4) Based on image coefficients I coff Calculate the control adjustment amount so that C0, C1, It is consistent with the corresponding socket calculation.

[0084] The above algorithm can theoretically detect USB status from images, but in practical applications, it suffers from the following problems: Due to the structural characteristics of USB (the slots and holes have certain internal structures and do not have significant complete boundaries in the image) and limitations imposed by actual shooting conditions and image quality, it is difficult to perfectly extract the recognition primitives from the image. This makes the extracted recognition primitives potentially have issues such as... Figure 4 The extraction errors shown include structural incompleteness and the inclusion of surrounding pixels.

[0085] If we denote the error region in the extracted region as ΔAr, then {y i Let} be the set of markers indicating the error region ΔAr, defined as follows: when x i ∈ΔAr, x i When ∈Ar, y i =-1, when x i ∈ΔAr, At that time, y i =1. Therefore, the area of ​​the error region can be expressed as:

[0086]

[0087] Algorithm 1 will produce the following center detection error:

[0088]

[0089] Where ΔC is the error at the center of the region; C o C is the center of the actual primitive region; C′ is the center of the error region.

[0090] It can be seen that the smaller the absolute value of the error region area, the closer the center of the error region is to the center of the actual region, and the smaller the center detection error. Furthermore, the generated position control error ΔT at this time is:

[0091]

[0092] Where ΔC0 and ΔC1 represent the regional center errors of the holes and slots and the structure, respectively. Due to averaging, and because the image coefficients I are typically small in use... coff This makes the location error insensitive to the error in region extraction.

[0093] The resulting attitude detection error is as follows:

[0094]

[0095]

[0096] It is evident that the uncertainty of attitude detection in the algorithm is the sum of the uncertainty of center detection, which amplifies the error and uncertainty of attitude detection and makes the attitude error more sensitive to the region extraction error.

[0097] Optionally, in some embodiments, obtaining the slot and hole recognition primitive region and the structure recognition primitive region based on the processed USB image includes: inputting the processed USB image into a preset adaptive classifier to generate the slot and hole recognition primitive region and the structure recognition primitive region.

[0098] Optionally, in some embodiments, before inputting the processed USB image into a preset adaptive classifier, the method further includes: acquiring training images under different lighting conditions, and performing thresholding on the training images to generate multiple training datasets; performing Support Vector Machine (SVM) learning on the training images in each training dataset to generate a target function set; performing linear regression on the target function set based on the feature mean of the training images to generate an adaptive projection function; generating multiple target boundary functions based on the adaptive projection function, and performing linear regression on the multiple target boundary functions based on the feature mean to obtain multiple adaptive boundary functions.

[0099] Specifically, in practical applications, due to the influence of lighting and shooting conditions, the fixed threshold segmentation method may produce results such as... Figure 5 The extraction error is shown. Due to insufficient difference between the target hole / groove primitives and structural primitives and the surrounding background area, as well as the reflection from the metal parts, methods such as automatic brightness adjustment and white balance of the camera, image brightness calibration, and supplementary lighting cannot adapt to a wide range of lighting conditions under a single threshold. Therefore, this module designs an adaptive primitive semantic segmentation method to improve the adaptability of the detection algorithm to lighting and environment.

[0100] The basic idea of ​​the algorithm is to construct an adaptive classifier using regional pixel features and global features as inputs to identify primitive regions in an image. Since illumination is the main adaptive variable in this problem, we first convert the original RGB image to the Lab color space, using the Lab values ​​of pixels as basic feature inputs to adjust and balance color levels and brightness separately.

[0101] The spatial distribution of pixel features of primitives and background under different brightness levels is as follows: Figure 6 As shown, for the three classification problems illustrated, the following confusion ratio function is defined:

[0102]

[0103] sty i =1, y k =-1

[0104] ||x i -x k ||≤ε

[0105] Among them, {y i =1, -1} is the set of labels for the region category to which the pixel belongs; ε is the small relaxation threshold.

[0106] In the above three classification problems, K miss The fact that the percentages are all greater than 60% indicates that for any given pattern recognition problem, more than 60% of the data features in one pattern class are identical to those in another pattern class. Therefore, global pattern recognition is an unrecognizable problem. This also underscores the necessity of algorithmic adaptation and the use of global features.

[0107] From the distribution of primitive characteristics under specific environments, it can be seen that (e.g.) Figure 7 As shown), the primitive extraction problem under specific conditions is a learnable problem and can be transformed into the following Support Vector Machine (SVM) form:

[0108]

[0109] sty i [W T f(x i )+b]≥1-ξ i

[0110] ξ i ≥0;

[0111] Among them, w T f(x i f(x) + b is the optimal interface judgment function;i ) represents the kernel function; for ease of subsequent adaptive regression, a linear kernel is chosen here; C∈R + As a penalty factor; ξ i The sample was misclassified.

[0112] The function for classifying primitives is as follows:

[0113]

[0114]

[0115] Among them, w T f(x i )+b 11 w T f(x i )+b 21 These are the interfaces formed by the support vectors belonging to this class; w T f(x i )+b 12 w T f(x i )+b 22 The interfaces formed by the boundary points belonging to this class are respectively, and the solution process is as follows:

[0116]

[0117] Therefore, the adaptive semantic segmentation problem of primitives can be constructed as a regression problem of the functional parameters of the primitive segmentation interface under different shooting environments. The adaptive process is achieved by using the global information I of the image. g The following five adaptive functions were obtained respectively:

[0118] w = g1(I g ), b 11 =g2(I g ), b 12 =g3(I g ), b 21 =g4(I g ), b 22 =g5(I g );

[0119] The learning process of the adaptive function is as follows:

[0120] (1) Manually threshold the image recognition primitives under different lighting conditions to generate a dataset for training;

[0121] (2) Perform SVM training on each image based on the training set to obtain the corresponding {w T};

[0122] (3) Using the feature mean of the image (e.g., average brightness) is the input, for {w T Perform linear regression to obtain the adaptive projection function g1;

[0123] (4) Generate the boundary functions {b} based on .g1. 11 b 12 b 21 b 22};

[0124] (5) Using the characteristic mean For {b 11 b 12 b 21 b 22 Perform linear regression on each function to obtain adaptive boundary functions g2, g3, g4, and g5.

[0125] The results were tested, and the p-values ​​of the above linear regression models were all less than 0.001, so the linear regression of this problem is reliable.

[0126] Optionally, in some embodiments, before performing global binarization on the USB image, the method further includes preprocessing the USB image based on a preset preprocessing strategy.

[0127] Specifically, to improve the stability of the algorithm and ensure uniform transformation of the image at the boundary between bright and dark areas, the input image was preprocessed using the following minmax linear calibration. The preset preprocessing strategy is as follows:

[0128]

[0129] in, Here, x represents the feature components after pixel calibration, and x represents the original feature components of the pixel. 0.05 x is the 0.05 quantile of the corresponding feature component of the image. 0.95 x is the 0.95 quantile of the corresponding feature components of the image. 0.05 (ref) represents the 0.05 quantile of the corresponding feature component in the reference image, x 0.95 (ref) represents the 0.95 quantile of the corresponding feature component in the reference image.

[0130] Optionally, in some embodiments, after obtaining the slot recognition primitive region and the structure recognition primitive region based on the processed USB image, the method further includes: determining whether both the slot recognition primitive region and the structure recognition primitive region meet preset detection conditions; if the slot recognition primitive region or the structure recognition primitive region does not meet the preset detection conditions, initializing the recognition thresholds of the slot recognition primitive region and the structure recognition primitive region; inputting the recognition thresholds into a preset discriminant function to obtain the output result, dividing the recognition region of the output result, and performing morphological calculations based on the recognition region to generate morphological calculation results; updating the recognition thresholds according to the morphological calculation results until the morphological calculation results meet the recognition requirements.

[0131] The preset detection condition can be to extract the correct recognition primitives, and no specific limitation is made here.

[0132] Specifically, the aforementioned adaptive algorithm can adapt to most environments; however, due to the mean of image features... Imperfect global image representation and errors in linear regression can lead to the inability to extract correct recognition primitives in some extreme cases. To address this, we propose the following heuristic search algorithm to adapt to such situations.

[0133] (1) Initialize the recognition threshold of the primitive b = b0;

[0134] (2) Based on the discriminant function w T f(x i The output of )+b is used to divide the recognition region and perform morphological calculations.

[0135] (3) Update the threshold based on morphological calculation results;

[0136] (4) Repeat the calculation with the new threshold until the morphological calculation result meets the primitive recognition requirements.

[0137] The initial value for the threshold search in the algorithm uses the following fuzzy algorithm based on membership functions:

[0138]

[0139]

[0140] Where, θ∈R m is a fuzzy set of reference thresholds under different shooting environments, where m is the number of reference sample images used; The corresponding membership function vectors are given, and the membership functions take the following Gaussian and exponential function forms:

[0141]

[0142]

[0143] Among them, a i b i The shape parameter is the corresponding membership function.

[0144] The threshold update process is as follows:

[0145]

[0146] b′=b-kΔb;

[0147] Where b and b′ are the thresholds before and after the update, respectively; A1 and A0 are the area of ​​the region extracted during morphological analysis and the area of ​​the reference primitive region, respectively; sgn() is the sign function, and the initial sign is determined according to the relationship between the threshold and the area change of the region under the criterion. The principle is that a positive Δb will produce a positive area change ΔA; a∈R + is a normal coefficient; k is the basic search step size, which is 0.1 here.

[0148] In step S103, principal component analysis (PCA) is performed on the structural recognition primitive region, and the USB posture is obtained based on the calculation result and the USB posture direction. Based on the slot recognition primitive region and the structural recognition primitive region, the difference operation is performed on the USB image to obtain the difference image. The angle adjustment amount between the USB and the socket to be plugged in is calculated based on the difference image, the calculation result and the image coefficients of the USB image. The USB is then plugged into the socket to be plugged in according to the angle adjustment amount.

[0149] Specifically, Algorithm 1 in step S102 has the following two main problems: 1. It is difficult to obtain complete recognition primitives; 2. The pose detection method is quite sensitive to errors in region extraction. Therefore, this section will analyze the recognition primitives from the perspectives of statistics and regional bandwidth, and use robust recognition primitives and features to achieve effective detection of USB status.

[0150] Traditional thresholding methods define the category of a point based on the features of the pixel and its neighborhood. Therefore, when the features of pixels within a region are more concentrated in space and farther away from the features of other regions, that region is easier to extract correctly. In other words, a robust recognition primitive should have the following characteristics: pixels within the primitive region have a more concentrated and isolated distribution in the feature space.

[0151] When the feature space is selected as grayscale space, the region bandwidth Ar is defined as follows. bw :

[0152]

[0153] Among them, Ar 0.05 (i), Ar 0.95(i) represent the 0.05 and 0.95 gray-level quantiles of region i, respectively; Ar 0.05 Ar 0.95 These are the 0.05 and 0.95 gray-level quantiles for the entire image region, respectively. Here, the p-quantile definition is used.

[0154] In statistics, kurtosis is a statistic commonly used to describe the number of kurtotic features of a distribution at the mean. The following method is used to calculate kurtosis for unbiased samples:

[0155]

[0156]

[0157] Where Kurt0 is the unbiased sample kurtosis; n is the number of samples; These are the sample values ​​and their means, respectively. Under the definition in the above formula, the lower limit of kurtosis is 1, the kurtosis of the standard normal distribution is 3, and the kurtosis of the uniform distribution is 1.8. Under the same standard deviation, a larger kurtosis indicates that the shape of the distribution is more pointed and steep.

[0158] Therefore, the image region of a robust recognition primitive should have a smaller regional bandwidth. bw Smaller sample standard deviation σ and larger sample kurtosis Kurt0.

[0159] Figure 7 The gray-level distribution histograms of the hole and slot recognition primitive region Ar0 and the structure recognition primitive region Ar1 in a typical image are given. Table 1 shows the corresponding statistical indicators of the normalized gray-level values ​​of the pixels in the regions. The calculation results show that for... Figure 4 For the USB object shown, the extraction of structural identification primitives is more robust and accurate than the extraction of hole and slot identification primitives. Therefore, the detection algorithm should make more use of the information of structural identification primitives to improve the accuracy and robustness of the algorithm.

[0160] Table 1 shows the calculation results of statistical indicators for different regions.

[0161] Table 1

[0162]

[0163]

[0164] When the original feature space is chosen to be a high-dimensional space, the relevant indices in the reduced-dimensional feature space and the concentration parameter κ in the fitted von Mises-Fisher distribution are used for evaluation. The probability distribution function is as follows:

[0165] fp (x|μ,κ)=C p (κ)exp(κμ T x);

[0166] Among them, C p (κ) is a normalized constant generated by the modified Bessel function.

[0167] The aforementioned hole and slot recognition primitives can both be orientationally described using the orthogonal major and minor axes of the image region. This problem is equivalent to projecting the image region data and finding and retaining the projection directions with the maximum and minimum information content. This is the physical meaning of principal components in high-dimensional data, which can be effectively solved using Principal Component Analysis (PCA) and the Singular Value Decomposition (SVD) algorithm.

[0168]

[0169]

[0170] Among them, S cov To analyze the covariance matrix of the data; λ i v i For S cov The eigenvalues ​​and their corresponding eigenvectors are arranged from largest to smallest; d represents the original dimension of each data point; k represents the dimension of the data after dimensionality reduction. For this problem, k = d = 2, where v1 and v2 correspond to the major and minor axes of the recognition primitives, respectively.

[0171] Similarly, the orientation of the USB is defined by the identification primitive. The calculation process is as follows:

[0172]

[0173]

[0174] The detection of the normal deflection angle utilizes the accumulation and contraction properties of the central region projection; the basic idea is as follows: Figure 8 As shown, the normal deflection angle is detected by utilizing the distance between the edge lines of the region projection:

[0175] θ 1,2 =sin -1 (I coff ·dp 1,2 / L 1,2 );

[0176] Where, θ 1,2 These are the normal deflection angles relative to the major and minor axes, respectively; dp1,2 These represent the distances between the projection edge lines; L 1,2 This refers to the actual dimensions of the corresponding structure.

[0177] In summary, the calculation process of the robust USB posture detection algorithm (Algorithm 2) is as follows:

[0178] (1) Obtain a USB image Img0 containing the central region;

[0179] (2) Global binarization is performed on Img0, and the hole and slot identification primitive region Ar0 and the structure identification primitive region Ar1 are obtained according to the structural size and the connected domain analysis results.

[0180] (3) Calculate the regional centers C0 and C1 of the slot and structure, as well as the rough orientation of the USB, from Ar0 and Ar1.

[0181] (4) Perform PCA calculation on Ar1 to obtain the major and minor axis directions v1 and v2. Based on the PCA results and Calculate USB posture

[0182] (5) Perform difference operation on Img0 through Ar0 and Ar1, extract the accumulation projection region of the difference image, extract the projection edge line and calculate the distance in the directions of v1 and v2, and calculate the normal deflection in sequence.

[0183] (6) Based on image coefficients I coff Calculate the control adjustment amount so that the adjusted θ 1,2 ′=0,C1, It is consistent with the corresponding socket calculation.

[0184] Analyzing the error of Algorithm 2, the generated position control error ΔT is:

[0185] ΔT1=I coff ΔC1;

[0186] The covariance matrix of the image region at this time is:

[0187]

[0188] in:

[0189]

[0190]

[0191] The identification error Δθ of the normal deflection angle and the minimum resolvable angle θ0 are:

[0192]

[0193] θ0=sin -1 (I coff ·dp0 / L 1,2 );

[0194] Where Δdp is the calculation error of the distance between the projected edge lines; dp0 is the image boundary width of the confused projected edge lines in the recognition, which depends on the camera resolution and shooting distance, and is generally no more than 10 pixels.

[0195] Since the error of the above algorithm mainly comes from the robust recognition primitives, it has smaller variance and uncertainty, and therefore has smaller attitude detection error and uncertainty.

[0196] In summary, the complete primitive illumination adaptive semantic segmentation algorithm flow is as follows: Figure 9 As shown. It should be noted that SVM-based adaptive discrimination can complete the identification and extraction of primitives in most cases. The heuristic search described above is only used when SVM identification fails, in order to improve the applicability and reliability of the algorithm.

[0197] Combining the above-mentioned primitive illumination adaptive semantic segmentation algorithm and pose detection algorithm, a complete adaptive USB pose detection algorithm (Principal Component based Adaptive Estimation, PCAE) can be obtained.

[0198] A complete robot USB plug-in system, such as Figure 2 As shown, to ensure reliable clamping, the gripping finger structure adopts a shape-mimicking design similar to a USB port. Images captured under different lighting conditions and algorithm detection results are shown below. Figure 10 As shown, the average absolute errors of the PCAE algorithm are 0.46 deg and 1.33 pixels, respectively. These results demonstrate that the proposed algorithm can achieve high-precision, adaptive, and fast detection of USB status within a wide range of illumination changes (average normalized grayscale 0.057–0.858). The detection results exhibit strong robustness and stability. Based on the proposed connector detection algorithm and robot insertion control method, 100% success rate automated USB insertion operations can be achieved.

[0199] It should be noted that this application uses a USB object as an example to describe a method for pose detection and insertion of a cable connector with directed recognition primitives represented by long rectangles. The algorithm input is an image captured by an industrial camera and connector structural parameters, and the output is the pose detection result of the plug and the corresponding robot action. Through methods such as... Figure 11The aforementioned steps, including detection framework construction, feature analysis, and robust algorithm design, enable effective detection and adapt the algorithm to shooting and lighting environments. This achieves effective detection of the pose of USB cable connectors, offering advantages such as high detection accuracy, high reliability, strong robustness to image quality, and high reusability.

[0200] The automatic insertion method for USB connectors proposed in this application involves acquiring a Universal Serial Bus (USB) image containing a central region, performing global binarization on the USB image, and obtaining slot and structure recognition primitive regions from the processed USB image. The center of the slot and structure regions in the slot and structure recognition primitive regions is calculated, and the USB's orientation is determined based on these centers. Principal Component Analysis (PCA) is performed on the structure recognition primitive regions, and the USB's orientation is obtained based on the calculation results and the USB's orientation. A difference operation is performed on the USB image based on the slot and structure recognition primitive regions to obtain a difference image. The angle adjustment between the USB and the socket to be inserted is calculated based on the difference image, the calculation results, and the image coefficients of the USB image. The USB is then inserted into the socket based on the angle adjustment. This method solves the problem that related technologies are difficult to apply to pose detection of USB cable connectors, enabling effective pose detection of USB cable connectors. It offers advantages such as high detection accuracy, high detection reliability, strong robustness to image quality, and high reusability.

[0201] Next, referring to the accompanying drawings, an automatic mating device for a USB connector according to an embodiment of this application is described.

[0202] Figure 12 This is a block diagram of an automatic insertion device for a USB connector according to an embodiment of this application.

[0203] like Figure 12 As shown, the automatic mating device 10 for the USB connector includes: an acquisition module 100, a processing module 200, and a mating module 300.

[0204] The acquisition module 100 is used to acquire a Universal Serial Bus (USB) image containing the central region.

[0205] The processing module 200 is used to perform global binarization processing on the USB image, and obtain the hole and slot recognition primitive region and the structure recognition primitive region based on the processed USB image. It also calculates the center of the hole and slot recognition primitive region and the center of the structure recognition primitive region, and obtains the orientation direction of the USB based on the center of the hole and slot region and the center of the structure region.

[0206] The plug-in module 300 is used to perform principal component analysis (PCA) on the structural recognition primitive region, obtain the USB posture based on the calculation result and the USB posture direction, perform difference operation on the USB image based on the slot recognition primitive region and the structural recognition primitive region to obtain the difference image, calculate the angle adjustment amount between the USB and the socket to be plugged in based on the difference image, the calculation result and the image coefficients of the USB image, and plug the USB into the socket to be plugged in based on the angle adjustment amount.

[0207] Optionally, in some embodiments, the processing module 200 includes an input unit.

[0208] The input unit is used to input the processed USB image into a preset adaptive classifier to generate hole and slot recognition primitive regions and structure recognition primitive regions.

[0209] Optionally, in some embodiments, before inputting the processed USB image to a preset adaptive classifier, the input unit further includes: an acquisition subunit, an SVM learning subunit, a linear regression subunit, and a generation subunit.

[0210] The acquisition sub-unit is used to acquire training images under different lighting conditions, and to perform thresholding on the training images to generate multiple training datasets.

[0211] The SVM learning subunit is used to perform Support Vector Machine (SVM) learning on the training images in each training dataset to generate a set of objective functions.

[0212] The linear regression subunit performs linear regression on the target function set based on the feature mean of the image to be trained, generating an adaptive projection function.

[0213] The generation sub-unit is used to generate multiple target boundary functions based on the adaptive projection function. Linear regression is then performed on the multiple target boundary functions based on the feature mean to obtain multiple adaptive boundary functions.

[0214] Optionally, in some embodiments, after obtaining the slot and hole recognition primitive region and the structure recognition primitive region based on the processed USB image, the processing module 200 is further configured to: determine whether both the slot and hole recognition primitive region and the structure recognition primitive region meet preset detection conditions; if the slot and hole recognition primitive region or the structure recognition primitive region does not meet the preset detection conditions, initialize the recognition threshold of the slot and hole recognition primitive region and the structure recognition primitive region; input the recognition threshold to a preset discriminant function to obtain the output result, divide the recognition region of the output result, and perform morphological calculation based on the recognition region to generate morphological calculation results; update the recognition threshold according to the morphological calculation results until the morphological calculation results meet the recognition requirements.

[0215] Optionally, in some embodiments, before performing global binarization on the USB image, the processing module is further configured to: preprocess the USB image based on a preset preprocessing strategy, wherein the preset preprocessing strategy is:

[0216]

[0217] in, Here, x represents the feature components after pixel calibration, and x represents the original feature components of the pixel. 0.05 x is the 0.05 quantile of the corresponding feature component of the image. 0.95 x is the 0.95 quantile of the corresponding feature components of the image. 0.05 (ref) represents the 0.05 quantile of the corresponding feature component in the reference image, x 0.95 (ref) represents the 0.95 quantile of the corresponding feature component in the reference image.

[0218] It should be noted that the foregoing explanation of the automatic mating method embodiment for USB connectors also applies to the automatic mating device for USB connectors in this embodiment, and will not be repeated here.

[0219] The automatic insertion device for USB connectors proposed in this application acquires a Universal Serial Bus (USB) image containing a central region, performs global binarization on the USB image, and obtains a slot / hole recognition primitive region and a structure recognition primitive region from the processed USB image. It calculates the center of the slot / hole recognition primitive region and the center of the structure region in the structure recognition primitive region, and obtains the USB's orientation based on these centers. Principal Component Analysis (PCA) is performed on the structure recognition primitive region, and the USB's orientation is obtained based on the calculation result and the USB's orientation. A difference operation is performed on the USB image based on the slot / hole recognition primitive region and the structure recognition primitive region to obtain a difference image. The angle adjustment between the USB and the socket to be inserted is calculated based on the difference image, the calculation result, and the image coefficients of the USB image. The USB is then inserted into the socket according to the angle adjustment. This solves the problem that related technologies are difficult to use for pose detection of USB cable connectors, enabling effective pose detection of USB cable connectors. It has advantages such as high detection accuracy, high detection reliability, strong robustness to image quality, and strong reusability.

[0220] Figure 13 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include:

[0221] The memory 1301, the processor 1302, and the computer program stored on the memory 1301 and executable on the processor 1302.

[0222] When the processor 1302 executes the program, it implements the automatic plugging method for USB connectors provided in the above embodiments.

[0223] Furthermore, electronic devices also include:

[0224] Communication interface 1303 is used for communication between memory 1301 and processor 1302.

[0225] The memory 1301 is used to store computer programs that can run on the processor 1302.

[0226] The memory 1301 may include high-speed RAM (Random Access Memory) memory, and may also include non-volatile memory, such as at least one disk storage.

[0227] If the memory 1301, processor 1302, and communication interface 1303 are implemented independently, then the communication interface 1303, memory 1301, and processor 1302 can be interconnected via a bus to complete communication between them. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 13 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0228] Optionally, in a specific implementation, if the memory 1301, processor 1302, and communication interface 1303 are integrated on a single chip, then the memory 1301, processor 1302, and communication interface 1303 can communicate with each other through an internal interface.

[0229] Processor 402 may be a CPU (Central Processing Unit), an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of this application.

[0230] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described automatic plugging method for USB-type connectors.

[0231] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0232] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0233] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0234] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or more of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (FPGAs), field-programmable gate arrays (FPGAs), etc.

[0235] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0236] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. An automatic insertion method for a USB connector, characterized in that, Includes the following steps: Obtain a Universal Serial Bus (USB) image containing the central area. ; The USB image is subjected to global binarization, and the slot recognition primitive region and the structure recognition primitive region are obtained from the processed USB image. The center of the slot recognition primitive region and the center of the structure recognition primitive region are calculated, and the orientation direction of the USB is obtained from the center of the slot region and the center of the structure region. Principal component analysis (PCA) was performed on the structural identification primitive region to obtain the major and minor axis directions. , The USB orientation is obtained based on the calculation results and the orientation direction of the USB. Based on the hole and slot identification primitive region and the structure identification primitive region, the... Perform a difference operation to obtain a difference image, then extract the convergent projection region from the difference image, and so on. , The projection edge line is extracted and the distance is calculated in the direction, and the normal deflection angle is calculated in sequence. According to the image coefficients of the USB image, the control adjustment amount is calculated so that the normal deflection angle relative to the major axis and minor axis is 0. The structure region center of the structure recognition primitive region, the USB posture and the corresponding socket calculation amount are consistent, and the USB is plugged into the socket to be plugged in according to the control adjustment amount.

2. The method according to claim 1, characterized in that, The step of obtaining the slot recognition primitive region and the structure recognition primitive region based on the processed USB image includes: The processed USB image is input into a preset adaptive classifier to generate the hole and slot recognition primitive region and the structure recognition primitive region.

3. The method according to claim 2, characterized in that, Before inputting the processed USB image into the preset adaptive classifier, the method further includes: Acquire training images under different lighting conditions, and perform thresholding on the training images to generate multiple training datasets; For each training image in the training dataset, a support vector machine (SVM) is used to learn the objective function set. Based on the feature mean of the image to be trained, linear regression is performed on the target function set to generate an adaptive projection function; Multiple target boundary functions are generated based on the adaptive projection function, and linear regression is performed on the multiple target boundary functions based on the feature mean to obtain multiple adaptive boundary functions.

4. The method according to claim 1, characterized in that, After obtaining the slot recognition primitive region and the structure recognition primitive region based on the processed USB image, the method further includes: Determine whether both the hole and slot identification element region and the structure identification element region meet the preset detection conditions; If the slot identification element region or the structure identification element region does not meet the preset detection conditions, then the identification threshold of the slot identification element region and the structure identification element region is initialized. The recognition threshold is input into a preset discriminant function to obtain the output result, and the recognition region of the output result is divided. Morphological calculations are then performed based on the recognition region to generate morphological calculation results. The recognition threshold is updated based on the morphological calculation results until the morphological calculation results meet the recognition requirements.

5. The method according to claim 1, characterized in that, Before performing global binarization on the USB image, the process also includes: The USB image is preprocessed based on a preset preprocessing strategy, wherein the preset preprocessing strategy is: ; in, For the feature components after pixel calibration, These are the original feature components of the pixel. The 0.05 quantile of the corresponding feature components of the image. This represents the 0.95 quantile of the corresponding feature components in the image. The 0.05 quantile of the corresponding feature component in the reference image. It is the 0.95 quantile of the corresponding feature component of the reference image.

6. An automatic mating device for a USB connector, characterized in that, include: The acquisition module is used to acquire a Universal Serial Bus (USB) image containing the central area. ; The processing module is used to perform global binarization processing on the USB image, and obtain the slot recognition primitive region and the structure recognition primitive region based on the processed USB image, and calculate the center of the slot recognition primitive region and the center of the structure recognition primitive region, and obtain the orientation direction of the USB based on the center of the slot region and the center of the structure region. The plug-in module is used to perform principal component analysis (PCA) on the structural identification primitive region to obtain the major and minor axis directions. , The USB orientation is obtained based on the calculation results and the orientation direction of the USB. Based on the hole and slot identification primitive region and the structure identification primitive region, the... Perform a difference operation to obtain a difference image, then extract the convergent projection region from the difference image, and so on. , The projection edge line is extracted and the distance is calculated in the direction, and the normal deflection angle is calculated in sequence. According to the image coefficients of the USB image, the control adjustment amount is calculated so that the normal deflection angle relative to the major axis and minor axis is 0. The structure region center of the structure recognition primitive region, the USB posture and the corresponding socket calculation amount are consistent, and the USB is plugged into the socket to be plugged in according to the control adjustment amount.

7. The apparatus according to claim 6, characterized in that, The processing module includes: The input unit is used to input the processed USB image into a preset adaptive classifier to generate the hole and slot recognition primitive region and the structure recognition primitive region.

8. The apparatus according to claim 7, characterized in that, Before inputting the processed USB image into the preset adaptive classifier, the input unit further includes: The acquisition subunit is used to acquire training images under different lighting conditions, and to perform thresholding on the training images to generate multiple training datasets. The SVM learning subunit is used to perform support vector machine (SVM) learning on the training images in each training dataset to generate a set of objective functions. The linear regression subunit performs linear regression on the target function set based on the feature mean of the image to be trained, and generates an adaptive projection function; A sub-unit is generated to generate multiple target boundary functions based on the adaptive projection function, and to perform linear regression on the multiple target boundary functions based on the feature mean to obtain multiple adaptive boundary functions.

9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the automatic insertion method for a USB connector as described in any one of claims 1-5.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the automatic mating method for USB type connectors as described in any one of claims 1-5.