Socket testing methods, devices, computer equipment and storage media

By using machine learning algorithms and lightweight detection networks to locate and detect defects in 86-type sockets, the problem of high cost and low efficiency of manual inspection is solved, realizing automated socket inspection and improving inspection efficiency and accuracy.

CN116188374BActive Publication Date: 2026-06-02SEARI ELECTRIC TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SEARI ELECTRIC TECH CO LTD
Filing Date
2022-12-23
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In the existing technology, defect detection in the flexible intelligent production process of the 86-type socket relies on manual inspection, resulting in high labor costs and low efficiency.

Method used

Machine learning algorithms are used to locate and detect defects in socket images through trained localization and defect detection models, including intermediate detection models trained with multiple parameter strategies and the best-performing target detection model. Lightweight detection networks such as PP-PicoDet and MobileNetv3 are combined to achieve automated detection.

Benefits of technology

It automates socket inspection, reduces labor costs, improves inspection efficiency and accuracy, can identify defects that traditional algorithms cannot identify, and improves the completeness of inspection and model performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116188374B_ABST
    Figure CN116188374B_ABST
Patent Text Reader

Abstract

This invention provides a socket detection method, apparatus, computer device, and storage medium. The method includes: acquiring an initial socket image to be detected; inputting the initial socket image into a trained localization detection model for localization detection to obtain the position information of the socket in the initial socket image; further training the trained localization detection model by using a target intermediate localization detection model trained based on multiple pre-configured parameter strategies; extracting regions from the initial socket image based on the socket's position information to obtain a target socket image; and inputting the target socket image into a trained defect detection model for defect detection to obtain the defect detection result of the socket. This achieves automatic detection, reduces labor costs, and improves detection efficiency. Furthermore, the use of multiple parameter strategies for training improves training completeness, training effect, and model performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of factory testing technology, specifically to a socket testing method, apparatus, computer equipment, and storage medium. Background Technology

[0002] For example, the 86-type socket is a square socket with a length and width of 86mm*86mm. The square shape has a more stable internal structure than the rectangular shape and is not easily deformed under the action of plugging and unplugging. The 86-type power socket does not require jumpers. Each socket is a "molded module" and generally has three holes: live wire, neutral wire, and ground wire. The 86-type socket is the most commonly used socket in engineering and home decoration in most parts of my country.

[0003] In the flexible and intelligent production process of the 86-type socket, defect detection is required for the LNE-level socket assembly unit. The detection includes checking for defects such as missing or incorrect L, N, and E copper parts, whether the copper parts are properly assembled, and whether the copper parts are bent. Therefore, screening out unqualified sockets to prevent them from entering the next process and the market is of paramount importance in the socket assembly process.

[0004] In existing technologies, manual inspection is usually used, but this method requires high labor costs and is also inefficient. Summary of the Invention

[0005] In view of the shortcomings of the prior art, the present invention provides a socket detection method, device, computer equipment and storage medium.

[0006] In one embodiment, the present invention provides a socket detection method, comprising:

[0007] Obtain the initial socket image to be detected;

[0008] The initial socket image is input into the trained localization detection model for localization detection to obtain the position information of the socket in the initial socket image; the trained localization detection model is further trained by the target intermediate localization detection model obtained by training intermediate localization detection models based on pre-configured multiple parameter strategies.

[0009] Based on the location information of the socket, the initial socket image is processed to extract the target socket image.

[0010] The target socket image is input into a trained defect detection model for defect detection, and the defect detection result of the socket is obtained; the defect detection result indicates whether there is a defect in the socket.

[0011] In one embodiment, before the step of inputting the initial socket image into the trained localization detection model for localization detection, the socket detection method further includes:

[0012] Obtain the first training sample set; train the initial localization and detection model based on the first training sample set and multiple pre-configured parameter strategies to obtain multiple intermediate localization and detection models; each intermediate localization and detection model corresponds to a parameter strategy; the parameter strategy includes the amount of data processed per run and the type of loss function;

[0013] Determine the evaluation indicators for each intermediate localization detection model;

[0014] Based on the evaluation indicators of each intermediate localization detection model, the target intermediate localization detection model is determined;

[0015] Based on the first training sample set, the target intermediate localization and detection model is further trained to obtain the trained localization and detection model.

[0016] In one embodiment, an initial localization detection model is trained based on a first training sample set and pre-configured multiple parameter strategies to obtain multiple intermediate localization detection models, including:

[0017] Based on the first training sample set, train the initial localization and detection model corresponding to each parameter strategy;

[0018] For each parameter strategy, the number of training iterations of the initial localization and detection model corresponding to that parameter strategy is obtained. When the number of training iterations reaches a preset threshold, the intermediate localization and detection model corresponding to that parameter strategy is obtained.

[0019] In one embodiment, the evaluation metrics include loss, accuracy, and recall; based on the evaluation metrics of each intermediate localization detection model, the target intermediate localization detection model is determined, including:

[0020] The model performance of each intermediate localization and detection model is determined based on the loss, accuracy, and recall of each model.

[0021] The intermediate localization detection model with the best model performance is determined as the target intermediate localization detection model.

[0022] In one embodiment, the first training sample set includes multiple first initial socket images and the labeled location information of the sockets in each first initial socket image; based on the first training sample set, the target intermediate localization detection model is further trained to obtain a trained localization detection model, including:

[0023] The images of each initial socket in the first training sample set are input into the target intermediate localization detection model for localization detection, so as to obtain the predicted position information of the socket in each initial socket image.

[0024] The first loss is determined based on the predicted and labeled location information of the sockets in each initial training socket image;

[0025] If the first loss satisfies the preset convergence condition, the trained localization and detection model is obtained.

[0026] In one embodiment, before the step of inputting the target socket image into a trained defect detection model for defect detection, the socket detection method further includes:

[0027] Obtain the trained localization and detection model and the second training sample set; the second training sample set includes multiple second training initial socket images and the labeled defect detection results of the sockets in each second training initial socket image;

[0028] The images of each initial socket in the second training sample set are input into the trained localization detection model for localization detection to obtain the position information of each initial socket image.

[0029] Based on the location information of each second initial socket image, region extraction is performed on each second initial socket image to obtain the target socket image of the socket in each second initial socket image;

[0030] The target socket image of each socket in the second initial training socket image is input into the initial defect detection model for defect detection, and the predicted defect detection result of each socket in the second initial training socket image is obtained.

[0031] The second loss is determined based on the predicted defect detection results and labeled defect detection results of the sockets in each of the initial socket images of the second training.

[0032] Based on the second loss, the initial defect detection model is trained to obtain the trained defect detection model.

[0033] In one embodiment, after the step of inputting the target socket image into a trained defect detection model for defect detection to obtain the defect detection result of the socket, the above socket detection method further includes:

[0034] In response to a correction command for a defect detection result, determine the target socket image corresponding to the correction command and the correction defect detection result of the socket corresponding to the target socket image;

[0035] Obtain the trained target defect detection model for defect detection on the image of the target socket to be corrected, and the predicted defect detection results of the socket corresponding to the image of the target socket to be corrected;

[0036] The third loss is determined based on the predicted defect detection results and the corrected defect detection results of the socket corresponding to the corrected target socket image;

[0037] Based on the third loss, the trained target defect detection model is incrementally trained to obtain the incrementally trained target defect detection model.

[0038] In a second aspect, in one embodiment, the present invention provides a socket detection device, comprising:

[0039] The image acquisition module is used to acquire the initial socket image to be detected;

[0040] The localization detection module is used to input the initial socket image into the trained localization detection model for localization detection to obtain the position information of the socket in the initial socket image; the trained localization detection model is further trained by the target intermediate localization detection model obtained by training intermediate localization detection models based on pre-configured multiple parameter strategies.

[0041] The image extraction module is used to extract regions from the initial socket image based on the socket's location information to obtain the target socket image.

[0042] The defect detection module is used to input the target socket image into a trained defect detection model for defect detection and obtain the defect detection result of the socket; the defect detection result indicates whether the socket has a defect.

[0043] Thirdly, in one embodiment, the present invention provides a computer device including a memory and a processor; the memory stores a computer program, and the processor is configured to run the computer program in the memory to perform the steps in the socket detection method of any of the above embodiments.

[0044] Fourthly, in one embodiment, the present invention provides a storage medium storing a computer program that is loaded by a processor to perform the steps in the socket detection method of any of the above embodiments.

[0045] Using the aforementioned socket detection method, apparatus, computer equipment, and storage medium, a trained localization detection model is first used to locate and detect the initial socket image to be detected, obtaining the position information of the socket in the initial socket image. Then, based on the position information, the initial socket image can be region extracted according to the socket area to obtain the target socket image that fits the socket. Finally, a trained defect detection model is used to detect defects in the target socket image, thereby obtaining the defect detection result. Using machine learning algorithms, variables that traditional algorithms cannot identify can be identified, achieving the purpose of automatic detection, reducing labor costs, and improving detection efficiency. In addition, multiple parameter strategies are used to train corresponding intermediate localization detection models, and training is continued based on the target intermediate localization detection model with the best performance to obtain a trained localization detection model, improving training completeness, training effect, and model performance. Attached Figure Description

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

[0047] Figure 1 This is a schematic diagram illustrating an application scenario of the socket detection method in one embodiment of the present invention;

[0048] Figure 2 This is a schematic flowchart of a socket detection method in one embodiment of the present invention;

[0049] Figures 3 to 5 These are schematic diagrams illustrating the position information output by different types of 86-type sockets during positioning detection in one embodiment of the present invention.

[0050] Figure 6 This is a schematic diagram of the socket detection device in one embodiment of the present invention;

[0051] Figure 7 This is a schematic diagram of the internal structure of a computer device according to one embodiment of the present invention. Detailed Implementation

[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0053] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. 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 indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified. In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to implement and use the invention. In the following description, details are set forth for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be implemented without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed herein.

[0054] The socket detection method in this embodiment of the invention is applied to a socket detection device, which is set in a computer device; the computer device can be a terminal, such as a mobile phone or a tablet computer, or it can be a server or a service cluster composed of multiple servers.

[0055] like Figure 1 As shown, Figure 1 This is a schematic diagram of an application scenario of the socket detection method according to an embodiment of the present invention. The application scenario of the socket detection method in this embodiment of the present invention includes a computer device 100 (the computer device 100 integrates a socket detection device), and a computer-readable storage medium corresponding to the socket detection method is run in the computer device 100 to execute the steps of the socket detection method.

[0056] Understandable Figure 1The computer equipment in the application scenario of the socket detection method shown, or the devices contained in the computer equipment, do not constitute a limitation on the embodiments of the present invention. That is, the number or type of equipment in the application scenario of the socket detection method, or the number or type of devices contained in each device, do not affect the overall implementation of the technical solution in the embodiments of the present invention, and can all be considered as equivalent substitutions or derivatives of the technical solutions claimed in the embodiments of the present invention.

[0057] In this embodiment of the invention, the computer device 100 can be an independent device, or a network of devices or a cluster of devices. For example, the computer device 100 described in this embodiment of the invention includes, but is not limited to, a computer, a network host, a single network device, a set of multiple network devices, or a cloud device composed of multiple devices. The cloud device consists of a large number of computers or network devices based on cloud computing.

[0058] Those skilled in the art will understand that Figure 1 The application scenarios shown are merely one example corresponding to the technical solution of this invention and do not constitute a limitation on the application scenarios of the technical solution of this invention. Other application scenarios may include more than one example. Figure 1 The more or fewer computer devices shown, or the network connections of the computer devices, for example Figure 1 Only one computer device is shown in the diagram. It is understood that the scenario of the socket detection method may also include one or more other computer devices, which are not limited here. The computer device 100 may also include a memory for storing information related to the socket detection method.

[0059] Furthermore, in the application scenario of the socket detection method in this embodiment of the invention, the computer device 100 may be equipped with a display device, or the computer device 100 may not have a display device but may be communicatively connected to an external display device 200. The display device 200 is used to output the results of the socket detection method executed in the computer device. The computer device 100 may access a background database 300 (the background database 300 may be the local storage of the computer device 100, or it may be located in the cloud), and the background database 300 stores information related to the socket detection method.

[0060] It should be noted that, Figure 1 The application scenario of the socket detection method shown is merely an example. The application scenario of the socket detection method described in this embodiment of the invention is to more clearly illustrate the technical solution of this embodiment of the invention and does not constitute a limitation on the technical solution provided by this embodiment of the invention.

[0061] Based on the application scenarios of the above-mentioned socket detection method, an embodiment of the socket detection method is proposed.

[0062] Firstly, such as Figure 2 As shown, in one embodiment, the present invention provides a socket detection method, comprising:

[0063] Step 201: Obtain the initial socket image to be detected;

[0064] The initial socket image is obtained by scanning the internal structure of the socket to be tested using a camera;

[0065] Step 202: Input the initial socket image into the trained localization detection model for localization detection to obtain the position information and type information of the socket in the initial socket image;

[0066] Among them, the trained localization detection model is further trained by the target intermediate localization detection model in the intermediate localization detection model trained based on multiple pre-configured parameter strategies;

[0067] In the initial socket image, the socket's location information refers to the distribution of the socket's corresponding area within the initial socket image. This is typically represented by vertex coordinates; for example, the detected location information might be the coordinates of the four vertices of a rectangle that covers the socket's corresponding area. Figure 3 , Figure 4 and Figure 5 As shown, after performing localization detection using the trained localization detection model, the coordinates of the four vertices of the white rectangle in the image can be output, which are the coordinates of the white dots in the image. The area determined by the coordinates of the four vertices is the socket area corresponding to the socket.

[0068] The socket type information in the initial socket image refers to the specific type of the socket. For example, for an 86-type socket, it includes... Figures 3 to 5 There are three specific types. When different types of sockets correspond to the same defect, they present different shapes or surface structures. Therefore, by determining the type information, the corresponding defect detection model can be used for subsequent detection to achieve accurate detection of the corresponding type information.

[0069] The trained localization detection model has learned how to detect the location and type information of the socket. Therefore, by inputting the initial socket image into the trained localization detection model, the location and type information of the socket in the initial socket image output by the trained localization detection model can be obtained.

[0070] Step 203: Based on the location information of the socket, perform region extraction on the initial socket image to obtain the target socket image;

[0071] As mentioned above, the location information output by the localization detection model is the coordinates of the socket area in the initial socket image. These coordinates are used to obtain the target socket image by region extraction, which removes the blank parts outside the socket area in the initial socket image, thereby improving the accuracy of subsequent defect detection. For example, taking the vertex coordinates of the rectangle mentioned in the above steps as an example, the corresponding rectangle area is determined based on the coordinates of the four vertices, and the pixel information of the rectangle area is extracted to obtain the target socket image corresponding to the socket in the rectangle area.

[0072] Since the extracted target socket image can be directly input into the corresponding defect detection model for defect detection based on the type information of the corresponding socket, the obtained target socket image does not need to be saved and can be directly extracted into the form of an array.

[0073] Step 204: Input the target socket image into the trained defect detection model that matches the socket type information to perform defect detection and obtain the socket defect detection result;

[0074] Among them, the defect detection results indicate whether the socket has defects;

[0075] The system includes multiple pre-trained defect detection models, each corresponding to a different type of socket, for example, each corresponding to a different type of socket. Figures 3 to 5 The three types of 86-type sockets are obtained by inputting the socket type information after obtaining the target socket image. For example, the socket type information corresponding to a certain target socket image is... Figure 3 If the type is specified, the target socket image will be input into the corresponding defect detection model. Similarly, the socket type information corresponding to a certain target socket image is... Figure 4 If the type is indicated, then the image of the target socket is input into the defect detection model corresponding to that type;

[0076] Each trained defect detection model has learned various defect scenarios for the corresponding type of socket, such as missing copper parts, incorrect copper parts, improper assembly of copper parts, and bent copper parts. When these scenarios are detected in the input target socket image, the output result indicates that the socket has a defect; otherwise, the output result indicates that the socket does not have a defect.

[0077] The above-described socket detection method first uses a trained localization detection model to locate and detect the initial socket image, obtaining the position information of the socket in the initial socket image. Then, based on the position information, the initial socket image is region-by-region extracted according to the socket area to obtain the target socket image that fits the socket. Finally, a trained defect detection model is used to detect defects in the target socket image, thereby obtaining the defect detection result. Using machine learning algorithms, variables that traditional algorithms cannot identify can be identified, achieving the purpose of automatic detection, reducing labor costs, and improving detection efficiency. Furthermore, by using the localization detection model and the corresponding type information defect detection model to perform localization and defect detection on the socket image, accurate detection of the corresponding type is achieved, improving detection accuracy. In addition, multiple parameter strategies are used to train the corresponding intermediate localization detection model, and training is continued based on the best-performing target intermediate localization detection model to obtain the trained localization detection model, improving training completeness, training effect, and model performance.

[0078] In one embodiment, based on the location information of the socket, region extraction is performed on the initial socket image to obtain the target socket image, including:

[0079] The location information of the socket is subjected to region amplification processing to obtain the amplified location information of the socket;

[0080] As mentioned in the above embodiments, the location information output by the positioning detection model is the vertex coordinates of a rectangular box. However, in practice, the rectangular box formed by the vertex coordinates is usually very close to the socket area. If image extraction is performed directly based on this location information, the edge features of the socket are easily lost, thus affecting the accuracy of subsequent defect detection. Therefore, in this embodiment, after obtaining the location information, a region augmentation process can be performed on it. For example, taking a rectangular box as an example, one-tenth of the length of the shortest side of the rectangular box can be used as the target length, and the target length can be augmented outwards from the four sides of the rectangular box to obtain an augmented rectangular box. The vertex coordinates of the augmented rectangular box are the augmented location information.

[0081] Based on the augmented location information of the socket, the initial socket image is used to extract the region to obtain the target socket image;

[0082] Since the amplified rectangle corresponding to the amplified location information can completely contain the socket area, region extraction based on the amplified location information of the initial socket image will not lose the edge features of the socket, thus ensuring the accuracy of subsequent defect detection.

[0083] In one embodiment, before the step of inputting the initial socket image into the trained localization detection model for localization detection, the socket detection method further includes:

[0084] Obtain the first training sample set; the first training sample set includes multiple first training initial socket images and the annotation position information and annotation type information of the sockets in each first training initial socket image;

[0085] The annotation location information and annotation type information are obtained manually by the annotator, which means that the training method is supervised training. Of course, in other embodiments, unsupervised training can also be used.

[0086] Among them, the annotator can use the annotation tool Labelimg to draw rectangles to obtain the corresponding annotation location information, and classify the sockets corresponding to each rectangle to obtain the corresponding annotation type information;

[0087] The network architecture of the localization detection model can adopt the high-performance, lightweight detection model PP-PicoDet, which can include the following components:

[0088] Backbone: Primarily used for feature extraction, it adopts ESNet (Enhanced ShuffleNetv2) as the backbone network. It adds SE and Ghost modules to the ShuffleNetv2 network and uses Depthwise Convolution to improve inference speed and reduce computation, thus solving the problem of feature loss caused by channel shuffle in ShuffleNetv2.

[0089] Neck: It is a key link in the object detection framework, connecting the upper and lower layers. In the object detection network, the Neck mainly fuses the features extracted by the Backbone to improve the detection head's ability to detect, locate, and classify objects of different sizes. The Neck in the PP-PicoDet algorithm adopts the CSP-PAN structure and uses 1x1 convolution to unify the number of input channels in each branch, which can reduce the amount of computation while keeping the accuracy almost unchanged.

[0090] Head: Primarily used to predict the target's location from the features fused from the Neck; it employs 5*5 depthwise separable convolutions, which can increase the detector's receptive field and improve performance with a small increase in the number of parameters, keeping the number of channels in the head consistent with the neck module, and coupling the classification and regression branches;

[0091] The images of each initial socket in the first training sample set are input into the initial localization detection model for localization detection, so as to obtain the predicted position information and predicted type information of the socket in each initial socket image.

[0092] The first loss is determined based on the predicted and labeled location information of the sockets in each initial training socket image;

[0093] In the training process, the first initial socket image is used as input, the predicted position information is used as the actual output, and the labeled position information is used as the expected output. The first loss is then determined based on the actual output and the expected output.

[0094] In determining the first loss, the traditional loss function in PP-PicoDet can be used, namely, the first confidence loss between the predicted location information and the labeled location information is determined according to the Varifocal loss function, and the location loss between the predicted location information and the labeled location information is determined according to the GIoU loss function. Then, the first loss is obtained based on the first confidence loss and the location loss.

[0095] The second loss is determined based on the predicted type information and labeled type information of the sockets in each of the initial socket images of the first training;

[0096] Similarly, during the training process, the first initial socket image is used as input, the predicted type information of the output is used as the actual output, and the labeled type information is used as the expected output. The second loss is then determined based on the actual output and the expected output.

[0097] In determining the second loss, the Varifocal loss function and the GIoU loss function can be used to determine the second confidence loss and the type loss between the predicted type information and the labeled type information, respectively. Then, the second loss is obtained based on the second confidence loss and the type loss.

[0098] The initial localization and detection model is trained based on the first loss and the second loss to obtain the trained localization and detection model.

[0099] Specifically, based on the first loss and the second loss, it is determined whether the preset convergence condition is met. If so, the trained localization and detection model is obtained. Otherwise, the weight parameters of the initial localization and detection model are adjusted according to the first loss and the second loss. Then, the next first training sample set is obtained, and training continues until the obtained first loss and the second loss meet the preset convergence condition.

[0100] Among these, the second confidence score of the corresponding type loss of the trained localization and detection model needs to have a high threshold to avoid including information that does not belong to the above types (i.e., ...) in subsequent processing. Figures 3 to 5 The target socket images of the three types of 86 sockets shown are input into the defect detection model with corresponding type information;

[0101] In the above steps, the confidence level refers to the degree of closeness between the actual value and the expected value in the location information or type information. The higher the confidence level, the closer the values ​​are.

[0102] In one embodiment, before the step of inputting the initial socket image into the trained localization detection model for localization detection, the socket detection method further includes:

[0103] Obtain the first training sample set; the first training sample set includes multiple first training initial socket images and the annotation position information and annotation type information of the sockets in each first training initial socket image;

[0104] The current parameter strategy of the initial localization and detection model is determined from multiple parameter strategies configured in the initial localization and detection model; the parameter strategy includes the amount of data processed per run and the type of loss function.

[0105] The images of each initial socket in the first training sample set are input into the initial localization detection model for localization detection, so as to obtain the predicted position information and predicted type information of the socket in each initial socket image.

[0106] The first loss is determined based on the predicted and labeled location information of the sockets in each initial training socket image;

[0107] The second loss is determined based on the predicted type information and labeled type information of the sockets in each of the initial socket images of the first training;

[0108] Based on the first loss and the second loss, the initial localization and detection model is trained to obtain the intermediate localization and detection model corresponding to the current parameter strategy;

[0109] The termination condition for training an intermediate localization detection model can be the number of training iterations. For example, if the number of training iterations reaches a preset threshold, then the corresponding intermediate localization detection model is considered to have been obtained.

[0110] From the multiple parameter strategies configured in the initial localization and detection model, a new current parameter strategy for the initial localization and detection model is determined until the intermediate localization and detection model corresponding to each parameter strategy is obtained;

[0111] In this embodiment, hyperparameters are used to switch the parameter strategy of the initial localization and detection model, eliminating the need to build multiple initial localization and detection models with different parameter strategies separately.

[0112] Determine the evaluation indicators for each intermediate localization detection model;

[0113] Based on the evaluation indicators of each intermediate localization detection model, the target intermediate localization detection model is determined;

[0114] The evaluation metrics include loss, accuracy, and recall. The model performance of each intermediate localization detection model is determined based on its loss, accuracy, and recall. The intermediate localization detection model with the best performance is then selected as the target intermediate localization detection model.

[0115] When determining model performance, loss, accuracy, and recall can be used as quantifiable scores. Then, loss, accuracy, and recall are weighted according to preset score weights to obtain the target score. The model with the highest target score has the best performance.

[0116] Based on the first training sample set, the target intermediate localization and detection model is further trained to obtain the trained localization and detection model.

[0117] When training the target intermediate localization and detection model, the termination condition is that the loss meets the preset convergence condition. For specific details, please refer to the above embodiment, which will not be repeated here.

[0118] Typically, a model is configured with only one parameter strategy and then trained based on that strategy to obtain a trained model. The trained model includes the original parameter strategy and the multiple adjustments made to it during training. However, different parameter strategies result in different loss, accuracy, and recall during training. If only one parameter strategy is considered, it is impossible to know whether the performance of the trained model is optimal. Therefore, in this embodiment, multiple parameter strategies can be pre-configured in the initial localization detection model. During training, each parameter strategy is used to train the model, resulting in corresponding intermediate localization detection models. Finally, these intermediate models are compared, and the intermediate model with the best performance is determined as the target intermediate localization detection model. Then, training continues based on this target intermediate localization detection model to obtain the trained localization detection model. This improves the completeness of the training and enhances the performance of the trained localization detection model.

[0119] In one embodiment, obtaining the first training sample set includes:

[0120] Obtain the first initial training sample set;

[0121] Data augmentation is performed on the first initial training sample set to obtain the first training sample set; data augmentation includes at least one of image flipping, image mirroring, and image stitching.

[0122] Data augmentation can increase both the number and quality of samples. Specifically, when training a localization detection model, the first initial training socket images in the first initial training sample set are augmented using Mosaic or MixUp. Mosaic augmentation is a very effective augmentation strategy that uses random scaling, cropping, and arrangement to stitch together images, improving the detection of small targets. MixUp is an additional augmentation strategy built on top of Mosaic. When applied to image classification tasks, it can stably improve classification accuracy by 1 percentage point with almost no additional computational overhead.

[0123] In one embodiment, before the step of inputting the target socket image into a trained defect detection model for defect detection, the socket detection method further includes:

[0124] Obtain the trained localization and detection model and the second training sample set; the second training sample set includes multiple second training initial socket images and the labeled defect detection results of the sockets in each second training initial socket image;

[0125] The images of each initial socket in the second training sample set are input into the trained localization detection model for localization detection, so as to obtain the location information and type information of each initial socket image.

[0126] Based on the location information of each second initial socket image, region extraction is performed on each second initial socket image to obtain the target socket image of the socket in each second initial socket image;

[0127] In this embodiment, the input of the defect detection model is the target socket image, and the output is the defect detection result. In other embodiments, the corresponding target socket image and the corresponding labeled defect detection result can be obtained by an annotator, but this method will incur additional manpower costs. Therefore, in this embodiment, the corresponding target socket image can be obtained by using the trained localization detection model and the subsequent image extraction program. Thus, the second training set only needs to include multiple second training initial socket images and the labeled defect detection results of the sockets in each second training initial socket image.

[0128] For the localization detection model, whether it has reached the "trained" standard in this embodiment can be determined by the MAP (mean average precision, which is a very important metric used to measure the performance of object detection algorithms) of the actual output of the localization detection model. Specifically, when MAP > 97%, the localization detection model can be considered to have reached the "trained" standard in this embodiment.

[0129] The second training sample set and the first training sample set in the above embodiments can be obtained based on the same training sample set, namely the target training sample set. The target training sample set includes multiple initial training socket images and the annotation position information, annotation type information and annotation defect detection results of the sockets in each initial training socket image. Thus, when training the localization detection model, the multiple initial training socket images in the target training sample set and the annotation position information and annotation type information of the sockets in each initial training socket image are determined as the first training sample set. When training the defect detection model, the multiple initial training socket images in the target training sample set and the annotation defect detection results of the sockets in each initial training socket image are determined as the second training sample set.

[0130] The network architecture of the defect detection model can adopt the high-performance lightweight network MobileNetv3, which uses depthwise separable convolutions, inverted residuals, linear bottleneck, and SE modules, and uses NAS (Neural Architecture Search) to search for the network configuration and parameters.

[0131] The target socket image of each socket in the second initial training socket image is input into the initial defect detection model that matches the type information of the socket in each second initial training socket image to perform defect detection, and the predicted defect detection result of the socket in each second initial training socket image is obtained.

[0132] The third loss is determined based on the predicted defect detection results and labeled defect detection results of the sockets in each of the second training initial socket images;

[0133] The specific training process of the defect detection model can be referred to the above-mentioned localization detection model, and will not be repeated here.

[0134] In one embodiment, the defect detection model can also be configured with multiple parameter strategies to perform more complete training, thereby improving training effectiveness and model performance. For specific details, please refer to the relevant content of the localization detection model mentioned above, which will not be repeated here.

[0135] In one embodiment, after training the localization detection model and the defect detection model is completed, the localization detection model and the defect detection model can be verified and tested. The ratio of the number of training samples, the number of verification samples, and the number of test samples can be 7:2:1.

[0136] In one embodiment, after training the localization detection model and the defect detection model, it is also necessary to deploy the localization detection model and the defect detection model to enable them to have actual data processing capabilities. Specifically, the NCNN framework can be used for deployment.

[0137] During deployment, the model needs to be formatted. First, the obtained localization detection model and defect detection model are converted to ONNX format, and then converted from ONNX format to the format required by the NCNN framework, including bin format and param format.

[0138] In one embodiment, after the step of inputting the target socket image into a trained defect detection model for defect detection to obtain the defect detection result of the socket, the above socket detection method further includes:

[0139] In response to a correction command for a defect detection result, determine the target socket image corresponding to the correction command and the correction defect detection result of the socket corresponding to the target socket image;

[0140] The calibration command is input by the corresponding calibration personnel. The calibration personnel can view the defect detection results output by the defect detection model. When the target socket image has a rare defect form that was not trained during the training phase, the defect detection model cannot detect the defect form and outputs a defect detection result indicating that there is no defect. The calibration personnel can determine that there is an anomaly in the detection and input a calibration command to identify the target socket image with the abnormal defect detection result and modify the defect detection result of the target socket to indicate that there is a defect, which is the calibration defect detection result. If the target socket images are all directly input into the defect detection model in the form of arrays without being saved, the calibration personnel cannot obtain the target socket images. Therefore, based on this situation, when a calibration command is received, another processing flow is invoked. This processing flow also includes the trained localization detection model and defect detection model, as well as an image extraction program. The difference is that the data format of the target socket image obtained by the image extraction program based on the location information is an image format, not an array format. Thus, the calibration personnel can find the abnormal calibration target socket image in the corresponding folder.

[0141] Obtain the trained target defect detection model for defect detection on the image of the target socket to be corrected, and the predicted defect detection results of the socket corresponding to the image of the target socket to be corrected;

[0142] Once the target socket image for correction is determined, the predicted defect detection results obtained from previous detection or re-detection can be obtained.

[0143] The fourth loss is determined based on the predicted defect detection results and the corrected defect detection results of the socket corresponding to the corrected target socket image;

[0144] Based on the fourth loss, the trained target defect detection model is incrementally trained to obtain the incrementally trained target defect detection model.

[0145] Incremental training is similar to the pre-training process described above. The specific process can be referred to the pre-training process, and will not be repeated here.

[0146] It is important to note that if the target socket images in the actual running process are in array format, while the target socket images in the incremental training process are in image format, then the model parameters of the defect detection model in the incremental training process after completing incremental training need to be synchronized to the defect detection model in the actual running process.

[0147] Secondly, such as Figure 6 As shown, in one embodiment, the present invention provides a socket detection device, comprising:

[0148] Image acquisition module 301 is used to acquire an initial socket image to be detected;

[0149] The localization detection module 302 is used to input the initial socket image into the trained localization detection model for localization detection to obtain the position information of the socket in the initial socket image; the trained localization detection model is further trained by the target intermediate localization detection model in the intermediate localization detection model trained based on multiple pre-configured parameter strategies.

[0150] The image extraction module 303 is used to extract a region from the initial socket image based on the socket's location information to obtain the target socket image.

[0151] The defect detection module 304 is used to input the target socket image into a trained defect detection model for defect detection and obtain the defect detection result of the socket; the defect detection result indicates whether the socket has a defect.

[0152] The aforementioned socket detection device first uses a trained localization detection model to locate and detect the initial socket image to be detected, obtaining the position information of the socket in the initial socket image. Then, based on the position information, the initial socket image can be region extracted according to the area of ​​the socket to obtain the target socket image that fits the socket. Finally, a trained defect detection model is used to detect defects in the target socket image, thereby obtaining the defect detection result. Using machine learning algorithms, variables that traditional algorithms cannot identify can be identified, achieving the purpose of automatic detection, reducing labor costs, and improving detection efficiency. In addition, multiple parameter strategies are used to train the corresponding intermediate localization detection model, and training is continued based on the target intermediate localization detection model with the best performance to obtain the trained localization detection model, which improves the training completeness, training effect, and model performance.

[0153] In one embodiment, the socket detection device further includes a positioning training module, configured to: acquire a first training sample set before inputting an initial socket image into a trained positioning detection model for positioning detection; train the initial positioning detection model based on the first training sample set and pre-configured multiple parameter strategies to obtain multiple intermediate positioning detection models; each intermediate positioning detection model corresponds to a parameter strategy; the parameter strategy includes the amount of data processed per cycle and the type of loss function; determine the evaluation index of each intermediate positioning detection model; determine the target intermediate positioning detection model based on the evaluation index of each intermediate positioning detection model; and continue training the target intermediate positioning detection model based on the first training sample set to obtain a trained positioning detection model.

[0154] In one embodiment, the localization training module is specifically used to train the initial localization detection model corresponding to each parameter strategy based on the first training sample set; for each parameter strategy, the number of training times of the initial localization detection model corresponding to the parameter strategy is obtained; and when the number of training times reaches a preset threshold, the intermediate localization detection model corresponding to the parameter strategy is obtained.

[0155] In one embodiment, the evaluation metrics include loss, accuracy, and recall; the localization training module is specifically used to determine the model performance of each intermediate localization detection model based on the loss, accuracy, and recall of each intermediate localization detection model; and to determine the intermediate localization detection model with the best model performance as the target intermediate localization detection model.

[0156] In one embodiment, the first training sample set includes multiple first initial training socket images and the labeled position information of the sockets in each first initial training socket image; the localization training module is specifically used to input each first initial training socket image in the first training sample set into the target intermediate localization detection model for localization detection, and obtain the predicted position information of the sockets in each first initial training socket image; determine the first loss based on the predicted position information and labeled position information of the sockets in each first initial training socket image; if the first loss satisfies the preset convergence condition, the trained localization detection model is obtained.

[0157] In one embodiment, the socket detection device further includes:

[0158] The defect training module is used to obtain a trained localization detection model and a second training sample set before inputting the target socket image into the trained defect detection model for defect detection. The second training sample set includes multiple initial socket images for second training and the labeled defect detection results of the sockets in each initial socket image for second training. Each initial socket image for second training is input into the trained localization detection model for localization detection to obtain the position information of each initial socket image for second training. Based on the position information of each initial socket image for second training, region extraction is performed on each initial socket image for second training to obtain the target socket image of the socket in each initial socket image for second training. The target socket image of the socket in each initial socket image for second training is input into the initial defect detection model for defect detection to obtain the predicted defect detection result of the socket in each initial socket image for second training. Based on the predicted defect detection result and the labeled defect detection result of the socket in each initial socket image for second training, a second loss is determined.

[0159] Based on the second loss, the initial defect detection model is trained to obtain the trained defect detection model.

[0160] In one embodiment, the socket detection device further includes:

[0161] The incremental training module is used to, after inputting the target socket image into the trained defect detection model to perform defect detection and obtain the defect detection result of the socket, respond to the correction instruction for the defect detection result, determine the correction target socket image corresponding to the correction instruction and the correction defect detection result of the socket corresponding to the correction target socket image; obtain the trained target defect detection model for defect detection of the correction target socket image and the predicted defect detection result of the socket corresponding to the correction target socket image; determine the third loss based on the predicted defect detection result and the correction defect detection result of the socket corresponding to the correction target socket image; and perform incremental training on the trained target defect detection model based on the third loss to obtain the incrementally trained target defect detection model.

[0162] Thirdly, in one embodiment, the present invention provides a computer device, such as... Figure 7 As shown, it illustrates the structure of the computer device involved in this invention, specifically:

[0163] The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 7The structure of the computer device shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0164] The processor 401 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402, thereby providing overall monitoring of the computer device. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and computer programs, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.

[0165] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, computer programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0166] The computer device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0167] The computer device may also include an input unit 404, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0168] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the computer device loads the executable files corresponding to the processes of one or more computer programs into the memory 402 according to the following instructions, and the processor 401 runs the computer programs stored in the memory 402 to perform the following steps:

[0169] Obtain the initial socket image to be detected;

[0170] The initial socket image is input into the trained localization detection model for localization detection to obtain the position information of the socket in the initial socket image; the trained localization detection model is further trained by the target intermediate localization detection model obtained by training intermediate localization detection models based on pre-configured multiple parameter strategies.

[0171] Based on the location information of the socket, the initial socket image is processed to extract the target socket image.

[0172] The target socket image is input into a trained defect detection model for defect detection, and the defect detection result of the socket is obtained; the defect detection result indicates whether there is a defect in the socket.

[0173] Using the aforementioned computer equipment, a trained localization detection model is first used to locate and detect the initial socket image to be detected, obtaining the position information of the socket in the initial socket image. Then, based on the position information, the initial socket image can be region extracted according to the area of ​​the socket to obtain the target socket image that fits the socket. Finally, a trained defect detection model is used to detect defects in the target socket image, thereby obtaining the defect detection result. Using machine learning algorithms, variables that traditional algorithms cannot identify can be identified, achieving the purpose of automatic detection, reducing labor costs, and improving detection efficiency. In addition, multiple parameter strategies are used to train corresponding intermediate localization detection models, and training is continued based on the target intermediate localization detection model with the best performance to obtain the trained localization detection model, which improves the training completeness, training effect, and model performance.

[0174] Those skilled in the art will understand that all or part of the steps in any of the methods in the above embodiments can be performed by a computer program or by a computer program controlling related hardware. The computer program can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0175] Fourthly, in one embodiment, the present invention provides a storage medium storing a plurality of computer programs that can be loaded by a processor to perform the following steps:

[0176] Obtain the initial socket image to be detected;

[0177] The initial socket image is input into the trained localization detection model for localization detection to obtain the position information of the socket in the initial socket image; the trained localization detection model is further trained by the target intermediate localization detection model obtained by training intermediate localization detection models based on pre-configured multiple parameter strategies.

[0178] Based on the location information of the socket, the initial socket image is processed to extract the target socket image.

[0179] The target socket image is input into a trained defect detection model for defect detection, and the defect detection result of the socket is obtained; the defect detection result indicates whether there is a defect in the socket.

[0180] Using the aforementioned storage medium, a trained localization detection model is first used to locate and detect the initial socket image to be detected, obtaining the position information of the socket in the initial socket image. Then, based on the position information, the initial socket image can be region extracted according to the socket area to obtain the target socket image that fits the socket. Finally, a trained defect detection model is used to detect defects in the target socket image, thereby obtaining the defect detection result. Using machine learning algorithms, variables that traditional algorithms cannot identify can be identified, achieving the purpose of automatic detection, reducing labor costs, and improving detection efficiency. In addition, multiple parameter strategies are used to train corresponding intermediate localization detection models, and training is continued based on the target intermediate localization detection model with the best performance to obtain the trained localization detection model, improving the training completeness, training effect, and model performance.

[0181] It will be understood by those skilled in the art that any references to memory, storage, database, or other media used in the embodiments provided in this invention may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink, DRAM (SLDRAM), RAMbus, direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0182] Since the computer program stored in the storage medium can execute the steps in the socket detection method in any embodiment of the present invention, the beneficial effects that the socket detection method in any embodiment of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0183] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0184] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed descriptions of other embodiments above, which will not be repeated here.

[0185] The present invention provides a detailed description of a socket detection method, apparatus, computer device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

[0186] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. A method of detecting a socket, characterized by, include: Obtain the initial socket image to be detected; The initial socket image is input into the trained localization detection model for localization detection to obtain the location and type information of the socket in the initial socket image; the trained localization detection model is further trained by the target intermediate localization detection model obtained by training intermediate localization detection models based on multiple pre-configured parameter strategies. Based on the location information of the socket, the initial socket image is processed to extract a region, thereby obtaining the target socket image of the socket; The target socket image is input into one of the pre-configured trained defect detection models that matches the type information to perform defect detection, thereby obtaining the defect detection result of the socket. The defect detection results indicate whether the socket has a defect; Before the step of inputting the initial socket image into the trained localization detection model for localization detection, the method further includes: Obtain the first training sample set; Based on the first training sample set and multiple pre-configured parameter strategies, the initial localization detection model is trained to obtain multiple intermediate localization detection models; each intermediate localization detection model corresponds to a parameter strategy; the parameter strategy includes the amount of data processed per cycle and the type of loss function. Determine the evaluation indicators for each of the intermediate positioning and detection models; Based on the evaluation indicators of each intermediate localization detection model, the target intermediate localization detection model is determined; Based on the first training sample set, the target intermediate localization and detection model is further trained to obtain the trained localization and detection model.

2. The socket detection method of claim 1, wherein, The initial localization detection model is trained based on the first training sample set and pre-configured multiple parameter strategies to obtain multiple intermediate localization detection models, including: Based on the first training sample set, train the initial localization and detection model corresponding to each parameter strategy; For each parameter strategy, the number of training iterations of the initial localization and detection model corresponding to the parameter strategy is obtained. When the number of training iterations reaches a preset threshold, the intermediate localization and detection model corresponding to the parameter strategy is obtained.

3. The socket testing method according to claim 1, characterized in that, The evaluation metrics include loss, accuracy, and recall; determining the target intermediate localization detection model based on the evaluation metrics of each intermediate localization detection model includes: The model performance of each intermediate localization detection model is determined based on the loss, accuracy, and recall of each intermediate localization detection model. The intermediate localization detection model with the best model performance is determined as the target intermediate localization detection model.

4. The socket testing method according to claim 1, characterized in that, The first training sample set includes multiple first initial training socket images and the annotation location information and annotation type information of the sockets in each first initial training socket image; The step of further training the target intermediate localization and detection model based on the first training sample set to obtain a trained localization and detection model includes: The images of each of the first initial training sockets in the first training sample set are input into the target intermediate localization detection model for localization detection, so as to obtain the predicted position information and predicted type information of the sockets in each of the first initial training socket images. The first loss is determined based on the predicted and labeled location information of the sockets in each of the first initial training socket images; The second loss is determined based on the predicted type information and labeled type information of the sockets in each of the first initial training socket images; If the first loss and the second loss satisfy the preset convergence condition, then the trained localization and detection model is obtained.

5. The socket testing method according to claim 1, characterized in that, Before the step of inputting the target socket image into a pre-configured, trained defect detection model that matches the type information for defect detection, the method further includes: Obtain the trained localization detection model and the second training sample set; the second training sample set includes multiple second initial socket images and the labeled defect detection results of the sockets in each second initial socket image; Each of the second initial training socket images in the second training sample set is input into the trained localization detection model for localization detection, so as to obtain the position information and type information of each of the second initial training socket images; Based on the position information of each second initial training socket image, region extraction is performed on each second initial training socket image to obtain the target socket image of the socket in each second initial training socket image; The target socket image of each socket in the second initial training socket image is input into the initial defect detection model that matches the type information of the socket in each second initial training socket image to perform defect detection, and the predicted defect detection result of the socket in each second initial training socket image is obtained. The third loss is determined based on the predicted defect detection results and labeled defect detection results of the sockets in each of the second initial training socket images; The initial defect detection model is trained based on the third loss to obtain a trained defect detection model.

6. The socket testing method according to claim 1, characterized in that, After the step of inputting the target socket image into a pre-configured, trained defect detection model that matches the type information among multiple pre-configured defect detection models to perform defect detection and obtain the defect detection result of the socket, the method further includes: In response to a correction instruction for the defect detection result, a correction target socket image corresponding to the correction instruction and a correction defect detection result for the socket corresponding to the correction target socket image are determined. Obtain a trained target defect detection model for defect detection on the corrected target socket image and the predicted defect detection result of the socket corresponding to the corrected target socket image; The fourth loss is determined based on the predicted defect detection result and the corrected defect detection result of the socket corresponding to the corrected target socket image; Based on the fourth loss, the trained target defect detection model is incrementally trained to obtain the incrementally trained target defect detection model.

7. A socket detection device, characterized in that, include: The image acquisition module is used to acquire the initial socket image to be detected; The localization detection module is used to input the initial socket image into the trained localization detection model for localization detection, and obtain the position information and type information of the socket in the initial socket image; the trained localization detection model is further trained by the target intermediate localization detection model in the intermediate localization detection model trained based on multiple pre-configured parameter strategies; The image extraction module is used to extract a region from the initial socket image based on the location information of the socket to obtain the target socket image of the socket; The defect detection module is used to input the target socket image into a plurality of pre-configured trained defect detection models that match the type information to perform defect detection, and obtain the defect detection result of the socket. The defect detection results indicate whether the socket has a defect; The localization training module is used to obtain a first training sample set before the step of inputting the initial socket image into the trained localization detection model for localization detection; Based on the first training sample set and multiple pre-configured parameter strategies, the initial localization detection model is trained to obtain multiple intermediate localization detection models; each intermediate localization detection model corresponds to a parameter strategy; the parameter strategy includes the amount of data processed in a single run and the type of loss function; the evaluation index of each intermediate localization detection model is determined; based on the evaluation index of each intermediate localization detection model, the target intermediate localization detection model is determined; based on the first training sample set, the target intermediate localization detection model is further trained to obtain the trained localization detection model.

8. A computer device, characterized in that, It includes a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to perform the steps of the socket detection method according to any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium stores a computer program, which is loaded by a processor to perform the steps of the socket detection method according to any one of claims 1 to 6.