Label generation method and apparatus, training method and apparatus for semi-supervised object detection model, and object detection method and apparatus

By aligning the pseudo-labels of unlabeled images and introducing category loss weights in the semi-supervised object detection framework, the problem of accuracy decline in the semi-supervised object detection model when the category distribution is imbalanced is solved, and the detection accuracy and pseudo-label quality are improved.

WO2024217507A1PCT designated stage expired Publication Date: 2024-10-24MASHANG CONSUMER FINANCE CO LTD

Patent Information

Application Number
PCT/CN2024/088651
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-19
Filing Date
2024-04-18
Publication Date
2024-10-24

AI Technical Summary

Technical Problem

When the class distribution of existing semi-supervised target detection models is unbalanced, the quality of pseudo labels is low, resulting in a decrease in detection accuracy. Moreover, existing methods assume that labeled data and unlabeled data are balanced class distributions, and cannot effectively handle real-life scenarios. The problem of uneven category distribution.

Method used

In the semi-supervised target detection framework, the teacher model is used to detect targets on unlabeled images to generate pseudo labels, and the real category distribution information is used to perform distribution alignment processing on the pseudo category labels to generate high-quality pseudo labels; at the same time, category loss is introduced Weights to balance the imbalance of class distribution in training data.

Benefits of technology

It improves the detection accuracy of the semi-supervised target detection model, enhances the quality of pseudo labels, can effectively train the model when the category distribution is uneven, and improves the accuracy and reliability of target detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024088651_24102024_PF_FP_ABST
    Figure CN2024088651_24102024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present application are a label generation method and apparatus, a training method and apparatus for a semi-supervised object detection model, and an object detection method and apparatus. The label generation method comprises: by means of a teacher model in a semi-supervised object detection model, performing object detection on an unlabeled image set, so as to obtain pseudo labels corresponding to each unlabeled image in the unlabeled image set, wherein the pseudo labels comprise a pseudo class label and a pseudo location label; acquiring real class distribution information of the unlabeled image set; on the basis of the real class distribution information of the unlabeled image set, performing class distribution alignment processing on the pseudo class label corresponding to each unlabeled image in the unlabeled image set, so as to obtain a target pseudo class label corresponding to each unlabeled image in the unlabeled image set; and on the basis of the target pseudo class label and pseudo location label which correspond to each unlabeled image, determining a target pseudo label corresponding to each unlabeled image.
Need to check novelty before this filing date? Find Prior Art

Description

Label generation method, training method of semi-supervised target detection model, target detection method and device

[0001] This application claims priority to Chinese patent applications with application number 202310424768.0 filed on April 19, 2023, entitled “Label generation method, model training method, target detection method and device”, and application number 202310424778.4 filed on April 19, 2023, entitled “Semi-supervised training method of target detection model, target detection method and device”, the contents of which are incorporated herein by reference. Technical Field

[0002] The present application relates to the field of image processing technology, and in particular to a label generation method, a training method for a semi-supervised target detection model, and a target detection method and device. Background Art

[0003] In recent years, deep neural networks have achieved human or superhuman performance in tasks such as image classification, object detection, and action recognition. To reduce annotation overhead, deep learning methods based on semi-supervised learning have been proposed and widely studied. These methods train models using a small amount of labeled data and a large amount of unlabeled data.

[0004] Summary of the Invention

[0005] The purpose of the embodiments of the present application is to provide a label generation method, a training method for a semi-supervised target detection model, a target detection method and a device, which are used to improve the accuracy of semi-supervised target detection under conditions of uneven class distribution.

[0006] In order to achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0007] In one aspect, an embodiment of the present application provides a tag generation method, comprising:

[0008] Using the teacher model in the semi-supervised target detection model, target detection is performed on the unlabeled image set to obtain pseudo labels corresponding to each unlabeled image in the unlabeled image set. The pseudo labels include pseudo category labels and pseudo position labels. The pseudo category labels are used to indicate the category of the target object in the corresponding unlabeled image, and the pseudo position labels are used to indicate the position of the target object in the corresponding unlabeled image.

[0009] Obtaining true category distribution information of the unlabeled image set;

[0010] Based on the true category distribution information of the unlabeled image set, performing category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set to obtain the target pseudo category labels corresponding to each unlabeled image in the unlabeled image set;

[0011] Based on the target pseudo category label and the pseudo position label corresponding to each unlabeled image in the unlabeled images, a target pseudo label corresponding to each unlabeled image is determined.

[0012] The label generation method provided in the embodiment of the present application performs target detection on the unlabeled image set through the teacher model in the semi-supervised target detection model, and obtains the pseudo category label and pseudo position label corresponding to each unlabeled image in the unlabeled image set; then, obtains the true category distribution information of the unlabeled image, and uses the true category distribution information of the unlabeled image set to perform category distribution alignment processing on the pseudo category label corresponding to each unlabeled image in the unlabeled image set, so as to achieve the alignment of the category distribution of the original and biased pseudo category label corresponding to each unlabeled image with the true distribution of the unlabeled image set, thereby effectively reducing the deviation of the pseudo category label and abandoning the general assumption that the category distribution of the unlabeled image set is the same as the category distribution of the labeled image set; further, based on the aligned target pseudo category label and pseudo position label corresponding to each unlabeled image, the target pseudo label corresponding to each unlabeled image is determined, which is conducive to improving the quality of the pseudo label, and the role of the pseudo label as a pseudo real label in the teacher model is enhanced, which is conducive to improving the detection accuracy of the semi-supervised target detection model.

[0013] In one aspect, an embodiment of the present application provides a method for training a semi-supervised object detection model, wherein the semi-supervised object detection model includes a teacher model and a student model, and the method includes:

[0014] Obtaining a set of labeled images, sample labels corresponding to each labeled image in the labeled image set, a set of unlabeled images, and target pseudo labels corresponding to each unlabeled image in the unlabeled image set, wherein the target pseudo labels corresponding to each unlabeled image are generated based on the label generation method described in the first aspect;

[0015] The semi-supervised object detection model is iteratively trained based on the labeled image set, the sample labels corresponding to each labeled image in the labeled image set, the unlabeled image set, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set.

[0016] The training method of the target detection model provided in the embodiment of the present application addresses the problem that in a semi-supervised training framework, there are a small number of labeled images and a large number of unlabeled images in the training data, and the training data has an uneven category distribution. The label generation method provided in the embodiment of the present application is used to generate a corresponding target pseudo-label for each unlabeled image in the unlabeled image set, and then the semi-supervised target detection model is iteratively trained using the labeled image set, the sample labels corresponding to each labeled image in the labeled image set, the unlabeled image set, and the target pseudo-labels corresponding to each unlabeled image in the unlabeled image set. Since the target pseudo-category labels in the target pseudo-labels corresponding to each unlabeled image are pseudo-category labels after distribution alignment, the role of the target pseudo-labels as pseudo-true labels in the teacher model is enhanced, which is beneficial to improving the training effect of the target detection model, so that the target detection model has higher detection accuracy.

[0017] In one aspect, an embodiment of the present application provides a target detection method, comprising:

[0018] Obtain the image to be detected;

[0019] Through the target model in the semi-supervised target detection model, target detection is performed on the image to be detected to obtain the target detection result corresponding to the image to be detected; wherein, the semi-supervised target detection model includes a teacher model and a student model, and the target model includes the teacher model and / or the student model. The semi-supervised target detection model is trained based on a labeled image set and sample labels corresponding to the labeled images, an unlabeled image set and target pseudo labels corresponding to the unlabeled images, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set are generated based on the aforementioned label generation method.

[0020] The target detection method provided by the embodiment of the present application can accurately perform target detection on the image to be detected using the trained semi-supervised target detection model. Since the target pseudo-labels corresponding to the unlabeled images used in the training process of the semi-supervised target detection model are obtained based on the target pseudo-category labels and pseudo-position labels after distribution alignment, the role of the target pseudo-labels as pseudo-true labels in the teacher model is improved, and the trained target detection model has higher detection accuracy; on this basis, using the trained target detection model to perform target detection on the image to be detected is conducive to improving the accuracy and reliability of the target detection results.

[0021] In one aspect, an embodiment of the present application provides a label generation device, comprising:

[0022] a detection unit, configured to perform target detection on an unlabeled image set using a teacher model in a semi-supervised target detection model, and obtain a pseudo-label corresponding to each unlabeled image in the unlabeled image set, wherein the pseudo-label includes a pseudo-category label and a pseudo-position label. The pseudo-category label is used to indicate the category of a target object in the corresponding unlabeled image, and the pseudo-position label is used to indicate the position of the target object in the corresponding unlabeled image;

[0023] an estimation unit, configured to obtain true category distribution information of the unlabeled image set;

[0024] an alignment unit, configured to perform category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set based on the true category distribution information of the unlabeled image set, so as to obtain a target pseudo category label corresponding to each unlabeled image in the unlabeled image set;

[0025] The determining unit is configured to determine a target pseudo label corresponding to each unlabeled image based on the target pseudo category label and pseudo position label corresponding to each unlabeled image in the unlabeled images.

[0026] In one aspect, an embodiment of the present application provides a training device for a semi-supervised object detection model, wherein the semi-supervised object detection model includes a teacher model and a student model, and the device includes:

[0027] an acquisition unit, configured to acquire a labeled image set, sample labels corresponding to each labeled image in the labeled image set, an unlabeled image set, and pseudo labels corresponding to each unlabeled image in the unlabeled image set, wherein the target pseudo labels corresponding to each unlabeled image are generated based on the label generation method described in the first aspect;

[0028] An adjustment unit is configured to iteratively train the semi-supervised object detection model based on the annotated image set, the sample labels corresponding to each annotated image in the annotated image set, the unannotated image set, and the target pseudo labels corresponding to each unannotated image in the unannotated image set.

[0029] In one aspect, an embodiment of the present application provides a target detection device, comprising:

[0030] An acquisition unit, configured to acquire an image to be detected;

[0031] A detection unit is used to perform target detection on the image to be detected through the target model in the semi-supervised target detection model to obtain a target detection result corresponding to the image to be detected; wherein, the semi-supervised target detection model includes a teacher model and a student model, the target model includes the teacher model and / or the student model, and the semi-supervised target detection model is trained based on a labeled image set and sample labels corresponding to the labeled images, an unlabeled image set and target pseudo labels corresponding to the unlabeled images, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set are generated based on the aforementioned label generation method.

[0032] On the one hand, an embodiment of the present application provides an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the methods of the aforementioned aspects.

[0033] On the one hand, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can perform the methods as described in the aforementioned aspects.

[0034] On the one hand, an embodiment of the present application provides a computer program product, which includes: a computer program, which is stored in a readable storage medium, and one or more processors of an electronic device can read the computer program from the readable storage medium, and the one or more processors execute the computer program, so that the electronic device performs the methods as described in the aforementioned aspects.

[0035] On the one hand, an embodiment of the present application also provides a computer program, which is stored in a readable storage medium. One or more processors of a device can read the computer program from the readable storage medium, and the one or more processors execute the computer program, so that the electronic device performs the methods as described in the aforementioned aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0037] FIG1 is a schematic diagram of the architecture of a semi-supervised object detection framework provided by one embodiment of the present application;

[0038] FIG2 is a flow chart of a label generation method provided by an embodiment of the present application;

[0039] FIG3 is a schematic diagram of the structure of a semi-supervised object detection model provided by one embodiment of the present application;

[0040] FIG4 is a flow chart of a label generation method provided in another embodiment of the present application;

[0041] FIG5 is a flow chart of a method for training a semi-supervised object detection model according to an embodiment of the present application;

[0042] FIG6 is a flow chart of a training method for a semi-supervised object detection model provided in another embodiment of the present application;

[0043] FIG7 is a schematic diagram of a flow chart of a target detection method provided by one embodiment of the present application;

[0044] FIG8 is a schematic flow chart of a target detection method provided in another embodiment of the present application;

[0045] FIG9 is a schematic structural diagram of a label generation device provided by an embodiment of the present application;

[0046] FIG10 is a schematic diagram of a training device for a semi-supervised object detection model provided by one embodiment of the present application;

[0047] FIG11 is a schematic diagram of a training device for a semi-supervised object detection model provided by another embodiment of the present application;

[0048] FIG12 is a schematic diagram of a target detection device provided by one embodiment of the present application;

[0049] FIG13 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0050] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0051] The terms "first," "second," and the like in this specification and claims are used to distinguish similar objects and are not intended to describe a particular order or precedence. It should be understood that such terms are interchangeable where appropriate so that the embodiments of the present application can be implemented in sequences other than those illustrated or described herein. In addition, the term "and / or" in this specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the connected objects are in an "or" relationship.

[0052] It should be understood that the label generation method, the training method of the semi-supervised target detection model, and the target detection method provided in the embodiments of the present application can all be executed by an electronic device or software installed in an electronic device. The so-called electronic devices here may include terminal devices, such as smart phones, tablet computers, laptop computers, desktop computers, intelligent voice interaction devices, smart home appliances, smart watches, vehicle terminals, aircraft, etc.; or, the electronic device may also include a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0053] Currently, most semi-supervised learning methods typically assume a balanced class distribution between labeled and unlabeled data. However, in many real-world scenarios, the underlying class distribution of training data is highly imbalanced. For semi-supervised object detection tasks, this imbalanced class distribution severely impacts the prediction bias of the classification model, causing the classification task to favor large categories, resulting in degraded accuracy for small categories and low-quality pseudo-labels. The pseudo-labels' role as pseudo-true labels in the teacher model is reduced or degraded, impacting both regression accuracy and overall detection accuracy.

[0054] Therefore, there is an urgent need for a solution to improve the accuracy of semi-supervised object detection models under conditions of imbalanced class distribution.

[0055] The technical solution provided in the embodiment of the present application is applied to a semi-supervised object detection framework. For ease of understanding, the semi-supervised object detection framework involved in the embodiment of the present application is first described with reference to FIG1 .

[0056] Figure 1 is a schematic diagram of the architecture of a semi-supervised object detection framework provided in an embodiment of the present application. The semi-supervised object detection framework shown in Figure 1 includes a teacher model and a student model. Both the teacher model and the student model can be used to perform object detection on an input image, specifically detecting the category of a target object in the input image and locating the position of the target object.

[0057] In this semi-supervised object detection framework, a semi-supervised learning approach can be used to train a model using a labeled image set containing a small number of labeled images, sample labels corresponding to each labeled image, and an unlabeled image set containing a large number of unlabeled images. This yields a semi-supervised object detection model comprising a teacher model and a student model. For each labeled image, the sample labels corresponding to the labeled image may include a category label and a position label corresponding to the labeled image. The category label is used to indicate the category of the target object in the labeled image, and the position label is used to indicate the position of the target object in the labeled image.

[0058] Specifically, first, each unlabeled image can be subjected to strong enhancement processing and weak enhancement processing respectively to add different degrees of noise to each unlabeled image. Then, each unlabeled image after weak enhancement processing is input into the teacher model for target detection, that is, detecting the category of the target object in each unlabeled image and locating the position of the target object in the corresponding unlabeled image, and obtaining a corresponding first target detection result. Then, based on the first target detection result, the first pseudo label corresponding to each unlabeled image can be determined, wherein the first pseudo label can include a first pseudo category label and a first pseudo position label of the corresponding unlabeled image, wherein the first pseudo category label is used to indicate the category of the target object in the corresponding unlabeled image, and the first pseudo position label is used to indicate the position of the target object in the corresponding unlabeled image.

[0059] At the same time, each strongly enhanced unlabeled image is input into the student model for target detection, and the corresponding second target detection result is also obtained. Then, based on the second target detection result, the second pseudo-label corresponding to each unlabeled image can be determined, wherein the second pseudo-label may include a second pseudo-category label and a second pseudo-position label of the corresponding unlabeled image, wherein the second pseudo-category label is used to represent the category of the target object in the corresponding unlabeled image, and the second pseudo-position label is used to represent the position of the target object in the corresponding unlabeled image.

[0060] In addition, each annotated image is input into the student model for target detection to obtain a corresponding third target detection result. The third target detection result may include the predicted category of the target object in the corresponding annotated image and the predicted position of the target object.

[0061] Finally, based on the third target detection results and sample labels corresponding to each labeled image in the labeled image set, and the first pseudo labels and second pseudo labels corresponding to each unlabeled image in the unlabeled image set, the model parameters of the student model are adjusted, and then based on the model parameters of the student model, the model parameters of the teacher model are updated by the exponential moving average method (EMA).

[0062] For example, the detection loss corresponding to the labeled image set can be determined based on the third target detection result and label corresponding to each labeled image in the labeled image set, and the detection loss corresponding to the unlabeled image set can be determined based on the second target detection result and the above two pseudo labels corresponding to each unlabeled image in the unlabeled image set; further, the detection loss corresponding to the labeled image set and the detection loss corresponding to the unlabeled image are weightedly summed to obtain the total detection loss; finally, based on the total detection loss, the model parameters of the student model are reversely adjusted.

[0063] Repeat the above process multiple times until the preset training stop condition is met to train a semi-supervised object detection model. The preset training stop condition can be set according to actual needs, such as when the number of training times reaches a preset maximum number of training times, etc., which is not limited in the present embodiment.

[0064] Since in many real scenarios, there is an imbalance in the category distribution between the labeled image set and the unlabeled image set, this imbalance in category distribution will seriously affect the prediction bias of the semi-supervised target detection model, causing the model to favor the classification of large categories, resulting in the degradation of the classification accuracy of small categories. The quality of the pseudo-labels generated for each unlabeled image is relatively low, causing the supervision provided by the semi-supervised target detection model to decline or degrade, thereby affecting the regression accuracy and even the overall target detection accuracy.

[0065] In view of this, embodiments of the present application propose a label generation method that utilizes the true category distribution information of an unlabeled image set to perform a refined distribution alignment process on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set. This ensures that the pseudo category labels corresponding to each unlabeled image in the unlabeled image set are aligned with the true category distribution of the unlabeled image set, thereby effectively reducing the deviation of the pseudo category labels and abandoning the common assumption that the category distribution of the unlabeled image set is the same as that of the labeled image set. Furthermore, based on the aligned target pseudo category labels and pseudo position labels corresponding to each unlabeled image, the target pseudo label corresponding to each unlabeled image is determined, which helps improve the quality of the pseudo labels.

[0066] On this basis, an embodiment of the present application also proposes a training method for a semi-supervised target detection model, which iteratively trains the semi-supervised target detection model using a labeled image set, sample labels corresponding to each labeled image in the labeled image set, an unlabeled image set, and target pseudo-labels corresponding to each unlabeled image in the unlabeled image set; since the target pseudo-category labels in the target pseudo-labels corresponding to each unlabeled image are pseudo-category labels after distribution alignment, the role of the target pseudo-labels as pseudo-true labels in the teacher model is enhanced, which is beneficial to improving the training effect of the target detection model, so that the target detection model has higher detection accuracy.

[0067] On this basis, an embodiment of the present application also proposes a training method for a semi-supervised target detection model, assuming that the labeled image set and the unlabeled image set follow the same distribution. By predicting the loss weights corresponding to different categories based on the distribution of the true categories of each labeled image in the labeled image set, in the process of training the semi-supervised target detection model using the sample labels corresponding to each labeled image in the unlabeled image set and the labeled image set, the loss weights corresponding to different categories are introduced. This does not require changing the category distribution of the original data, but instead improves the situation where the target detection model prediction is biased under the condition of uneven class distribution. Not only is the computational cost in the training process low, but it can also improve the training effect of the semi-supervised target detection model and the prediction accuracy of the semi-supervised target detection model.

[0068] On this basis, embodiments of the present application also propose a target detection method that uses a trained semi-supervised target detection model to accurately detect targets in images to be detected. Because the trained target detection model has high detection accuracy, using the trained target detection model to detect targets in images to be detected can improve the accuracy and reliability of target detection results.

[0069] The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0070] Please refer to FIG2 , which is a flowchart of a label generation method provided in one embodiment of the present application. The method may include the following steps:

[0071] S202, performing target detection on the unlabeled image set through the teacher model in the semi-supervised target detection model to obtain pseudo labels corresponding to each unlabeled image in the unlabeled image set.

[0072] Specifically, the teacher model (also called the first model) can be used to perform target detection on each unlabeled image in the unlabeled image set. By detecting the category of the target object in each unlabeled image, a pseudo-category label corresponding to each unlabeled image is obtained. Furthermore, by detecting the location of the target object in each unlabeled image, a pseudo-position label corresponding to each unlabeled image is obtained. In other words, for each unlabeled image in the unlabeled image set, the pseudo-label corresponding to the unlabeled image includes a pseudo-category label and a pseudo-position label. The pseudo-category label is used to indicate the category of the target object in the unlabeled image, and the pseudo-position label is used to indicate the location of the target object in the unlabeled image.

[0073] In the embodiment of the present application, the teacher model can have any appropriate structure and can be set according to actual needs. The embodiment of the present application does not limit this. In actual application, the teacher model uses a one-hot encoding method to obtain pseudo labels. The ResNet-50 network pre-trained on ImageNet is used as the backbone network.

[0074] Optionally, as shown in Figure 3, the teacher model may include a region detection module and a fully connected layer (also called a classifier). The region detection module is used to extract the region of interest of the input unlabeled image, and the fully connected layer is used to perform classification based on the region of interest of the unlabeled image to obtain a pseudo category label corresponding to the unlabeled image, and perform bounding box regression processing (also referred to as box regression processing) based on the region of interest of the unlabeled image to obtain a pseudo position label of the image.

[0075] More specifically, as shown in Figure 3, the region detection module can adopt a two-stage Fast R-CNN region detection network, wherein the region detection network in the first stage is used to extract the region proposal network (RPN) where the target object may exist from the input unlabeled image, and the region detection network in the second stage is used to extract the region of interest (ROI) containing the target object from the region proposal box of the unlabeled image.

[0076] The fully connected layer may include a first fully connected layer, a second fully connected layer and a third fully connected layer, wherein the first fully connected layer is used to perform preliminary image recognition processing on the region of interest of the input unlabeled image to obtain the target object in the region of interest; the second fully connected layer is used to perform linear classification on the target object based on the image feature information of the region of interest to obtain a pseudo category label corresponding to the input unlabeled image; the third fully connected layer is used to perform bounding box regression processing on the target object based on the image feature information of the region of interest to obtain a pseudo position label corresponding to the input unlabeled image.

[0077] It is worth noting that the semi-supervised object detection model in S202 above can be a model trained using the unlabeled image set, the labeled image set, and the sample labels corresponding to each labeled image in the labeled image set under the semi-supervised object detection framework shown in FIG1 , wherein the sample labels corresponding to the labeled images include a category label and a position label corresponding to the labeled image, the category label being used to indicate the category of the target object in the corresponding labeled image, and the position label being used to indicate the position of the target object in the corresponding labeled image. The specific training process will be described later.

[0078] S204, obtaining the true category distribution information of the unlabeled image set.

[0079] Specifically, the true class distribution information of the labeled image set can be used to estimate the true class distribution information of the unlabeled image set.

[0080] Among them, the true class distribution information of the labeled image set is used to reflect the true distribution of the labeled images of different classes in the labeled image set, and specifically may include the number of labeled images belonging to each preset class in the preset class set in the labeled image set. The preset class set can be set according to actual needs, and the embodiments of the present application do not limit this. For example, for the object detection task of detecting whether the target object in the image is male or female, then the preset class set may include two preset classes of male and female; another example is that for the object detection task of detecting which animal the target object in the image belongs to, then the preset class set may include multiple preset classes such as dogs, cats, bears, rabbits, etc.

[0081] Similarly, the true class distribution information of the unlabeled image set is used to reflect the true class distribution request of the unlabeled images of different classes in the unlabeled image set, and specifically may include the number of unlabeled images belonging to each preset class in the preset class set in the unlabeled image set.

[0082] Optionally, considering that in the case where the unlabeled image set and the labeled image set follow the same distribution, the true class distribution information of the two is similar. In this case, the above S204 may include: determining the true class distribution information of the labeled image set based on the class labels corresponding to each labeled image in the labeled image set; using the true class distribution information of the labeled images as the true class distribution information of the unlabeled images.

[0083] Exemplarily, assume that the preset class set includes C preset classes, and the true class distribution information of the labeled image set is expressed as where, for generality, it is assumed that the classes are sorted in descending order, such as i < j, then n i ≥n j , n i represents the number of labeled images belonging to the i-th preset class in the labeled image set, n j represents the number of labeled images belonging to the j-th preset class in the labeled image set, N l represents the total number of labeled images included in the labeled image set, c represents the preset class index in the preset class set, and n c represents the number of labeled images belonging to the c-th preset class in the labeled image set. Then, the number m c of unlabeled images belonging to the c-th preset class in the unlabeled image set can be approximated as being equal to n c , and further the true class distribution information of the unlabeled image set can be expressed as Among them, M u Indicates the total number of unlabeled images contained in the unlabeled image set.

[0084] It can be understood that when the unlabeled image set and the labeled image set follow the same distribution, approximating the true category distribution information of the labeled image set to the true distribution information of the unlabeled image set is simple to implement, which is conducive to improving the estimation efficiency of the true category distribution information, and thus improving the efficiency of label generation.

[0085] Optionally, considering that the confusion matrix is ​​a table used to describe the performance of a classifier / classification model, it contains information about the actual and predicted classifications performed by the classifier / classification model, and in the semi-supervised learning process, the confusion matrix of the labeled image set and the confusion matrix of the unlabeled image set are constructed from the same input distribution (although their respective category label distributions are different), and thus the confusion matrices of the two types of image sets are similar. Based on this, when the unlabeled image set and the labeled image set do not obey the same distribution, in order to quickly and accurately estimate the true category distribution information of the unlabeled image set, the confusion matrix of the labeled image set can be approximated as the confusion matrix of the unlabeled image, and then the true category distribution information of the unlabeled image set can be estimated based on the confusion matrix.

[0086] Specifically, the pseudo-category labels corresponding to the unlabeled images may include the initial probabilities that the unlabeled images belong to each preset category in the preset category set. Accordingly, S204 may include: determining a confusion matrix and the sum of the initial probabilities corresponding to each preset category based on the initial probabilities that each unlabeled image in the unlabeled image set belongs to each preset category, wherein the row vectors of the confusion matrix represent the initial probabilities that the unlabeled images belong to each preset category; and further, estimating the true category distribution information of the unlabeled image set based on the product of the confusion matrix and the sum of the initial probabilities corresponding to each preset category.

[0087] For example, the true category distribution information of the unlabeled image set can be determined by the following formula (1) and formula (2):

[0088] In the above formula (1), m1 represents the number of unlabeled images in the unlabeled image set that belong to the first preset category in the preset category set; m C H represents the number of unlabeled images in the unlabeled image set that belong to the Cth preset category in the preset category set; u represents the confusion matrix; M u Indicates the total number of unlabeled images contained in the unlabeled image set; represents the i-th unlabeled image in the unlabeled image set; represents the initial probability that the i-th unlabeled image belongs to the first preset category; Represents the sum of the initial probabilities corresponding to the first preset category; represents the initial probability that the i-th unlabeled image belongs to the C-th preset category; Represents the sum of the initial probabilities corresponding to the Cth preset category.

[0089] In the above formula (2), Represents the element in the t-th row and j-th column of the confusion matrix, which represents the initial probability that the teacher model predicts the t-th preset category for the unlabeled image when the true category is the j-th preset category; It represents the initial probability that the i-th unlabeled image belongs to the t-th preset category in the preset category set; it represents the sum of the initial probabilities corresponding to the t-th preset category under the condition that the true category of all unlabeled images in the unlabeled image set is the j-th preset category; it represents the number of unlabeled images whose true category is the j-th preset category under the condition that the true category of all unlabeled images in the unlabeled image set is the j-th preset category.

[0090] S206 , based on the true category distribution information of the unlabeled image set, performing category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set to obtain a target pseudo category label corresponding to each unlabeled image in the unlabeled image set.

[0091] In the above S206, the category distribution alignment processing is performed on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set, which means that the category distribution information represented by the original and biased pseudo category labels corresponding to each unlabeled image in the unlabeled image set is aligned with the true category distribution information of the unlabeled image, thereby effectively reducing the deviation of the pseudo category labels, and at the same time abandoning the common assumption that the category distribution of the unlabeled image set is the same as the category distribution of the labeled image set, so as to improve the role of the pseudo category labels in the semi-supervised learning process and enhance the detection accuracy of the semi-supervised target detection model.

[0092] Optionally, the biased pseudo-class labels corresponding to each unlabeled image in the unlabeled image set can be refined, and the refined pseudo-class labels are constrained to not deviate from the original pseudo-class labels, to improve the accuracy of the refined distribution alignment of the pseudo-class labels corresponding to each unlabeled image. Based on this goal, the optimization problem for constructing the refined pseudo-class labels can be formulated: minimizing the deformation of the original pseudo-class labels while matching the true class distribution.

[0093] Specifically, the above S206 may include the following steps:

[0094] A1, based on the entropy of the pseudo category label corresponding to each unlabeled image in the unlabeled image set, determines the weight corresponding to each unlabeled image.

[0095] For example, the weight corresponding to each unlabeled image can be determined by the following formula (3):

[0096] Among them, w i represents the weight corresponding to the i-th unlabeled image in the unlabeled image set, represents the pseudo category label corresponding to the i-th unlabeled image, represents the entropy of the pseudo category label corresponding to the i-th unlabeled image.

[0097] It can be understood that by determining the corresponding weight for each unlabeled image through the above (3), the weight of the small entropy unlabeled image with high confidence can be set to a larger value, while the weight of the large entropy unlabeled image with low confidence can be set to a smaller value, which is conducive to accurately refining biased pseudo-category labels.

[0098] A2: Based on the true category distribution information of the unlabeled images, the pseudo category labels corresponding to each unlabeled image are corrected to obtain candidate pseudo category labels corresponding to each unlabeled image.

[0099] In conjunction with the foregoing, the true category distribution information for the unlabeled image set can include the number of unlabeled images in the unlabeled image set that belong to each preset category in the preset category set. The pseudo-category label corresponding to each unlabeled image represents the initial probability that the unlabeled image belongs to each preset category in the preset category set. In this case, the candidate pseudo-category label corresponding to each unlabeled image represents the candidate probability that the unlabeled image belongs to each preset category in the preset category set.

[0100] Accordingly, the above A2 may include: step B1, based on the initial probability of each unlabeled image in the unlabeled image set belonging to the target category, selecting the top image with the highest initial probability belonging to the target category from the unlabeled image set. Unlabeled images are obtained to obtain the subset of unlabeled images corresponding to the target category, where is less than the number of unlabeled images in the unlabeled image set that belong to the target category, where the target category refers to any one of the preset categories, that is, the target category is any preset category in the preset category set; step B2, traversing each unlabeled image in the unlabeled image set, if the currently traversed unlabeled image belongs to the unlabeled image subset corresponding to the target category, then the initial probability that the currently traversed unlabeled image belongs to the target category is determined as the candidate probability that the currently traversed unlabeled image belongs to the target category; step B3, if the currently traversed unlabeled image does not belong to the unlabeled image subset corresponding to the target category, then the initial probability that the currently traversed unlabeled image belongs to the target category is set to the preset probability, and the candidate probability that the currently traversed unlabeled image belongs to the target category is obtained. Wherein, the preset probability can be set according to actual needs, for example, the preset probability is 0, and this embodiment of the application is not limited to this.

[0101] For example, taking the target category as the cth (c=1, 2, ..., C) preset category in the preset category set as an example, assuming It represents the initial probability that the i-th unlabeled image belongs to the target category. According to the initial probability of each unlabeled image belonging to the target category from high to low, the unlabeled images are sorted to obtain the sorting result: in, Indicates the identifier of the unlabeled image ranked first, Indicates the identifier of the unlabeled image ranked last; then, based on the sorting result, select the top unlabeled images from the unlabeled image set. Unlabeled images can be used to obtain the unlabeled image subset corresponding to the target category. in, represents the unlabeled image ranked 1, Indicates ranking Unlabeled image of bits, where m c represents the total number of unlabeled images in the unlabeled image set, δ represents the hyperparameter used to remove the noise pseudo-category labels; further, for the i-th (i=1,2,…,M u ) unlabeled images, if the unlabeled image belongs to the unlabeled image subset, that is, The initial probability that the unlabeled image belongs to the target category can be determined as the candidate probability that the unlabeled image belongs to the target category, that is, If the unlabeled image does not belong to the unlabeled image subset, that is Then the candidate probability of the unlabeled image belonging to the target category can be set to 0, that is,

[0102] It can be understood that when an unlabeled image does not belong to the unlabeled image subset corresponding to the target category, the candidate probability of the unlabeled image belonging to the target category is set to a preset threshold, and when the unlabeled image belongs to the unlabeled image subset corresponding to the target category, the initial probability of the unlabeled image belonging to the target category is retained. This can remove small data and noise data in the pseudo-category labels corresponding to the unlabeled images, which is conducive to enhancing the role of pseudo-category labels in the semi-supervised learning process and improving the training effect of the semi-supervised target detection model.

[0103] A3, based on the candidate pseudo category labels and weights corresponding to each unlabeled image in the unlabeled image set, optimize the variable value of the dual variable to obtain the target variable value of the dual variable.

[0104] Among them, the dual variable is a hyperparameter in the process of refining pseudo-category labels, and its variable value can be used to refine the distribution alignment of pseudo-category labels with deviations. The dual variable can include a first dual variable and a second dual variable. The first dual variable can be expressed as That is, the first dual variable has a corresponding variable value in each unlabeled image; the second dual variable can be expressed as That is, the second dual variable has a corresponding variable value under each preset category.

[0105] Optionally, in order to improve the accuracy of the optimization processing of the variable value of the dual variable, thereby improving the accuracy of the refined distribution alignment of biased pseudo-category labels in the unlabeled image set, the above-mentioned A3 may include the following steps: Step C1, in the t-th optimization processing, based on the variable value of the dual variable in the t-1-th optimization processing, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category and the weight corresponding to each unlabeled image, determine the variable value of the dual variable in the t-th optimization processing, wherein t is a positive integer, and the variable value of the dual variable in the 0th optimization processing is the preset variable value; Step C2, when the t-th optimization processing meets the maximum number of optimization processing times, determine the variable value of the dual variable in the t-th optimization processing as the target variable value of the dual variable.

[0106] More specifically, the variable value of the dual variable at the t-th optimization process includes the variable value of the first dual variable at the t-th optimization process and the variable value of the second dual variable at the t-th optimization process. The variable value of the first dual variable at the t-th optimization process includes the variable value of the first dual variable corresponding to each unlabeled image at the t-th optimization process, and the variable value of the second dual variable at the t-th optimization process includes the variable value of the second dual variable corresponding to each preset category at the t-th optimization process.

[0107] Correspondingly, in the above step C1, if t is an odd number or t is equal to the maximum number of optimization processing times, the variable value of the second dual variable corresponding to each preset category at the t-1th optimization processing is determined as the variable value of the second dual variable corresponding to each preset category at the tth optimization processing, and based on the variable value of the second dual variable corresponding to each category at the t-1th optimization processing, the candidate probability of each unlabeled image in the unlabeled image set belonging to each category, and the weight corresponding to each unlabeled image, the variable value of the first dual variable corresponding to each unlabeled image at the tth optimization processing is determined; or, if t is an even number and t is not If it is equal to the maximum number of optimization processing times, the variable value of the first dual variable corresponding to each unlabeled image at the t-1th optimization processing is determined as the variable value of the first dual variable corresponding to each unlabeled image at the t-1th optimization processing, and based on the variable value of the first dual variable corresponding to each unlabeled image at the t-1th optimization processing, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, the weight corresponding to each unlabeled image, and the number of unlabeled images in the unlabeled image set belonging to each preset category, the variable value of the second dual variable corresponding to each preset category at the tth optimization processing is determined.

[0108] For example, the variable value of the first dual variable corresponding to the i-th unlabeled image in the t-th optimization process is recorded as The variable value of the second dual variable corresponding to the cth preset category in the tth optimization process is recorded as Assuming that the maximum number of optimization processing times is T, the variable value of the first dual variable corresponding to the i-th unlabeled image in the 0th optimization processing is 1, and the variable value of the second dual variable corresponding to the c-th preset category in the 0th optimization processing is 1, that is, Then, if t is an odd number and t=T, the value of the first dual variable corresponding to the i-th unlabeled image in the t-th optimization process is The second dual variable corresponding to the cth preset category in the tth optimization process is Among them, w i represents the weight corresponding to the i-th unlabeled image, Indicates the variable value of the second dual variable corresponding to the cth preset category in the t-1th optimization process, represents the candidate probability that the i-th unlabeled image belongs to the c-th preset category, and C represents the total number of preset categories contained in the preset category set.

[0109] If t is an even number and t≠T, then the value of the first dual variable corresponding to the i-th unlabeled image in the t-th optimization process is The second dual variable corresponding to the cth preset category in the tth optimization process is Among them, M u represents the total number of unlabeled images contained in the unlabeled image set, Indicates the variable value of the first dual variable corresponding to the i-th unlabeled image during the t-1th optimization process, m c Represents the number of unlabeled images belonging to the cth preset category in the true category distribution information of the unlabeled image set, solve Z≥0 (f(Z)) is implemented using Newton's method. The specific implementation process is a common technical means in this field and will not be repeated here.

[0110] It can be understood that the above-mentioned optimization process can quickly alternately find the optimal variable values ​​of the first dual variable and the second dual variable, thereby helping to improve the accuracy of the refined distribution alignment of biased pseudo-category labels in the unlabeled image set.

[0111] A4, based on the target variable value of the dual variable and the candidate pseudo category labels corresponding to each unlabeled image in the unlabeled images, determining the target pseudo category label corresponding to each unlabeled image.

[0112] For example, for each unlabeled image in the unlabeled image set, the target pseudo-category label corresponding to the unlabeled image may include the target probability that the unlabeled image belongs to each preset category in the preset category set. Accordingly, in A4 above, the target probability of each unlabeled image belonging to each preset category can be determined by the following formula (4):

[0113] in, represents the target probability that the i-th unlabeled image belongs to the c-th preset category, represents the candidate probability that the i-th unlabeled image belongs to the c-th preset category, Indicates the variable value of the first dual variable corresponding to the i-th unlabeled image during the T-th optimization process, Indicates the variable value of the second dual variable corresponding to the cth preset category in the Tth optimization process, T represents the maximum number of optimization processes, w i represents the weight corresponding to the i-th unlabeled image.

[0114] S208 : Determine a target pseudo label corresponding to each unlabeled image based on the target pseudo category label and pseudo position label corresponding to each unlabeled image in the unlabeled images.

[0115] Specifically, for each unlabeled image, the target pseudo label corresponding to the unlabeled image may include a target pseudo category label and a pseudo position label corresponding to the unlabeled image.

[0116] Please refer to Figure 4, which is a flowchart of a label generation method provided in another embodiment of the present application. Compared to the label generation method provided in the embodiment shown in Figure 2, this method can also include a method for performing semi-supervised training under a semi-supervised target detection framework to obtain a semi-supervised target detection model. As shown in Figure 4, this method can include the following steps:

[0117] S402 , performing target detection on the unlabeled image set through a teacher model in a semi-supervised target detection framework, and obtaining a first initial pseudo label corresponding to each unlabeled image in the unlabeled image set.

[0118] The semi-supervised target detection framework herein may be the semi-supervised target detection framework shown in FIG1 , which includes a teacher model (also referred to as a first model) and a student model (also referred to as a second model). The first initial pseudo-label may include a first initial pseudo-category label and a first initial pseudo-position label of the corresponding unlabeled image, wherein the first initial pseudo-category label is used to indicate a first initial category of the target object in the corresponding unlabeled image, and the first initial pseudo-position label is used to indicate a first initial position of the target object in the corresponding unlabeled image.

[0119] The specific implementation process of the above S402 is similar to the specific implementation process of the above S202. Please refer to the detailed description of S202 above and it will not be repeated here.

[0120] S404 , performing target detection on the unlabeled image set using a student model in a semi-supervised target detection framework, and obtaining a second initial pseudo label corresponding to each unlabeled image in the unlabeled image set.

[0121] Among them, the second initial pseudo-label may include a second initial pseudo-category label and a second initial pseudo-position label of the corresponding unlabeled image, wherein the second initial pseudo-category label is used to represent the second initial category of the target object in the corresponding unlabeled image, and the second initial pseudo-position label is used to represent the second initial position of the target object in the corresponding unlabeled image.

[0122] In the above S404, target detection can be performed on each unlabeled image in the unlabeled image set through the student model, and the second initial pseudo category label corresponding to each unlabeled image is obtained by detecting the category of the target object in each unlabeled image, and the second initial pseudo position label corresponding to each unlabeled image is obtained by detecting the position of the target object in each unlabeled image.

[0123] In an embodiment of the present application, the student model and the teacher model may have the same structure. Optionally, as shown in FIG3 , the student model may include a region detection module and a fully connected layer. The region detection module is used to extract the region of interest of the input unlabeled image, and the fully connected layer is used to perform classification based on the region of interest of the unlabeled image to obtain a second initial pseudo-category label corresponding to the unlabeled image, and perform bounding box regression processing based on the region of interest of the image to obtain a second initial pseudo-position label of the image.

[0124] More specifically, as shown in Figure 3, the region detection module can adopt a two-stage Fast R-CNN region detection network, wherein the region detection network in the first stage is used to extract region proposal boxes (RPN) where the target object may exist from the input unlabeled image, and the region detection network in the second stage extracts the region of interest (ROI) containing the target object from the region proposal boxes of the unlabeled image.

[0125] The fully connected layer may include a first fully connected layer, a second fully connected layer and a third fully connected layer, wherein the first fully connected layer is used to perform preliminary image recognition processing on the region of interest of the input unlabeled image to obtain the target object in the region of interest; the second fully connected layer is used to perform linear classification on the target object based on the image feature information of the region of interest to obtain a second initial pseudo category label corresponding to the input unlabeled image; the third fully connected layer is used to perform bounding box regression processing on the target object based on the image feature information of the region of interest to obtain a second initial pseudo position label corresponding to the input unlabeled image.

[0126] S406 , performing target detection on the annotated image set using the student model to obtain a predicted label corresponding to each annotated image in the annotated image set.

[0127] The predicted label corresponding to each annotated image includes a predicted category label and a predicted position label corresponding to the annotated image, wherein the predicted category label is used to indicate the predicted category of the target object in the corresponding annotated image, and the predicted position label is used to indicate the predicted position of the target object in the corresponding annotated image.

[0128] The specific implementation process of the above S406 is similar to the specific implementation process of the above S404 and will not be repeated here.

[0129] S408, based on the predicted labels and sample labels corresponding to each annotated image in the annotated image set and the first initial pseudo labels and the second initial pseudo labels corresponding to each unannotated image in the unannotated image set, adjust the model parameters of each model in the semi-supervised object detection framework to obtain a semi-supervised object detection model.

[0130] Each annotated image in the annotated image set has a corresponding sample label. The sample label corresponding to each annotated image may include a sample category label and a sample location label corresponding to the annotated image. The sample category label is used to indicate the true category of the target object in the corresponding annotated image, and the sample location label is used to indicate the true location of the target object in the corresponding annotated image.

[0131] In the above S408, the prediction loss corresponding to the semi-supervised object detection framework can be determined based on the predicted label and sample label corresponding to each labeled image in the labeled image set and the first initial pseudo label and the second initial pseudo label corresponding to each unlabeled image in the unlabeled image set; then, based on the prediction loss, the model parameter Θ of the student model is adjusted. s ; Further, the model parameters Θ based on the student model s , adjust the model parameters Θ of the teacher model by the EMA method t .

[0132] For example, the prediction loss corresponding to the annotated image set can be determined based on the prediction label and sample label corresponding to each annotated image in the annotated image set using the following formula (5):

[0133] Among them, L s Represents the prediction loss corresponding to the labeled image set, also known as supervised loss; Represents the category prediction loss corresponding to the first stage detection of the labeled image set, also known as the supervised region classification loss, which is used to represent the difference between the predicted category label and the sample category label of each labeled image in the labeled image set after the first stage detection; Represents the position prediction loss corresponding to the first stage detection of the annotated image set, also known as the supervised region regression loss, which is used to represent the difference between the predicted position label and the sample position label of each annotated image in the annotated image set after the first stage detection; Represents the category prediction loss corresponding to the second-stage detection of the labeled image set, also known as the supervised classification loss, which is used to represent the difference between the predicted category label and the sample category label of each labeled image in the labeled image set after the second-stage detection; It represents the position prediction loss corresponding to the second-stage detection of the labeled image set, also known as the supervised regression loss. It is used to represent the difference between the predicted position label and the sample position label of each labeled image in the labeled image set after the second-stage detection. B represents the total number of labeled images contained in the labeled image set, that is, the number of labeled images used in this round of iterative training.

[0134] And, the prediction loss corresponding to the unlabeled image set is determined based on the first initial pseudo label and the second initial pseudo label of each unlabeled image in the unlabeled image set by the following formula (6):

[0135] Among them, L u Represents the prediction loss corresponding to the unlabeled image set, also known as unsupervised loss; Represents the prediction loss corresponding to the first stage detection of the unlabeled image set, also known as the unsupervised region detection loss, which is used to represent the difference between the first initial pseudo label and the second initial pseudo label obtained after the first stage detection of each unlabeled image in the unlabeled image set; It represents the prediction loss corresponding to the second-stage detection of the unlabeled image set, also known as the unsupervised object detection loss. It is used to represent the difference between the first initial pseudo-label and the second initial pseudo-label obtained for each unlabeled image in the unlabeled image set after the second-stage detection. B represents the total number of unlabeled images contained in the unlabeled image set, that is, the number of unlabeled images used in this round of iterative training.

[0136] Finally, the prediction loss corresponding to the labeled image set and the prediction loss corresponding to the unlabeled image are weightedly summed to obtain the prediction loss of the semi-supervised object detection framework.

[0137] It is worth noting that the above process is only one adjustment process. In actual application, the maximum number of iterations Max can be set. iter Repeat the above adjustment process several times until the maximum number of iterations is reached, and then the semi-supervised object detection model can be obtained.

[0138] S410, performing target detection on the unlabeled image set through the teacher model in the semi-supervised target detection model to obtain pseudo labels corresponding to each unlabeled image in the unlabeled image set.

[0139] The specific implementation process of the above S410 is similar to the specific implementation process of the above S202 and will not be repeated here.

[0140] S412, obtaining the true category distribution information of the unlabeled image set.

[0141] The specific implementation process of the above S412 is similar to the specific implementation process of the above S204 and will not be repeated here.

[0142] S414 , based on the true category distribution information of the unlabeled image set, performing category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set to obtain a target pseudo category label corresponding to each unlabeled image in the unlabeled image set.

[0143] The specific implementation process of the above S414 is similar to the specific implementation process of the above S206 and will not be repeated here.

[0144] S416 , determining a target pseudo label corresponding to each unlabeled image based on the target pseudo category label and pseudo position label corresponding to each unlabeled image in the unlabeled images.

[0145] The specific implementation process of the above S416 is similar to the specific implementation process of the above S208 and will not be repeated here.

[0146] One or more embodiments of the present application provide a label generation method, which performs target detection on an unlabeled image set through a teacher model in a semi-supervised target detection model, and obtains pseudo category labels and pseudo position labels corresponding to each unlabeled image in the unlabeled image set; then, the true category distribution information of the unlabeled images is obtained, and the true category distribution information of the unlabeled image set is used to perform category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set, so as to achieve alignment of the category distribution of the original and biased pseudo category labels corresponding to each unlabeled image with the true distribution of the unlabeled image set, thereby effectively reducing the deviation of the pseudo category labels and abandoning the general assumption that the category distribution of the unlabeled image set is the same as the category distribution of the labeled image set; further, based on the aligned target pseudo category labels and pseudo position labels corresponding to each unlabeled image, the target pseudo labels corresponding to each unlabeled image are determined, which is conducive to improving the quality of the pseudo labels, and the role of the pseudo labels as pseudo true labels in the teacher model is enhanced, which is conducive to improving the detection accuracy of the semi-supervised target detection model.

[0147] The present application also provides a method for training a semi-supervised object detection model. FIG5 is a flow chart of a method for training a semi-supervised object detection model according to an embodiment of the present application. The method may include the following steps:

[0148] S502 , obtaining a labeled image set, sample labels corresponding to each labeled image in the labeled image set, an unlabeled image set, and target pseudo labels corresponding to each unlabeled image in the unlabeled image set.

[0149] The target pseudo-label corresponding to each unlabeled image is generated based on the label generation method provided by one or more embodiments of the present application.

[0150] S504 , iteratively training the semi-supervised object detection model based on the labeled image set, the sample labels corresponding to each labeled image in the labeled image set, the unlabeled image set, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set.

[0151] Optionally, the above S504 includes the following steps:

[0152] D1, the target pseudo label generated by the above label generation method is determined as the third initial pseudo label corresponding to each unlabeled image in the unlabeled image set, and the student model in the semi-supervised target detection model is used to perform target detection on the unlabeled image set to obtain the fourth initial pseudo label corresponding to each unlabeled image in the unlabeled image set.

[0153] The specific implementation process of the above D1 is similar to the specific implementation process of the above S402 and S404. Please refer to the detailed description of S402 and S404 above, and will not be repeated here.

[0154] D2, perform target detection on the annotated image set through the student model to obtain the predicted label corresponding to each annotated image in the annotated image set.

[0155] The specific implementation process of the above D2 is similar to the specific implementation process of the above S406. Please refer to the detailed description of S406 above and it will not be repeated here.

[0156] D3, based on the third initial pseudo label and the fourth initial pseudo label corresponding to each unlabeled image in the unlabeled image set, determines the unsupervised loss of the semi-supervised object detection model.

[0157] The unsupervised loss reflects the loss incurred by the semi-supervised object detection model during the unsupervised learning process. Specifically, it represents the difference between the third and fourth initial pseudo-labels corresponding to each unlabeled image in the unlabeled image set. In practical applications, the unsupervised loss of the semi-supervised object detection model can be determined based on a preset loss function and the third and fourth initial pseudo-labels corresponding to each unlabeled image.

[0158] D4: Determine the supervised loss of the semi-supervised object detection model based on the predicted labels and sample labels corresponding to each annotated image in the annotated image set.

[0159] The supervised loss reflects the loss incurred by the semi-supervised object detection model during the supervised learning process. Specifically, it represents the difference between the predicted labels and the sample labels for each annotated image in the annotated image set. In practical applications, the supervised loss of the semi-supervised object detection model can be determined based on a preset loss function, the predicted labels for each annotated image, and the sample labels.

[0160] D5, adjusts the model parameters of the semi-supervised object detection model based on the weighted sum between the unsupervised loss and the supervised loss.

[0161] Specifically, the weighted sum of the unsupervised loss and the supervised loss is determined as the target detection loss of the semi-supervised target detection model; then, the model parameters of the student model are adjusted through the back-propagation algorithm; further, based on the adjusted model parameters of the student model, the model parameters of the teacher model are adjusted through the EMA method.

[0162] The training method of the semi-supervised target detection model provided in the embodiment of the present application addresses the problem that in the semi-supervised training framework, there are a small number of labeled images and a large number of unlabeled images in the training data, and the training data has an uneven category distribution. The label generation method provided in the embodiment of the present application is used to generate a corresponding target pseudo label for each unlabeled image in the unlabeled image set, and then the semi-supervised target detection model is iteratively trained using the labeled image set, the sample labels corresponding to each labeled image in the labeled image set, the unlabeled image set, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set. Since the target pseudo category labels in the target pseudo labels corresponding to each unlabeled image are pseudo category labels after distribution alignment, the role of the target pseudo labels as pseudo real labels in the teacher model is enhanced, which is beneficial to improving the training effect of the target detection model, so that the target detection model has higher detection accuracy.

[0163] The embodiment of the present application also provides a training method for a semi-supervised target detection model. Please refer to Figure 6, which is a flow chart of a training method for a semi-supervised target detection model provided by an embodiment of the present application. The semi-supervised target detection model trained in this embodiment can be the semi-supervised target detection model for generating target pseudo labels as described above (i.e., the semi-supervised target detection model in the embodiments of Figures 2-4), or it can be other semi-supervised target detection models for achieving target detection. The training method of the semi-supervised target detection model may include the following steps:

[0164] S602: Obtain a set of annotated images and a sample label corresponding to each annotated image in the set of annotated images.

[0165] The annotated image set includes multiple annotated images, each of which has a corresponding sample label (also called a label). The sample label corresponding to each annotated image is used to indicate the true category of the target object in the annotated image within the preset category set and the true location of the target object.

[0166] The preset category set includes multiple categories, and each annotated image in the annotated image set may belong to a different category in the preset category set. The preset category set can be set according to actual needs, and the embodiments of the present application are not limited to this. For example, the classification task in the target detection task is to identify whether the target in the image belongs to a male or a female, then the preset category set may include two categories, male and female; for another example, the classification task in the target detection task is to detect which animal the target in the image belongs to, then the preset category set may include multiple categories such as dog, cat, bear, rabbit, etc.

[0167] S604: Determine the loss weight corresponding to each category in the preset category set based on the true category distribution information of the labeled image set.

[0168] The true category distribution information of the annotated image set is also called the true category distribution, which is used to represent the true distribution of annotated images of different categories in the annotated set, and is specifically used to represent the number of annotated images of each preset category in the preset category set. In practical applications, the true category distribution of the annotated image set can be obtained by statistically analyzing each annotated image in the annotated image set based on the true category represented by the category label corresponding to each annotated image in the annotated image set. For example, the annotated image set includes annotated images 1 to 6, and the preset category set includes category 1 and category 2. By parsing the category labels corresponding to each annotated image, it is found that the target objects in annotated images 1 to 4 all belong to category 1, and the target objects in annotated image 5 and annotated image 6 all belong to category 2. Therefore, the true category distribution information of the annotated image set can be determined as follows: the number of annotated images corresponding to category 1 is 4, and the number of annotated images corresponding to category 2 is 2.

[0169] The loss weight corresponding to each category can be used to represent the size of the loss caused by each category during the training process of the semi-supervised object detection model. After obtaining the true category distribution information of the labeled image set, it can be assumed that the labeled image set and the unlabeled image set follow the same distribution, that is, the proportion of images corresponding to each category in the labeled image set and the unlabeled image set is similar. Then, based on the number of labeled images corresponding to each category in the preset category set, the corresponding loss weight can be determined for each category. Specifically, a smaller loss weight can be assigned to the category with a larger proportion of labeled images, and a larger loss weight can be assigned to the category with a smaller proportion of labeled images. In this way, without changing the category distribution of the original data, the semi-supervised object detection model can be improved under the condition of imbalanced class distribution, which is to improve the bias of the semi-supervised object detection model towards large categories with more data and away from small categories with less data during training. This achieves the effect of rebalancing the bias of the semi-supervised object detection model, thereby improving the prediction bias of the semi-supervised object detection model and improving the prediction accuracy of the semi-supervised object detection model.

[0170] In an optional implementation, to more effectively rebalance the bias of the semi-supervised object detection model, the above S604 may include:

[0171] E1, based on the true category distribution information of the annotated image set, determine the proportion of annotated images corresponding to each category in the preset category set among all annotated images.

[0172] E2, the sum of the proportions of labeled images corresponding to categories other than the target category in the preset category set is determined as the initial weight corresponding to the target category.

[0173] The target category is any category in the preset category set. For example, assuming that the preset category set contains C categories, the proportion of annotated images corresponding to the cth category (c=1,2,…,C) is ρ c , then the initial weight corresponding to this category is 1-ρ c .

[0174] E3, based on the initial weights corresponding to each category in the preset category set, balance the initial weights corresponding to the target category to obtain the loss weight corresponding to the target category.

[0175] Specifically, the initial weights corresponding to the target category are balanced, including: normalizing the initial weights corresponding to the target category based on the initial weights corresponding to each category in the preset category set to obtain a first candidate weight corresponding to the target category; performing an exponential operation on the first candidate weight corresponding to the target category as the base and the sharpening hyperparameter as the exponent to obtain a second candidate weight corresponding to the target category; determining the mean of the second candidate weights corresponding to each category in the preset category set; and determining the ratio between the second candidate weight corresponding to the target category and the mean as the loss weight corresponding to the target category.

[0176] For example, for the c-th category, the initial weight corresponding to the category can be normalized by the following formulas (7) and (8), the first candidate weight corresponding to the category can be sharpened by the following formula (9), and the loss weight corresponding to the category can be determined by the following formula (10).

[0177] Where c = 1, 2, ..., C, C represents the total number of categories contained in the preset category set; ρ c Indicates the proportion of labeled images corresponding to the cth category, 1-ρ c represents the initial weight corresponding to the c-th category, τ represents the normalized hyperparameter, and τ∈(0,1), represents the first candidate weight corresponding to the c-th category; θ represents the sharpening hyperparameter, θ∈[0,1], represents the second candidate weight corresponding to the c-th category; Represents the loss weight corresponding to the c-th category.

[0178] It can be understood that by determining the sum of the proportions of the number of labeled images corresponding to categories other than the target category in the preset category set as the initial weight corresponding to the target category, it can be ensured that the category with a larger proportion of labeled images obtains a smaller loss weight, while the category with a smaller proportion of labeled images obtains a larger loss weight, thereby ensuring that under the condition of uneven class distribution, the situation in which the semi-supervised target detection model tends to be large categories with more data and deviates from small categories with less data during training can be improved, thereby reducing the prediction bias of the semi-supervised target detection model and improving the prediction accuracy of the semi-supervised target detection model; on this basis, considering that the accuracy of the target detection task is affected by both the classification task and the regression task, by balancing the initial weights corresponding to each category, the loss weight corresponding to each category is obtained, which can prevent the situation in which the loss weight used to adjust the regression loss and the loss weight used to adjust the classification loss are not equal during the training process of the semi-supervised target detection model, further improving the prediction bias of the semi-supervised target detection model and improving the prediction accuracy of the semi-supervised target detection model.

[0179] This embodiment of the present application illustrates a specific implementation of S604. It should be understood that S604 can also be implemented in other ways, such as by determining the sum of the proportions of labeled images corresponding to categories other than the target category in the preset category set as the loss weight corresponding to the target category, and this embodiment of the present application does not limit this.

[0180] S606 , performing target detection on the labeled image set using the student model in the semi-supervised target detection model to obtain a predicted label corresponding to each labeled image in the labeled image set.

[0181] A semi-supervised target detection model refers to an artificial intelligence model with target detection capabilities. As shown in Figure 3, the semi-supervised target detection model can include a teacher model (also called a first model) and a student model (also called a second model), wherein both the teacher model and the student model can be used to perform target detection on the input image, specifically including identifying the category of the target object in the input image and detecting the location of the target object. It is worth noting that in actual applications, the accuracy of the teacher model is higher; the accuracy of the student model is relatively lower. During the training process, the target detection results of the teacher model for the input image can be used as augmented data to guide the training of the student model with lower accuracy. The guided training process will be described in detail later.

[0182] In S606, after performing weak enhancement processing on each annotated image in the annotated image set, the image and the sample labels corresponding to each annotated image in the annotated image set are input into the student model. The student model then performs object detection on each annotated image in the annotated image set after the weak enhancement based on the supervisory signal provided by the sample labels corresponding to each annotated image in the annotated image set, thereby obtaining a predicted label corresponding to each annotated image in the annotated image set. The predicted label for each annotated image in the annotated image set includes a predicted category and a predicted position of the target object in each annotated image in the annotated image set.

[0183] In the embodiment of the present application, the student model can have any appropriate structure, such as Faster RCNN with Feature Pyramid Networks (FPN), etc., and can be specifically set according to actual needs, and the embodiment of the present application is not limited to this.

[0184] Optionally, the student model includes a region detection module and a fully connected layer (also called a classifier). The student model can perform target detection on the input image using a two-stage target detection algorithm. In the first stage, the region detection module is used to extract the region proposal network (RPN) and background frame from the input image. In the second stage, the region detection module is used to filter the region of interest (ROI) based on the region proposal frame (also called the foreground frame), and the fully connected layer detects the category and location of the target from the ROI.

[0185] Specifically, in the above S606, multiple anchor frames (Anchors) can be extracted from the annotated image. The multiple anchor frames in the annotated image are classified and subjected to bounding box regression processing by the region detection module to obtain the frame category and frame position of each anchor frame, wherein the frame category of each anchor frame is used to indicate whether the anchor frame is foreground or background; at least one anchor frame with a frame category of foreground is selected from the multiple anchor frames in the annotated image as a candidate region of the annotated image, and the candidate region is linearly classified and subjected to bounding box regression processing by the classifier to obtain the predicted category and predicted position of the target object in the annotated image. In this case, the target detection result corresponding to the annotated image may also include the frame category and frame position corresponding to each anchor frame in the annotated image.

[0186] For example, as shown in Figure 3, the classifier includes a first fully connected layer, a second fully connected layer, and a third fully connected layer. In the first stage (RPN), after obtaining the frame categories and frame positions of multiple anchor frames in the annotated image through the region detection module, anchor frames with a frame category of foreground can be selected from them, and then the non-maximum suppression (NMS) algorithm is used to remove the anchor frames with the lowest probability of belonging to the foreground from these foreground anchor frames, and the remaining anchor frames are used as candidate regions, that is, as the input of the second stage (ROI); in the second stage (ROI), the first fully connected layer in the classifier can be used to perform preliminary image recognition processing on the candidate regions in the annotated image, and then linear classification is performed based on the preliminary image recognition processing results through the second fully connected layer to obtain the predicted category of the target object in the annotated image, and bounding box regression processing is performed based on the preliminary image recognition processing results through the third fully connected layer to obtain the predicted position of the target object in the annotated image.

[0187] In practical applications, the fully connected layer used for linear classification in the classifier By structure encoder and a linear classifier followed by Composition, structure encoder is the representation layer before the fully connected layer of the region of interest in the student model (backbone network), where θ and φ are the model and The backbone network can be a ResNet-50 network pre-trained on ImageNet.

[0188] S608 , performing target detection on the unlabeled image set using the teacher model and the student model, respectively, to obtain a first initial pseudo label and a second initial pseudo label for each unlabeled image in the unlabeled image set.

[0189] Specifically, each unlabeled image can be subjected to weak enhancement and strong enhancement processing respectively. In conjunction with Figure 3, the weakly enhanced unlabeled image is input into the teacher model for target detection to obtain the first initial pseudo label of the unlabeled image, and the strongly enhanced unlabeled image is input into the student model for target detection to obtain the second initial pseudo label of the unlabeled image. The first initial pseudo label of the unlabeled image includes the first predicted category and the first predicted position of the target object in the unlabeled image, and the second initial pseudo label of the unlabeled image includes the second predicted category and the second predicted position of the target object in the unlabeled image.

[0190] For example, an unlabeled image x u Weak enhancement α(x u ) is input into the teacher model for linear classification, and the linear classification prediction is p=p(T,c) (α(x u ))=f(α(x u )), c=1,2,…,C, the classification prediction uses the activation function to get the first prediction category The first predicted category can be used as the unlabeled image x u The corresponding pseudo category label. Similarly, the unlabeled image x u Weak enhancement Then input it into the student model for linear classification, and the linear classification prediction is The classification prediction uses the activation function to obtain the second prediction category

[0191] In the embodiment of the present application, the teacher model can have any appropriate structure, such as Faster RCNN with FPN, etc., and can be set according to actual needs. The embodiment of the present application does not limit this.

[0192] Optionally, the teacher model and the student model may have the same structure. The teacher model may also include a region detection module and a classifier, and the target detection performed by the teacher model on the input image may also be implemented using the two-stage target detection algorithm described above.

[0193] Specifically, with reference to FIG3 , in S608 above, target detection is performed on each unlabeled image in the unlabeled image set using the teacher model to obtain a first initial pseudo label corresponding to each unlabeled image in the unlabeled image set, including:

[0194] A plurality of anchor frames are extracted from each unlabeled image in the unlabeled image set, and the plurality of anchor frames in each unlabeled image in the unlabeled image set are classified and subjected to bounding box regression processing by the region detection module in the teacher model to obtain the first frame category and first frame position of each anchor frame, wherein the first frame category of each anchor frame is used to indicate whether the anchor frame is foreground or background; then, at least one anchor frame with a frame category of foreground is selected from the plurality of anchor frames in each unlabeled image in the unlabeled image set as the first candidate region of each unlabeled image in the unlabeled image set, and the first candidate region is subjected to linear classification and bounding box regression processing by the classifier in the teacher model to obtain the first predicted category and first predicted position of the target object in each unlabeled image in the unlabeled image set. In this case, the first initial pseudo-label corresponding to each unlabeled image in the unlabeled image set may also include the first frame category and first frame position corresponding to each anchor frame in each unlabeled image in the unlabeled image set.

[0195] It is worth noting that the process of target detection of unlabeled images by the teacher model is similar to the process of target detection of labeled images by the student model mentioned above, so we will not go into details here.

[0196] 3 , in S608 above, target detection is performed on each unlabeled image in the unlabeled image set using the student model to obtain a second initial pseudo label for each unlabeled image in the unlabeled image set, including:

[0197] Multiple anchor frames are extracted from each unlabeled image in the unlabeled image set. The region detection module in the student model performs classification and bounding box regression on the multiple anchor frames in each unlabeled image in the unlabeled image set to obtain a second frame category and a second frame position for each anchor frame, wherein the second frame category of each anchor frame is used to indicate whether the anchor frame is foreground or background. Next, at least one anchor frame with a foreground frame category is selected from the multiple anchor frames in each unlabeled image in the unlabeled image set as a second candidate region for each unlabeled image in the unlabeled image set. Linear classification and bounding box regression are performed on the second candidate region by the classifier in the student model to obtain a second predicted category and a second predicted position for the target object in each unlabeled image in the unlabeled image set. In this case, the second initial pseudo-label corresponding to each unlabeled image in the unlabeled image set may also include the second frame category and the second frame position corresponding to each anchor frame in each unlabeled image in the unlabeled image set.

[0198] It is worth noting that the process of the student model performing target detection on unlabeled images is similar to the process of the student model performing target detection on labeled images mentioned above, so it will not be repeated here.

[0199] S610, adjusting the model parameters of the semi-supervised object detection model based on the predicted labels and sample labels corresponding to each labeled image in the labeled image set, the first initial pseudo-label and the second initial pseudo-label corresponding to each unlabeled image in the unlabeled image set, and the loss weight corresponding to each category in the preset category set.

[0200] Among them, the model parameters of the semi-supervised target detection model can include the model parameters Θ of the teacher model t and the model parameters Θ of the student model s The model parameters of the teacher model may include, but are not limited to, the number of nodes (such as neurons) in the teacher model, the connection relationship and connection edge weights between nodes in different network layers, the bias corresponding to the nodes in each network layer, etc. The model parameters of the student model may include, but are not limited to, the number of nodes in the student model, the connection relationship and connection edge weights between nodes in different network layers, the bias corresponding to the nodes in each network layer, etc.

[0201] Since the training process of the semi-supervised object detection model includes a supervised learning task based on labeled images in the labeled image set and an unsupervised learning task based on unlabeled images in the unlabeled image set, both learning tasks will bring certain prediction losses. In order to improve the training effect of the semi-supervised object detection model, in an optional implementation, the above S610 may include the following steps:

[0202] F1 determines the supervised loss of the semi-supervised object detection model based on the object detection results and sample labels of the predicted labels corresponding to each annotated image in the annotated image set, and the loss weight corresponding to the category represented by the category label corresponding to each annotated image in the annotated image set.

[0203] The supervised loss of the semi-supervised object detection model represents the loss incurred by the semi-supervised object detection model during supervised learning tasks. In the aforementioned F1, by introducing the category-specific loss weights represented by the category labels corresponding to each annotated image when calculating the supervised loss, this eliminates the need to change the category distribution of the annotated images in the annotated image set. Instead, it improves the situation where, under conditions of imbalanced class distribution, the semi-supervised object detection model tends to favor large categories with more data and deviate from small categories with less data during supervised training. This helps rebalance the bias of the semi-supervised object detection model, thereby improving its prediction bias and enhancing its prediction accuracy.

[0204] Since target detection for each labeled image in the labeled image set includes two tasks: linear classification and bounding box regression processing, each task will also cause a certain amount of supervised loss. Based on this, in order to more accurately determine the supervised loss, the above-mentioned F1 may include: determining the supervised classification loss of the semi-supervised target detection model based on the loss weight corresponding to the true category of the target object in each labeled image in the labeled image set, and the difference between the true category and the predicted category of the target object in each labeled image in the labeled image set; determining the supervised regression loss of the semi-supervised target detection model based on the difference between the true position and the predicted position of the target object in each labeled image in the labeled image set; and determining the supervised loss based on the supervised classification loss and the supervised regression loss.

[0205] Among them, the supervised classification loss is used to represent the loss caused by performing a linear classification task on each labeled image in the labeled image set, which can reflect the difference between the predicted category and the true category of the target object in each labeled image in the labeled image set.

[0206] For example, the supervised classification loss can be determined by the following formula (11):

[0207] in, represents supervised classification loss, CE represents cross entropy loss function, Indicates the i-th labeled image in the labeled image set, N l Indicates the total number of annotated images contained in the annotated image set, Indicates annotated images The corresponding category label, Indicates annotated images The corresponding prediction category, Represents the loss weight corresponding to the true category represented by the category label corresponding to the annotated image.

[0208] It can be understood that when determining the supervised classification loss of the semi-supervised target detection model, the loss weight corresponding to the true category of the target object in each annotated image in the annotated image set is introduced. This can effectively improve the situation where the semi-supervised target detection model tends to be biased towards large categories with more data and deviates from small categories with less data during the supervised learning process under the condition of uneven class distribution. This is conducive to rebalancing the bias of the semi-supervised target detection model, thereby improving the prediction bias of the semi-supervised target detection model and improving the prediction accuracy of the semi-supervised target detection model.

[0209] The supervised regression loss represents the loss incurred by performing bounding box regression on each annotated image in the annotated image set. It can reflect the difference between the predicted and true locations of the target objects in each annotated image in the annotated image set. For example, the supervised regression loss can be represented by the sum of the distances between the predicted and true locations of the target objects in each annotated image in the annotated image set.

[0210] After obtaining the supervised classification loss and the supervised regression loss, the supervised loss can be calculated in various appropriate ways. Optionally, the sum of the supervised classification loss and the supervised regression loss can be determined as the supervised loss. Optionally, considering that in the case of a two-stage target detection algorithm, a certain supervised loss will be caused in the process of classifying and regressing the bounding boxes of each anchor box in the labeled image. Based on this, in order to more accurately determine the supervised loss, the supervised region classification loss of the semi-supervised target detection model can also be determined based on the box categories corresponding to the multiple anchor boxes in each labeled image in the labeled image set and the category labels corresponding to each labeled image in each labeled image set, as well as the box positions corresponding to the multiple anchor boxes in each labeled image in the labeled image set and the box positions corresponding to the multiple anchor boxes in each labeled image in the labeled image set. Position label, determine the supervised region regression loss of the semi-supervised target detection model, wherein the supervised region classification loss is used to represent the difference between the box category corresponding to each anchor box in each annotated image in the annotated image set and the category label corresponding to each annotated image, and the supervised region regression loss is used to represent the difference between the predicted position corresponding to each anchor box in each annotated image in the annotated image set and the position label corresponding to each annotated image; further, the sum of the supervised region classification loss, the supervised region regression loss, the supervised classification loss and the supervised regression loss is determined as the supervised loss, which is shown in the following formula (12):

[0211] Among them, L s Indicates that there is supervision loss, represents the supervised region classification loss, represents the supervised region regression loss, represents the supervised classification loss, represents the supervised regression loss, and B represents the number of labeled images used in this round of iterative training.

[0212] F2 determines the unsupervised loss of the semi-supervised object detection model based on the first initial pseudo-label and the second initial pseudo-label corresponding to each unlabeled image in the unlabeled image set, and the loss weight corresponding to the predicted category represented by the first initial pseudo-label of each unlabeled image in the unlabeled image set.

[0213] The unsupervised loss of the semi-supervised object detection model is used to represent the loss incurred by the semi-supervised object detection model during unsupervised learning tasks. In the above F2, by using the second initial pseudo-label corresponding to each unlabeled image in the unlabeled image set as the pseudo-label and introducing the loss weight corresponding to the predicted category represented by the first initial pseudo-label corresponding to each unlabeled image in the unlabeled image set when calculating the unsupervised loss, it is possible to improve the situation where, under conditions of imbalanced class distribution, the semi-supervised object detection model is biased towards large categories with more data and deviates from small categories with less data during unsupervised training. This is conducive to rebalancing the bias of the semi-supervised object detection model, thereby improving the prediction bias of the semi-supervised object detection model and improving the prediction accuracy of the semi-supervised object detection model.

[0214] Since target detection for each unlabeled image in the unlabeled image set includes two tasks: linear classification and bounding box regression processing, each task will also cause a certain amount of unsupervised loss. Based on this, in order to more accurately determine the unsupervised loss, the above-mentioned F2 may include: determining the unsupervised classification loss of the semi-supervised target detection model based on the loss weight corresponding to the first predicted category of the target object in each unlabeled image in the unlabeled image set, and the difference between the first predicted category and the second predicted category of the target object in each unlabeled image in the unlabeled image set; determining the unsupervised regression loss of the semi-supervised target detection model based on the difference between the first predicted position and the second predicted position of the target object in each unlabeled image in the unlabeled image set; and determining the unsupervised loss based on the unsupervised classification loss and the unsupervised regression loss.

[0215] Among them, the unsupervised classification loss is used to represent the loss caused by performing a linear classification task on each unlabeled image in the unlabeled image set, which can reflect the difference between the first predicted category and the second predicted category of the target object in each unlabeled image in the unlabeled image set.

[0216] For example, the unsupervised classification loss can be determined by the following formula (13):

[0217] in, Represents unsupervised classification loss; CE represents cross entropy loss function; N μ Indicates the total number of unlabeled images contained in the unlabeled image set; represents the first predicted category corresponding to the i-th unlabeled image in the unlabeled image set, which can be used as the pseudo category label corresponding to the unlabeled image; represents the second predicted category corresponding to the i-th unlabeled image in the unlabeled image set; Represents the loss weight corresponding to the first predicted category of the unlabeled image.

[0218] It can be understood that when determining the unsupervised classification loss of the semi-supervised target detection model, the loss weight corresponding to the first predicted category of the target object in each unlabeled image in the unlabeled image set is introduced, which can effectively improve the situation where the semi-supervised target detection model tends to be biased towards large categories with more data and deviates from small categories with smaller data in the unsupervised learning process under the condition of uneven class distribution. This is conducive to rebalancing the bias of the semi-supervised target detection model, thereby improving the prediction bias of the semi-supervised target detection model and improving the prediction accuracy of the semi-supervised target detection model.

[0219] The unsupervised regression loss is used to represent the loss caused by performing the bounding box regression processing task on each unlabeled image in the unlabeled image set, which can reflect the difference between the first predicted position and the second predicted position of the target object in each unlabeled image in the unlabeled image set. For example, the unsupervised loss can be represented based on the sum of the distances between the first predicted position and the second predicted position of the target object in each unlabeled image in the unlabeled image set, that is, in, represents the unsupervised loss, represents the first predicted position of the target object in the i-th first candidate region in the j-th unlabeled image in the unlabeled image set, represents the second predicted position of the target object in the second candidate region i in the jth unlabeled image, s P Represents the number of first candidate regions in the jth unlabeled image. It can be understood that in this calculation method, the number of first candidate regions obtained by the teacher model is equivalent to being used as a benchmark. Since the number of first candidate regions obtained by the teacher model is more accurate than the second candidate regions obtained by the student model, this can further improve the unsupervised learning effect of the semi-supervised object detection model, thereby helping to improve the prediction accuracy of the semi-supervised object detection model.

[0220] After obtaining the unsupervised classification loss and the unsupervised regression loss, the unsupervised loss can be calculated in various appropriate ways. Optionally, the sum of the unsupervised classification loss and the unsupervised regression loss can be determined as the unsupervised loss. Optionally, considering that when a two-stage target detection algorithm is adopted, a certain unsupervised loss will be caused in the process of classifying and regressing the bounding box of each anchor box in each unlabeled image in the unlabeled image set. Based on this, in order to more accurately determine the unsupervised loss, the unsupervised region classification loss of the semi-supervised target detection model can be determined based on the first frame category and the second frame category corresponding to each of the multiple anchor boxes in each unlabeled image in the unlabeled image set, and the unsupervised region regression loss of the semi-supervised target detection model can be determined based on the first frame position and the second frame position corresponding to each of the multiple anchor boxes in each unlabeled image in the unlabeled image set, wherein the unsupervised region classification loss is used to represent the unsupervised region classification loss of each unlabeled image in the unlabeled image set. The unsupervised region regression loss is used to represent the difference between the first frame category and the second frame category corresponding to each anchor frame in each unlabeled image in the unlabeled image set; further, the sum of the unsupervised region classification loss and the unsupervised region regression loss is determined as the unsupervised region detection loss of the semi-supervised target detection model, as shown in the following formula (14); and the sum of the unsupervised classification loss and the unsupervised regression loss is determined as the unsupervised object detection loss of the semi-supervised target detection model, as shown in the following formula (15); finally, the sum of the unsupervised region detection loss and the unsupervised object detection loss is determined as the unsupervised loss, as shown in the following formula (16).

[0221] in, represents the unsupervised region detection loss corresponding to the j-th unlabeled image, BCE represents the binary cross entropy function, and s A represents the number of anchor boxes contained in the j-th unlabeled image, represents the first box category of the i-th anchor box in the j-th unlabeled image, represents the second box category of the i-th anchor box in the j-th unlabeled image, represents the first predicted position of the i-th anchor box in the j-th unlabeled image, represents the second predicted position of the i-th anchor box in the j-th unlabeled image; represents the unsupervised object detection loss corresponding to the j-th unlabeled image, represents the unsupervised classification loss corresponding to the j-th unlabeled image, represents the unsupervised regression loss corresponding to the jth unlabeled image; L urepresents the unsupervised loss, and B represents the number of unlabeled images used in this round of iterative training.

[0222] F3 updates the model parameters of the semi-supervised object detection model based on supervised loss and unsupervised loss.

[0223] Optionally, the above F3 may include: weighted summing of the supervised loss and the unsupervised loss to obtain the target detection loss of the semi-supervised target detection model; then, based on the target detection loss and the back propagation algorithm, updating the model parameters of the teacher model and the model parameters of the student model respectively.

[0224] The target detection loss of the semi-supervised target detection model is used to represent the total detection loss caused by the semi-supervised target detection model during the semi-supervised training process. For example, the target detection loss of the semi-supervised target detection model can be determined by the following formula: total =L s +λL u , where L total represents the target detection loss, L s Indicates supervised loss, L u Represents the unsupervised loss, λ represents the weight corresponding to the unsupervised loss, and the weight can be set according to actual needs, which is not limited in the embodiment of the present application.

[0225] Optionally, the above F3 may include: weighted summation of the supervised loss and the unsupervised loss to obtain the target detection loss of the semi-supervised target detection model; updating the model parameters of the student model based on the target detection loss and the back propagation algorithm; updating the model parameters of the teacher model based on the adjusted model parameters of the student model and the exponential moving average algorithm.

[0226] For example, after determining the target detection loss, the student model can be reversely derived according to the back propagation algorithm and the target detection loss and the model parameters Θ of the student model can be updated. s Then, using the Exponential Moving Average (EMA) algorithm, the model parameters Θ of the teacher model are updated by the following formula: t :Θ t =αΘ t +(1-α)Θ s , where α represents the model parameter weight, which can be set according to actual needs and is not limited in this embodiment of the present application.

[0227] It is understandable that it is more efficient to update the model parameters of the student model first and then update the model parameters of the teacher model based on the EMA algorithm and the model parameters of the student model.

[0228] The embodiment of the present application shows a specific implementation of the above S610. Of course, it should be understood that the above S610 can also be implemented in other ways, and the embodiment of the present application does not limit this.

[0229] It is worth noting that the above S602 to S610 are only one iterative training process. In actual applications, multiple iterative trainings can be performed until the preset training stop condition is met. The semi-supervised target detection model obtained after the last iterative training can be used to generate target pseudo labels or perform target detection on the image to be detected. Among them, the preset training stop condition can be set according to actual needs, for example, when the number of iterative trainings reaches the preset maximum number of iterative trainings Max iter , the embodiments of this application do not limit this.

[0230] One or more embodiments of the present application provide a training method for a semi-supervised target detection model, assuming that the labeled image set and the unlabeled image set follow the same distribution, and on this basis, based on the true category distribution information of the labeled set, predict the loss weights corresponding to different categories, and in the process of training the semi-supervised target detection model using the unlabeled images in the unlabeled image set, the labeled image set, and the sample labels corresponding to each labeled image in the labeled image set, introduce the loss weights corresponding to different categories. This does not require changing the category distribution of the original data, but instead improves the situation where, under the condition of uneven class distribution, the semi-supervised target detection model tends to favor large categories with more data and deviates from small categories with less data during training, thereby achieving the effect of rebalancing the bias of the semi-supervised target detection model, thereby improving the prediction bias of the semi-supervised target detection model and improving the prediction accuracy of the semi-supervised target detection model.

[0231] Based on the training method for a semi-supervised object detection model provided in the embodiments of this application, the trained semi-supervised object detection model can be applied to any scenario requiring object detection in images, including but not limited to access control, liveness detection, and autonomous driving. The application process based on the semi-supervised object detection model is described below.

[0232] The present application also provides an object detection method that can detect objects in an image based on the trained semi-supervised object detection model. FIG7 is a flow chart of an object detection method provided in one embodiment of the present application. The method may include the following steps:

[0233] S702: Acquire an image to be detected.

[0234] S704: Perform target detection on the image to be detected using the target model in the semi-supervised target detection model to obtain a target detection result corresponding to the image to be detected.

[0235] Among them, the semi-supervised target detection model includes a teacher model and a student model, and the target model includes a teacher model and / or a student model.

[0236] In one implementation, the semi-supervised target detection model is trained based on a set of labeled images and the sample labels corresponding to the labeled images, a set of unlabeled images and the target pseudo labels corresponding to the unlabeled images, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set are generated based on the label generation method provided in the embodiments of the present application.

[0237] In one implementation, the semi-supervised target detection model is obtained by semi-supervised training based on the training method of the semi-supervised target detection model provided in the above embodiment of the present application.

[0238] Alternatively, as shown in FIG8 , the image to be detected may be weakly enhanced, and then the teacher model may be used to detect the category of the target object in the weakly enhanced image to be detected, thereby obtaining a category detection result corresponding to the image to be detected, and the position of the target object in the image to be detected may be detected to obtain a position detection result corresponding to the image to be detected. In other words, the target detection result corresponding to the image to be detected includes the category detection result and the position detection result corresponding to the image to be detected.

[0239] More specifically, the teacher model can include a region detection module and a fully connected layer. The region detection module is used to extract the region of interest of the image to be detected, and the fully connected layer is used to classify the image based on the region of interest to obtain the category detection result corresponding to the image to be detected, and to perform bounding box regression processing based on the region of interest of the image to be detected to obtain the position detection result of the image to be detected.

[0240] More specifically, as shown in Figure 8, the region detection module can adopt a two-stage Fast R-CNN region detection network, wherein the region detection network in the first stage is used to extract the region proposal network (RPN) where the target object may exist from the image to be detected, and the region detection network in the second stage extracts the region of interest (ROI) containing the target object from the region candidate box of the image to be detected.

[0241] The fully connected layer may include a first fully connected layer, a second fully connected layer and a third fully connected layer, wherein the first fully connected layer is used to perform preliminary image recognition processing on the region of interest of the image to be detected to obtain the target object in the region of interest; the second fully connected layer is used to perform linear classification on the target object based on the image feature information of the region of interest to obtain the category detection result corresponding to the image to be detected; the third fully connected layer is used to perform bounding box regression processing on the target object based on the image feature information of the region of interest to obtain the position detection result corresponding to the image to be detected.

[0242] Optionally, the image to be detected can be strongly enhanced, and then the category of the target object in the strongly enhanced image to be detected can be detected by the student model to obtain the category detection result corresponding to the image to be detected, and the position detection result corresponding to the image to be detected can be obtained by detecting the position of the target object in the image to be detected.

[0243] Optionally, the image to be detected can be weakly enhanced and then input into the teacher model for target detection, and the image to be detected can be strongly enhanced and then input into the student model for target detection; further, the results obtained by the two models for target detection on the image to be detected are combined to determine the final target detection result of the image to be detected.

[0244] The target detection method provided by the embodiment of the present application can accurately perform target detection on the image to be detected using the trained semi-supervised target detection model. Since the target pseudo-labels corresponding to the unlabeled images used in the training process of the semi-supervised target detection model are obtained based on the target pseudo-category labels and pseudo-position labels after distribution alignment, the role of the target pseudo-labels as pseudo-true labels in the teacher model is improved, and the trained target detection model has higher detection accuracy; on this basis, using the trained target detection model to perform target detection on the image to be detected is conducive to improving the accuracy and reliability of the target detection results.

[0245] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0246] Corresponding to the label generation method shown in FIG2 , an embodiment of the present application further provides a label generation device. FIG9 is a schematic diagram of a label generation device 900 provided in an embodiment of the present application. The device 900 includes:

[0247] A detection unit 910 is configured to perform target detection on an unlabeled image set using a teacher model in a semi-supervised target detection model, and obtain a pseudo-label corresponding to each unlabeled image in the unlabeled image set, wherein the pseudo-label includes a pseudo-category label and a pseudo-position label. The pseudo-category label is used to indicate the category of the target object in the corresponding unlabeled image, and the pseudo-position label is used to indicate the position of the target object in the corresponding unlabeled image.

[0248] An estimation unit 920 is configured to obtain true category distribution information of the unlabeled image set;

[0249] an alignment unit 930 configured to perform category distribution alignment processing on the pseudo category labels corresponding to the unlabeled images in the unlabeled image set based on the true category distribution information of the unlabeled image set, so as to obtain target pseudo category labels corresponding to the unlabeled images in the unlabeled image set;

[0250] The determining unit 940 is configured to determine a target pseudo label corresponding to each unlabeled image based on the target pseudo category label and pseudo position label corresponding to each unlabeled image in the unlabeled images.

[0251] Optionally, when the alignment unit 930 performs category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set based on the true category distribution information of the unlabeled image set to obtain the target pseudo category labels corresponding to each unlabeled image in the unlabeled image set, the alignment unit 930 performs the following steps:

[0252] Determining a weight corresponding to each unlabeled image based on the entropy of the pseudo category label corresponding to each unlabeled image in the unlabeled image set;

[0253] Based on the true category distribution information of the unlabeled image set, the pseudo category label corresponding to each unlabeled image in the unlabeled image set is corrected to obtain a candidate pseudo category label corresponding to each unlabeled image;

[0254] Based on the candidate pseudo-category labels and weights corresponding to the unlabeled images in the unlabeled image set, the variable values ​​of the dual variables are optimized to obtain the target variable values ​​of the dual variables:

[0255] A target pseudo category label corresponding to each unlabeled image is determined based on the target variable value of the dual variable and the candidate pseudo category label corresponding to each unlabeled image in the unlabeled image set.

[0256] Optionally, the candidate pseudo-category labels include candidate probabilities that the corresponding unlabeled images belong to each preset category in the preset category set;

[0257] The alignment unit 930 performs the following steps when optimizing the variable value of the dual variable based on the candidate pseudo-category labels and weights corresponding to each unlabeled image in the unlabeled image set to obtain the target variable value of the dual variable:

[0258] In the t-th optimization process, based on the variable value of the dual variable in the t-1th optimization process, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, and the weight corresponding to each unlabeled image, the variable value of the dual variable in the t-th optimization process is determined, where t is a positive integer, and the variable value of the dual variable in the 0th optimization process is the preset variable value;

[0259] When the t-th optimization process satisfies the maximum number of optimization processes, the variable value of the dual variable at the t-th optimization process is determined as the target variable value of the dual variable.

[0260] Optionally, the dual variable includes a first dual variable and a second dual variable, the variable value of the first dual variable during the t-th optimization process includes the variable value of the first dual variable corresponding to each unlabeled image during the t-th optimization process, and the variable value of the second dual variable during the t-th optimization process includes the variable value of the second dual variable corresponding to each preset category during the t-th optimization process;

[0261] The alignment unit 930 performs the following steps when determining the variable value of the dual variable at the t-th optimization process based on the variable value of the dual variable at the t-1th optimization process, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, and the weight corresponding to each unlabeled image:

[0262] If t is an odd number or t is equal to the maximum number of optimization processing times, the variable values ​​of the second dual variable corresponding to the respective preset categories at the t-1th optimization processing are determined as the variable values ​​of the second dual variable corresponding to the respective preset categories at the tth optimization processing, and based on the variable values ​​of the second dual variable corresponding to the respective preset categories at the t-1th optimization processing, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, and the weight corresponding to each unlabeled image, the variable values ​​of the first dual variable corresponding to each unlabeled image at the tth optimization processing are determined; or

[0263] If t is an even number and t is not equal to the maximum number of optimization processing times, the variable values ​​of the first dual variable corresponding to each unlabeled image at the t-1th optimization processing are determined as the variable values ​​of the first dual variable corresponding to each unlabeled image at the t-1th optimization processing, and based on the variable values ​​of the first dual variable corresponding to each unlabeled image at the t-1th optimization processing, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, the weight corresponding to each unlabeled image, and the number of unlabeled images in the unlabeled image set belonging to each preset category, the variable values ​​of the second dual variable corresponding to each preset category at the tth optimization processing are determined.

[0264] Optionally, the true category distribution information of the unlabeled image set includes the number of unlabeled images in the unlabeled image set that belong to each preset category, and the pseudo category labels include the initial probabilities that the corresponding unlabeled images belong to each preset category;

[0265] The alignment unit 930 performs the following steps when correcting the pseudo category labels corresponding to the unlabeled images in the unlabeled image set based on the true category distribution information of the unlabeled image set to obtain candidate pseudo category labels corresponding to the unlabeled images:

[0266] Based on the initial probability that each unlabeled image in the unlabeled image set belongs to the target category, the top image with the highest initial probability of belonging to the target category is selected from the unlabeled image set. Unlabeled images are obtained to obtain a subset of unlabeled images corresponding to the target category, where: is smaller than the number of unlabeled images belonging to the target category in the unlabeled image set;

[0267] traversing each unlabeled image in the unlabeled set, and if the currently traversed unlabeled image belongs to the subset of unlabeled images corresponding to the target category, determining the initial probability that the currently traversed unlabeled image belongs to the target category as the candidate probability that the currently traversed unlabeled image belongs to the target category; the target category is any one of the preset categories;

[0268] If the currently traversed unlabeled image does not belong to the unlabeled image subset corresponding to the target category, the initial probability that the currently traversed unlabeled image belongs to the target category is corrected to a preset probability to obtain a candidate probability that the currently traversed unlabeled image belongs to the target category.

[0269] Optionally, the pseudo category labels include initial probabilities that the corresponding unlabeled images belong to each preset category in the preset category set;

[0270] When acquiring the true category distribution information of the unlabeled image set, the estimation unit 920 performs the following steps:

[0271] If the labeled image set and the unlabeled image set do not follow the same distribution, then based on the initial probability that each unlabeled image in the unlabeled image set belongs to each preset category, determine a confusion matrix and the sum of the initial probabilities corresponding to each preset category, wherein the row vectors of the confusion matrix represent the initial probabilities that the unlabeled images belong to each preset category;

[0272] Based on the product of the confusion matrix and the sum of the initial probabilities corresponding to the preset categories, the true category distribution information of the unlabeled image set is estimated.

[0273] Optionally, when acquiring the true category distribution information of the unlabeled image set, the estimating unit 920 performs the following steps:

[0274] If the labeled image set and the unlabeled image set follow the same distribution, determining the true category distribution information of the labeled image set based on the category labels corresponding to each labeled image in the labeled image set;

[0275] The true category distribution information of the labeled image is used as the true category distribution information of the unlabeled image.

[0276] Optionally, the detection unit 910 is further configured to:

[0277] Before performing target detection on the unlabeled image set using the teacher model in the semi-supervised target detection model, target detection is performed on the unlabeled image set using the teacher model in the semi-supervised target detection framework to obtain a first initial pseudo label corresponding to each unlabeled image in the unlabeled image set;

[0278] Performing target detection on the unlabeled image set using the student model in the semi-supervised target detection framework, obtaining a second initial pseudo label corresponding to each unlabeled image in the unlabeled image set;

[0279] Performing target detection on the annotated image set using the student model to obtain a predicted label corresponding to each annotated image in the annotated image set;

[0280] The label generating device 900 further includes:

[0281] An adjustment unit is used to adjust the model parameters of each model in the semi-supervised object detection framework based on the predicted label and sample label corresponding to each annotated image in the annotated image set, and the first initial pseudo label and the second initial pseudo label corresponding to each unannotated image in the unannotated image set, so as to obtain the semi-supervised object detection model.

[0282] The teacher model includes a region detection module and a fully connected layer, and the student model has the same model structure as the teacher model;

[0283] The region detection module is used to detect the region of interest of the input image;

[0284] The fully connected layer is used to perform classification based on the region of interest of the input image to obtain a category label corresponding to the input image, and to perform bounding box regression processing based on the region of interest of the input image to obtain a pseudo position label corresponding to the input image.

[0285] Obviously, the label generation device provided in the embodiment of the present application can serve as the execution subject of the label generation method shown in Figure 2. For example, in the label generation method shown in Figure 2, step S202 can be executed by the detection unit 910 in the label generation device shown in Figure 9, step S204 can be executed by the estimation unit 920 in the label generation device shown in Figure 9, step S206 can be executed by the alignment unit 930 in the label generation device shown in Figure 9, and step S208 can be executed by the determination unit 940 in the label generation device shown in Figure 9.

[0286] According to another embodiment of the present application, the various units in the label generation device shown in Figure 9 can be individually or all combined into one or several other units to form, or one (or some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the label generation device may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0287] According to another embodiment of the present application, a label generation device as shown in FIG9 can be constructed, and the label generation method of the embodiment of the present application can be implemented by running a computer program (including program code) capable of executing each step involved in the corresponding method shown in FIG2 on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. The computer program can be recorded on a computer-readable storage medium, for example, and transferred to an electronic device through the computer-readable storage medium and run therein.

[0288] Corresponding to the training method for the semi-supervised object detection model shown in FIG5 , an embodiment of the present application also provides a training device for a semi-supervised object detection model. Referring to FIG10 , a schematic diagram of a training device 1000 for a semi-supervised object detection model provided in one embodiment of the present application is shown. The device 1000 includes:

[0289] An acquisition unit 1010 is configured to acquire a set of annotated images, sample labels corresponding to each annotated image in the annotated image set, a set of unannotated images, and target pseudo labels corresponding to each unannotated image in the unannotated image set, wherein the target pseudo labels corresponding to each unannotated image are generated based on the label generation method described in the embodiments of the present application.

[0290] The adjustment unit 1020 is used to iteratively train the semi-supervised object detection model based on the annotated image set, the sample labels corresponding to each annotated image in the annotated image set, the unannotated image set, and the target pseudo labels corresponding to each unannotated image in the unannotated image set.

[0291] Optionally, the adjustment unit 1020 performs the following steps when iteratively training the semi-supervised object detection model based on the annotated image set, the sample labels corresponding to each annotated image in the annotated image set, the unannotated image set, and the target pseudo labels corresponding to each unannotated image in the unannotated image set:

[0292] Determining the target pseudo label as a third initial pseudo label, and performing target detection on the unlabeled image set using the student model to obtain a fourth initial pseudo label corresponding to each unlabeled image in the unlabeled image set;

[0293] Performing target detection on the annotated image set using the student model to obtain a predicted label corresponding to each annotated image in the annotated image set;

[0294] determining an unsupervised loss of the semi-supervised object detection model based on a third initial pseudo label and a fourth initial pseudo label corresponding to each unlabeled image in the unlabeled image set;

[0295] Determining a supervised loss of the semi-supervised object detection model based on the predicted label and the sample label corresponding to each annotated image in the annotated image set;

[0296] Based on a weighted sum of the unsupervised loss and the supervised loss, model parameters of the semi-supervised object detection model are adjusted.

[0297] Obviously, the training device for the semi-supervised target detection model provided in the embodiment of the present application can serve as the execution body of the training method for the semi-supervised target detection model shown in Figure 5. For example, in the training method for the semi-supervised target detection model shown in Figure 5, step S502 can be executed by the acquisition unit 1010 in the training device for the semi-supervised target detection model shown in Figure 10, and step S504 can be executed by the adjustment unit 1020 in the training device for the semi-supervised target detection model shown in Figure 10.

[0298] According to another embodiment of the present application, the various units in the training device of the semi-supervised target detection model shown in Figure 10 can be separately or all merged into one or several other units to constitute, or one (some) of the units can be further split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the function of a unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present application, the training device of the semi-supervised target detection model may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0299] According to another embodiment of the present application, a training device for a semi-supervised target detection model as shown in Figure 10 can be constructed, and a training method for a semi-supervised target detection model of an embodiment of the present application can be implemented by running a computer program (including program code) capable of executing each step involved in the corresponding method as shown in Figure 5 on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. The computer program can be recorded on, for example, a computer-readable storage medium, and reproduced in an electronic device through a computer-readable storage medium and run therein.

[0300] Corresponding to the training method for the semi-supervised object detection model shown in FIG6 , an embodiment of the present application further provides a training device for a semi-supervised object detection model. Referring to FIG11 , a schematic diagram of a training device 1100 for a semi-supervised object detection model provided in one embodiment of the present application is shown. The device 1100 includes:

[0301] An acquiring unit 1110 is configured to obtain a set of annotated images and sample labels corresponding to each annotated image in the set of annotated images, wherein the sample labels corresponding to the annotated images are used to indicate the category to which a target object in the annotated image belongs in a preset category set and the position of the target object;

[0302] A determining unit 1120 is configured to determine a loss weight corresponding to each category in the preset category set based on the true category distribution information of the annotated image set;

[0303] a detection unit 1130 configured to perform target detection on the annotated image set using a student model to obtain a predicted label corresponding to each annotated image in the annotated image set, wherein the predicted label is used to indicate a predicted category of a target object in each annotated image in the annotated image set and a predicted position of the target object in each annotated image in the annotated image set;

[0304] The detection unit 1130 is further configured to perform target detection on the unlabeled image set using the teacher model and the student model, respectively, to obtain a first initial pseudo-label and a second initial pseudo-label for each unlabeled image in the unlabeled image set, wherein the first initial pseudo-label is used to represent a first predicted category of a target object in each unlabeled image in the unlabeled image set and a first predicted position of the target object in each unlabeled image in the unlabeled image set, and the second initial pseudo-label is used to represent a second predicted category of a target object in each unlabeled image in the unlabeled image set and a second predicted position of the target object in each unlabeled image in the unlabeled image set;

[0305] An adjustment unit 1140 is configured to adjust the model parameters of the semi-supervised object detection model based on the predicted labels and sample labels corresponding to each annotated image in the annotated image set, the first initial pseudo-label and the second initial pseudo-label corresponding to each unannotated image in the unannotated image set, and the loss weight corresponding to each category in the preset category set.

[0306] Optionally, the true category distribution information of the annotated image set is used to represent the number of annotated images in each category in the preset category set;

[0307] The determining unit 1120 performs the following steps when determining the loss weight corresponding to each category in the preset category set based on the true category distribution information of the labeled image set:

[0308] Based on the true category distribution information of the annotated image set, determining the proportion of the annotated images corresponding to each category in the preset category set among all the annotated images;

[0309] Determine the sum of the proportions of labeled images corresponding to categories other than the target category in the preset category set as the initial weight corresponding to the target category, where the target category is any category in the preset category set;

[0310] Based on the initial weights corresponding to the categories in the preset category set, the initial weights corresponding to the target category are balanced to obtain the loss weights corresponding to the target category.

[0311] Optionally, when the determining unit 1120 performs a balancing process on the initial weight corresponding to the target category based on the initial weights corresponding to each category in the preset category set to obtain the loss weight corresponding to the target category, the determining unit 1120 performs the following steps:

[0312] Based on the initial weights corresponding to the categories in the preset category set, normalizing the initial weight corresponding to the target category to obtain a first candidate weight corresponding to the target category;

[0313] Performing an exponential operation using the first candidate weight corresponding to the target category as a base and the sharpening hyperparameter as an exponent to obtain a second candidate weight corresponding to the target category;

[0314] Determining an average of the second candidate weights corresponding to each category in the preset category set;

[0315] The ratio between the second candidate weight corresponding to the target category and the mean is determined as the loss weight corresponding to the target category.

[0316] Optionally, the sample label includes a category label and a position label, the category label is used to indicate the true category to which the target object in the corresponding annotated image belongs in the preset category set, and the position label is used to indicate the true position of the target object in the corresponding annotated image;

[0317] The adjustment unit 1140 performs the following steps when adjusting the model parameters of the semi-supervised object detection model based on the predicted label and sample label corresponding to each annotated image in the annotated image set, the first initial pseudo label and the second initial pseudo label corresponding to each unannotated image in the unannotated image set, and the loss weight corresponding to each category in the preset category set:

[0318] Determining a supervised loss of the semi-supervised object detection model based on the predicted label, the category label, and the position label corresponding to each annotated image in the annotated image set, and the loss weight corresponding to the category represented by the category label corresponding to each annotated image in the annotated image set;

[0319] determining an unsupervised loss of the semi-supervised object detection model based on a first initial pseudo label and a second initial pseudo label of each unlabeled image in the unlabeled image set, and a loss weight corresponding to a predicted category represented by the first initial pseudo label of each unlabeled image in the unlabeled image set;

[0320] Based on the supervised loss and the unsupervised loss, model parameters of the semi-supervised object detection model are updated.

[0321] Optionally, when updating the model parameters of the semi-supervised object detection model based on the supervised loss and the unsupervised loss, the adjusting unit 1140 performs the following steps:

[0322] Taking a weighted sum of the supervised loss and the unsupervised loss to obtain the target detection loss of the semi-supervised target detection model;

[0323] Based on the target detection loss and the back propagation algorithm, updating the model parameters of the student model;

[0324] Based on the adjusted model parameters of the student model and the exponential moving average algorithm, the model parameters of the teacher model are updated.

[0325] Optionally, the predicted label includes a predicted category and a predicted position of the target object in the corresponding annotated image;

[0326] When determining the supervised loss of the semi-supervised object detection model based on the predicted label, the category label, and the position label corresponding to each annotated image in the annotated image set, and the loss weight corresponding to the category represented by the category label corresponding to each annotated image in the annotated image set, the adjustment unit 1140 performs the following steps:

[0327] determining a supervised classification loss of the semi-supervised object detection model based on a loss weight corresponding to a true category of the target object in each annotated image in the annotated image set and a difference between the true category and the predicted category of the target object in each annotated image in the annotated image set;

[0328] determining a supervised regression loss of the semi-supervised object detection model based on a difference between a true position and a predicted position of a target object in each annotated image in the annotated image set;

[0329] The supervised loss is determined based on the supervised classification loss and the supervised regression loss.

[0330] Optionally, when determining the unsupervised loss of the semi-supervised object detection model based on the first initial pseudo label and the second initial pseudo label of each unlabeled image in the unlabeled image set, and the loss weight corresponding to the predicted category represented by the first initial pseudo label of each unlabeled image in the unlabeled image set, the adjustment unit 1140 performs the following steps:

[0331] determining an unsupervised classification loss of the semi-supervised object detection model based on a loss weight corresponding to a first predicted category of the target object in each unlabeled image in the unlabeled image set and a difference between the first predicted category and a second predicted category of the target object in the unlabeled image;

[0332] determining an unsupervised regression loss of the semi-supervised object detection model based on a difference between a first predicted position and a second predicted position of the target object in each unlabeled image in the unlabeled image set;

[0333] The unsupervised loss is determined based on the unsupervised classification loss and the unsupervised regression loss.

[0334] Optionally, the first initial pseudo-label includes a first box category and a first box position corresponding to each of the multiple anchor boxes in each unlabeled image in the unlabeled image set, wherein the first box category is used to indicate whether the corresponding anchor box is a foreground; the second initial pseudo-label includes a second box category and a second box position corresponding to each of the multiple anchor boxes in each unlabeled image in the unlabeled image set, wherein the second box category is used to indicate whether the corresponding anchor box is a foreground;

[0335] When the detection unit 1130 performs target detection on the unlabeled image set using the teacher model and the student model respectively to obtain a first initial pseudo label and a second initial pseudo label for each unlabeled image in the unlabeled image set, the detection unit 1130 performs the following steps:

[0336] performing classification and frame regression processing on multiple anchor frames of each unlabeled image in the unlabeled image set by the region detection module in the teacher model to obtain a first frame category and a first frame position of each anchor frame, selecting at least one anchor frame whose first frame category is foreground from the multiple anchor frames of each unlabeled image in the unlabeled image set as a first candidate region of each unlabeled image in the unlabeled image set, and performing linear classification and frame regression processing on the first candidate region by the fully connected layer in the teacher model to obtain a first predicted category and a first predicted position of a target object in each unlabeled image in the unlabeled image set;

[0337] The region detection module in the student model is used to classify and perform frame regression processing on multiple anchor frames of each unlabeled image in the unlabeled image set to obtain a second frame category and a second frame position of each anchor frame, and at least one anchor frame with a second frame category of foreground is selected from the multiple anchor frames of each unlabeled image in the unlabeled image set as a second candidate region for each unlabeled image in the unlabeled image set. The fully connected layer in the student model is used to perform linear classification and frame regression processing on the second candidate region to obtain a second predicted category and a second predicted position of the target object in each unlabeled image in the unlabeled image set.

[0338] Optionally, when determining the unsupervised loss of the semi-supervised object detection model based on the first pseudo label and the second pseudo label of each unlabeled image in the unlabeled image set, and the loss weight corresponding to the predicted category represented by the first pseudo label of each unlabeled image in the unlabeled image set, the adjustment unit 1140 further performs the following steps:

[0339] Before determining the unsupervised loss based on the unsupervised classification loss and the unsupervised regression loss, determining an unsupervised region classification loss of the semi-supervised object detection model based on first and second box categories corresponding to a plurality of anchor boxes in each of the unlabeled images in the unlabeled image set;

[0340] determining an unsupervised region regression loss of the semi-supervised object detection model based on first and second frame positions corresponding to a plurality of anchor frames in each of the unlabeled images in the unlabeled image set;

[0341] Determine the sum of the unsupervised region classification loss and the unsupervised region regression loss as the unsupervised region detection loss of the semi-supervised object detection model;

[0342] When determining the unsupervised loss based on the unsupervised classification loss and the unsupervised regression loss, the adjustment unit 1140 performs the following steps:

[0343] Determine the sum of the unsupervised classification loss and the unsupervised regression loss as the unsupervised object detection loss of the semi-supervised object detection model;

[0344] The sum of the unsupervised region detection loss and the unsupervised object detection loss is determined as the unsupervised loss.

[0345] Obviously, the training device of the semi-supervised target detection model provided in the embodiment of the present application can serve as the execution body of the training method of the semi-supervised target detection model shown in Figure 6. For example, in the semi-supervised training method of the target detection model shown in Figure 6, step S602 can be executed by the acquisition unit 1110 in the device of the semi-supervised target detection model shown in Figure 11, step S604 can be executed by the determination unit 1120 in the training device of the semi-supervised target detection model shown in Figure 11, steps S606 and S608 can be executed by the detection unit 1130 in the training device of the semi-supervised target detection model shown in Figure 11, and step S610 can be executed by the adjustment unit 1140 in the training device of the semi-supervised target detection model shown in Figure 1.

[0346] According to another embodiment of the present application, the various units in the training device of the semi-supervised target detection model shown in Figure 11 can be separately or all merged into one or several other units to constitute, or one (some) of the units can be further split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the function of a unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present application, the training device of the semi-supervised target detection model may also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0347] According to another embodiment of the present application, a training device for a semi-supervised target detection model as shown in Figure 11 can be constructed, and a training method for a semi-supervised target detection model of an embodiment of the present application can be implemented by running a computer program (including program code) capable of executing each step involved in the corresponding method as shown in Figure 6 on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM) and other processing elements and storage elements. The computer program can be recorded on, for example, a computer-readable storage medium, and reproduced in an electronic device through a computer-readable storage medium and run therein.

[0348] Corresponding to the target detection method shown in FIG7 , an embodiment of the present application further provides a target detection device. FIG12 is a schematic diagram of a target detection device 1200 provided in an embodiment of the present application. The device 1200 includes:

[0349] An acquisition unit 1210 is configured to acquire an image to be detected;

[0350] The detection unit 1220 is used to perform target detection on the image to be detected through the target model in the semi-supervised target detection model to obtain the target detection result corresponding to the image to be detected; wherein, the semi-supervised target detection model includes a teacher model and a student model, and the target model includes the teacher model and / or the student model.

[0351] In one implementation, the semi-supervised target detection model is trained based on a set of labeled images and the sample labels corresponding to the labeled images, a set of unlabeled images and the target pseudo labels corresponding to the unlabeled images, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set are generated based on the label generation method described in the embodiments of the present application.

[0352] In one implementation, the target detection model is obtained by semi-supervised training based on a semi-supervised training method for a target detection model provided in one or more embodiments of the present application.

[0353] Obviously, the target detection device provided in the embodiment of the present application can serve as the execution subject of the target detection method shown in Figure 7. For example, in the target detection method shown in Figure 7, step S702 can be executed by the acquisition unit 1210 in the target detection device shown in Figure 12, and step S704 can be executed by the detection unit 1220 in the target detection device shown in Figure 12.

[0354] According to another embodiment of the present application, the various units in the target detection device shown in Figure 12 can be separately or all merged into one or several other units to constitute, or one (some) of the units can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present application, the target detection device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0355] According to another embodiment of the present application, a target detection device as shown in Figure 12 can be constructed, and the target detection method of the embodiment of the present application can be implemented by running a computer program (including program code) capable of executing the steps involved in the corresponding method as shown in Figure 7 on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. The computer program can be recorded on, for example, a computer-readable storage medium, and reproduced in an electronic device through a computer-readable storage medium and run therein.

[0356] FIG13 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Referring to FIG13 , at the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include internal memory, such as high-speed random access memory (RAM), and may also include non-volatile memory, such as at least one disk storage device. Of course, the electronic device may also include hardware required for other services.

[0357] The processor, network interface, and memory can be interconnected via an internal bus, such as an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus. These buses can be classified as address buses, data buses, and control buses. For ease of illustration, FIG13 shows only one bidirectional arrow, but this does not imply that there is only one bus or only one type of bus.

[0358] The memory is used to store programs. Specifically, the program may include program code, which includes computer operating instructions. The memory may include internal memory and non-volatile memory, and provides instructions and data to the processor.

[0359] The processor reads the corresponding computer program from the non-volatile memory into the internal memory and then runs it, forming a label generation device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:

[0360] Using the teacher model in the semi-supervised target detection model, target detection is performed on the unlabeled image set to obtain pseudo labels corresponding to each unlabeled image in the unlabeled image set. The pseudo labels include pseudo category labels and pseudo position labels. The pseudo category labels are used to indicate the category of the target object in the corresponding unlabeled image, and the pseudo position labels are used to indicate the position of the target object in the corresponding unlabeled image.

[0361] Obtaining true category distribution information of the unlabeled image set;

[0362] Based on the true category distribution information of the unlabeled image set, performing category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set to obtain the target pseudo category labels corresponding to each unlabeled image in the unlabeled image set;

[0363] Based on the target pseudo category label and the pseudo position label corresponding to each unlabeled image in the unlabeled images, a target pseudo label corresponding to each unlabeled image is determined.

[0364] Alternatively, the processor reads the corresponding computer program from the non-volatile memory into the internal memory and then runs it, forming a training device for the semi-supervised object detection model at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:

[0365] Obtaining a set of labeled images, sample labels corresponding to each labeled image in the set, a set of unlabeled images, and target pseudo labels corresponding to each unlabeled image in the set, wherein the target pseudo labels corresponding to each unlabeled image are generated based on the label generation method according to an embodiment of the present application;

[0366] The semi-supervised object detection model is iteratively trained based on the labeled image set, the sample labels corresponding to each labeled image in the labeled image set, the unlabeled image set, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set.

[0367] Alternatively, the processor reads the corresponding computer program from the non-volatile memory into the internal memory and then runs it, forming a target detection device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:

[0368] Obtaining a set of annotated images and sample labels corresponding to each annotated image in the annotated image set, wherein the sample labels corresponding to the annotated images are used to indicate the category to which a target object in the annotated image belongs in a preset category set and the position of the target object;

[0369] Determining the loss weight corresponding to each category in the preset category set based on the true category distribution information of the annotated image set;

[0370] performing target detection on the annotated image set using a student model, obtaining a predicted label corresponding to each annotated image in the annotated image set, the predicted label being used to represent a predicted category of a target object in each annotated image in the annotated image set and a predicted position of the target object in each annotated image in the annotated image set;

[0371] Performing target detection on the unlabeled image set by the teacher model and the student model, respectively, to obtain a first initial pseudo-label and a second initial pseudo-label for each unlabeled image in the unlabeled image set, wherein the first initial pseudo-label is used to represent a first predicted category of a target object in each unlabeled image in the unlabeled image set and a first predicted position of the target object in each unlabeled image in the unlabeled image set, and the second initial pseudo-label is used to represent a second predicted category of a target object in each unlabeled image in the unlabeled image set and a second predicted position of the target object in each unlabeled image in the unlabeled image set;

[0372] The model parameters of the semi-supervised object detection model are adjusted based on the predicted labels and sample labels corresponding to each annotated image in the annotated image set, the first initial pseudo labels and the second initial pseudo labels corresponding to each unlabeled image in the unlabeled image set, and the loss weights corresponding to each category in the preset category set.

[0373] Alternatively, the processor reads the corresponding computer program from the non-volatile memory into the internal memory and then runs it, forming a target detection device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:

[0374] Obtain the image to be detected;

[0375] The target detection is performed on the image to be detected by the target model in the semi-supervised target detection model to obtain the target detection result corresponding to the image to be detected; wherein, the semi-supervised target detection model includes a teacher model and a student model, the target model includes the teacher model and / or the student model, and the target detection model is obtained by semi-supervised training based on the semi-supervised training method of the target detection model provided in one or more embodiments of the present application. For example, the semi-supervised target detection model is obtained by training based on a set of labeled images and the sample labels corresponding to the labeled images, a set of unlabeled images and the target pseudo labels corresponding to the unlabeled images, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set are generated based on the label generation method provided in the embodiments of the present application.

[0376] The method performed by the label generation device disclosed in the embodiment shown in FIG2 of the present application, or the method performed by the training device of the semi-supervised target detection model disclosed in the embodiment shown in FIG5 of the present application, or the method performed by the target detection device disclosed in the embodiment shown in FIG6 of the present application, or the method performed by the target detection device disclosed in the embodiment shown in FIG7 of the present application, can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor or software instructions. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method.

[0377] The electronic device may also execute the method of Figure 2 and implement the functions of the label generation device in the embodiments shown in Figures 2, 3, and 4, or the electronic device may also execute the method of Figure 5 and implement the functions of the training device for the semi-supervised target detection model in the embodiment shown in Figure 5, or the electronic device may also execute the method of Figure 6 and implement the functions of the training device for the semi-supervised target detection model in the embodiment shown in Figure 6, or the electronic device may also execute the method of Figure 7 and implement the functions of the target detection device in the embodiments shown in Figures 7 and 8. The embodiments of this application will not be repeated here.

[0378] Of course, in addition to software implementation, the electronic device of this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0379] The present application also provides a computer-readable storage medium storing one or more programs. The one or more programs include instructions. When executed by a portable electronic device including multiple application programs, the instructions enable the portable electronic device to perform the method of the embodiment shown in FIG. 2 , and are specifically configured to perform the following operations:

[0380] Using the teacher model in the semi-supervised target detection model, target detection is performed on the unlabeled image set to obtain pseudo labels corresponding to each unlabeled image in the unlabeled image set. The pseudo labels include pseudo category labels and pseudo position labels. The pseudo category labels are used to indicate the category of the target object in the corresponding unlabeled image, and the pseudo position labels are used to indicate the position of the target object in the corresponding unlabeled image.

[0381] Obtaining true category distribution information of the unlabeled image set;

[0382] Based on the true category distribution information of the unlabeled image set, performing category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set to obtain the target pseudo category labels corresponding to each unlabeled image in the unlabeled image set;

[0383] Based on the target pseudo category label and the pseudo position label corresponding to each unlabeled image in the unlabeled images, a target pseudo label corresponding to each unlabeled image is determined.

[0384] Alternatively, when the instruction is executed by a portable electronic device including multiple applications, the portable electronic device can execute the method of the embodiment shown in FIG5 , and specifically perform the following operations:

[0385] Obtaining a set of labeled images, sample labels corresponding to each labeled image in the set, a set of unlabeled images, and target pseudo labels corresponding to each unlabeled image in the set, wherein the target pseudo labels corresponding to each unlabeled image are generated based on the label generation method according to an embodiment of the present application;

[0386] The semi-supervised object detection model is iteratively trained based on the labeled image set, the sample labels corresponding to each labeled image in the labeled image set, the unlabeled image set, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set.

[0387] Alternatively, when the instruction is executed by a portable electronic device including multiple applications, the portable electronic device can execute the method of the embodiment shown in FIG6 , and specifically perform the following operations:

[0388] Obtaining a set of annotated images and sample labels corresponding to each annotated image in the annotated image set, wherein the sample labels corresponding to the annotated images are used to indicate the category to which a target object in the annotated image belongs in a preset category set and the position of the target object;

[0389] Determining the loss weight corresponding to each category in the preset category set based on the true category distribution information of the annotated image set;

[0390] performing target detection on the annotated image set using a student model, obtaining a predicted label corresponding to each annotated image in the annotated image set, the predicted label being used to represent a predicted category of a target object in each annotated image in the annotated image set and a predicted position of the target object in each annotated image in the annotated image set;

[0391] Performing target detection on the unlabeled image set by the teacher model and the student model, respectively, to obtain a first initial pseudo-label and a second initial pseudo-label for each unlabeled image in the unlabeled image set, wherein the first initial pseudo-label is used to represent a first predicted category of a target object in each unlabeled image in the unlabeled image set and a first predicted position of the target object in each unlabeled image in the unlabeled image set, and the second initial pseudo-label is used to represent a second predicted category of a target object in each unlabeled image in the unlabeled image set and a second predicted position of the target object in each unlabeled image in the unlabeled image set;

[0392] The model parameters of the semi-supervised object detection model are adjusted based on the predicted labels and sample labels corresponding to each annotated image in the annotated image set, the first initial pseudo labels and the second initial pseudo labels corresponding to each unlabeled image in the unlabeled image set, and the loss weights corresponding to each category in the preset category set.

[0393] Alternatively, when the instruction is executed by a portable electronic device including multiple applications, the portable electronic device can execute the method of the embodiment shown in FIG. 7 , and specifically perform the following operations:

[0394] Obtain the image to be detected;

[0395] Through the target model in the semi-supervised target detection model, target detection is performed on the image to be detected to obtain the target detection result corresponding to the image to be detected; wherein, the semi-supervised target detection model includes a teacher model and a student model, the target model includes the teacher model and / or the student model, and the target detection model is obtained by semi-supervised training based on the semi-supervised training method of the target detection model provided in one or more embodiments of the present application. For example, the semi-supervised target detection model is obtained by training based on a set of labeled images and the sample labels corresponding to the labeled images therein, a set of unlabeled images and the target pseudo-labels corresponding to the unlabeled images therein, and the target pseudo-labels corresponding to each unlabeled image in the unlabeled image set are generated based on the label generation method provided in the embodiments of the present application.

[0396] According to one or more embodiments of the present disclosure, a computer program product is provided, which includes: a computer program, which is stored in a readable storage medium, and one or more processors of an electronic device can read the computer program from the readable storage medium, and the one or more processors execute the computer program, so that the electronic device executes the solution provided by any of the above embodiments.

[0397] One or more embodiments of the present disclosure provide a computer program, which is stored in a readable storage medium. One or more processors of an electronic device can read the computer program from the readable storage medium, and the one or more processors execute the computer program, so that the electronic device executes the solution provided by any of the above embodiments.

[0398] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

[0399] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0400] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0401] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0402] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.

Claims

1. A label generation method, comprising: Through the teacher model in the semi-supervised target detection model, target detection is performed on the unlabeled image set to obtain pseudo labels corresponding to each unlabeled image in the unlabeled image set, wherein the pseudo labels include pseudo category labels and pseudo position labels. The pseudo category labels are used to indicate the category of the target object in the corresponding unlabeled image, and the pseudo position labels are used to indicate the position of the target object in the corresponding unlabeled image. Obtaining true category distribution information of the unlabeled image set; Based on the real category distribution information of the unlabeled image set, performing category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set to obtain the target pseudo category labels corresponding to each unlabeled image in the unlabeled image set; Based on the target pseudo category label and pseudo position label corresponding to each unlabeled image in the unlabeled images, the target pseudo label corresponding to each unlabeled image is determined.

2. The method according to claim 1, wherein: The step of performing category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set based on the real category distribution information of the unlabeled image set to obtain the target pseudo category labels corresponding to each unlabeled image in the unlabeled image set includes: Determining a weight corresponding to each unlabeled image based on the entropy of the pseudo category label corresponding to each unlabeled image in the unlabeled image set; Based on the real category distribution information of the unlabeled image set, the pseudo category label corresponding to each unlabeled image in the unlabeled image set is corrected to obtain a candidate pseudo category label corresponding to each unlabeled image; Based on the candidate pseudo-category labels and weights corresponding to each unlabeled image in the unlabeled image set, the variable value of the dual variable is optimized to obtain the target variable value of the dual variable: Based on the target variable value of the dual variable and the candidate pseudo category label corresponding to each unlabeled image in the unlabeled image set, a target pseudo category label corresponding to each unlabeled image is determined.

3. The method according to claim 2, wherein: The candidate pseudo-category labels include candidate probabilities that the corresponding unlabeled images belong to each preset category in the preset category set; The step of optimizing the variable value of the dual variable based on the candidate pseudo-category labels and weights corresponding to each unlabeled image in the unlabeled image set to obtain the target variable value of the dual variable includes: In the t-th optimization process, based on the variable value of the dual variable in the t-1th optimization process, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, and the weight corresponding to each unlabeled image, the variable value of the dual variable in the t-th optimization process is determined, wherein t is a positive integer, and the variable value of the dual variable in the 0th optimization process is a preset variable value; When the t-th optimization process satisfies the maximum number of optimization processes, the variable value of the dual variable at the t-th optimization process is determined as the target variable value of the dual variable.

4. The method according to claim 3, wherein: The dual variable includes a first dual variable and a second dual variable, the variable value of the first dual variable at the t-th optimization process includes the variable values ​​of the first dual variable corresponding to each unlabeled image at the t-th optimization process, and the variable value of the second dual variable at the t-th optimization process includes the variable values ​​of the second dual variable corresponding to each preset category at the t-th optimization process; The determining the variable value of the dual variable at the t-1th optimization process based on the variable value of the dual variable at the t-1th optimization process, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, and the weight corresponding to each unlabeled image, includes: If t is an odd number or t is equal to the maximum number of optimization processing times, the variable values ​​of the second dual variable corresponding to the preset categories in the t-1th optimization processing are determined as the variable values ​​of the second dual variable corresponding to the preset categories in the tth optimization processing, and the variable values ​​of the second dual variable corresponding to the preset categories in the t-1th optimization processing are determined as the variable values ​​of the second dual variable corresponding to the preset categories in the tth optimization processing. The variable value of the category, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, and the weight corresponding to each unlabeled image are used to determine the variable value of each unlabeled image corresponding to the first dual variable in the t-th optimization process; or If t is an even number and t is not equal to the maximum number of optimization processing times, the variable values ​​of the first dual variable corresponding to each unlabeled image in the t-1th optimization processing are determined as the variable values ​​of the first dual variable corresponding to each unlabeled image in the t-1th optimization processing, and based on the variable values ​​of the first dual variable corresponding to each unlabeled image in the t-1th optimization processing, the candidate probability of each unlabeled image in the unlabeled image set belonging to each preset category, the weight corresponding to each unlabeled image and the number of unlabeled images in the unlabeled image set belonging to each preset category, the variable value of the second dual variable corresponding to each preset category in the tth optimization processing is determined.

5. The method according to claim 3 or 4, wherein: The real category distribution information of the unlabeled image set includes the number of unlabeled images in the unlabeled image set that belong to each preset category, and the pseudo category label includes the initial probability that the corresponding unlabeled image belongs to each preset category; The method of correcting the pseudo category label corresponding to each unlabeled image in the unlabeled image set based on the real category distribution information of the unlabeled image set to obtain a candidate pseudo category label corresponding to each unlabeled image includes: Based on the initial probability that each unlabeled image in the unlabeled image set belongs to the target category, a top image with the highest initial probability of belonging to the target category is selected from the unlabeled image set. unlabeled images, and obtain a subset of unlabeled images corresponding to the target category, where: is smaller than the number of unlabeled images belonging to the target category in the unlabeled image set; Traversing each unlabeled image in the unlabeled set, if the currently traversed unlabeled image belongs to the unlabeled image subset corresponding to the target category, determining the initial probability that the currently traversed unlabeled image belongs to the target category as the candidate probability that the currently traversed unlabeled image belongs to the target category; the target category refers to any one of the preset categories; If the currently traversed unlabeled image does not belong to the unlabeled image subset corresponding to the target category, the initial probability that the currently traversed unlabeled image belongs to the target category is corrected to a preset probability to obtain a candidate probability that the currently traversed unlabeled image belongs to the target category.

6. The method according to any one of claims 1 to 5, wherein: The pseudo category labels include initial probabilities that the corresponding unlabeled images belong to each preset category in the preset category set; The obtaining of the true category distribution information of the unlabeled image set includes: If the labeled image set and the unlabeled image set do not follow the same distribution, then based on the initial probabilities that each unlabeled image in the unlabeled image set belongs to each preset category, determine a confusion matrix and the sum of the initial probabilities corresponding to each preset category, wherein the row vectors of the confusion matrix represent the initial probabilities that the unlabeled images belong to each preset category; Based on the product of the confusion matrix and the sum of the initial probabilities corresponding to the preset categories, the true category distribution information of the unlabeled image set is estimated.

7. The method according to any one of claims 1 to 5, wherein: The obtaining of the true category distribution information of the unlabeled image set includes: If the annotated image set and the unannotated image set follow the same distribution, determining the true category distribution information of the annotated image set based on the category labels corresponding to each annotated image in the annotated image set; The true category distribution information of the labeled image is used as the true category distribution information of the unlabeled image.

8. The method according to any one of claims 1 to 7, wherein: Before performing target detection on the unlabeled image set by using the teacher model in the semi-supervised target detection model, the method further includes: Performing target detection on the unlabeled image set through a teacher model in a semi-supervised target detection framework to obtain a first initial pseudo label corresponding to each unlabeled image in the unlabeled image set; Performing target detection on the unlabeled image set by using the student model in the semi-supervised target detection framework, and obtaining a second initial pseudo label corresponding to each unlabeled image in the unlabeled image set; Performing target detection on the annotated image set by using the student model to obtain a predicted label corresponding to each annotated image in the annotated image set; Based on the predicted labels and sample labels corresponding to each annotated image in the annotated image set and the first initial pseudo-label and the second initial pseudo-label corresponding to each unlabeled image in the unlabeled image set, the model parameters of each model in the semi-supervised object detection framework are adjusted to obtain the semi-supervised object detection model.

9. The method according to claim 8, wherein: The teacher model includes a region detection module and a fully connected layer, and the student model has the same model structure as the teacher model; The region detection module is used to detect the region of interest of the input image; The fully connected layer is used to perform classification based on the region of interest of the input image to obtain a category label corresponding to the input image, and to perform bounding box regression processing based on the region of interest of the input image to obtain a pseudo position label corresponding to the input image.

10. A training method for a semi-supervised target detection model, the semi-supervised target detection model comprising a teacher model and a student model, the method comprising: Obtain a labeled image set, sample labels corresponding to each labeled image in the labeled image set, an unlabeled image set, and target pseudo labels corresponding to each unlabeled image in the unlabeled image set, wherein the target pseudo labels corresponding to each unlabeled image are generated based on the label generation method according to any one of claims 1 to 9; The semi-supervised object detection model is iteratively trained based on the labeled image set, the sample labels corresponding to each labeled image in the labeled image set, the unlabeled image set, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set.

11. The method according to claim 10, characterized in that The iterative training of the semi-supervised object detection model based on the annotated image set, the sample labels corresponding to each annotated image in the annotated image set, the unannotated image set, and the target pseudo labels corresponding to each unannotated image in the unannotated image set includes: Determine the target pseudo label corresponding to each unlabeled image in the unlabeled image set as a third initial pseudo label, and perform target detection on the unlabeled image set by using the student model to obtain a fourth initial pseudo label corresponding to each unlabeled image in the unlabeled image set; Performing target detection on the annotated image set by using the student model to obtain a predicted label corresponding to each annotated image in the annotated image set; Determining an unsupervised loss of the semi-supervised object detection model based on a third initial pseudo label and a fourth initial pseudo label corresponding to each unlabeled image in the unlabeled image set; Determining a supervised loss of the semi-supervised object detection model based on the predicted labels and sample labels corresponding to each annotated image in the annotated image set; Based on a weighted sum between the unsupervised loss and the supervised loss, a model parameter of the semi-supervised object detection model is adjusted.

12. A target detection method, comprising: Acquire the image to be detected; Performing target detection on the image to be detected by using the target model in the semi-supervised target detection model to obtain a target detection result corresponding to the image to be detected; Among them, the semi-supervised target detection model includes a teacher model and a student model, the target model includes the teacher model and / or the student model, the semi-supervised target detection model is trained based on a labeled image set and sample labels corresponding to the labeled images therein, an unlabeled image set and target pseudo labels corresponding to the unlabeled images therein, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set are generated based on the label generation method described in any one of claims 1 to 9.

13. A label generating device, comprising: The detection unit is used to perform target detection on the unlabeled image set through the teacher model in the semi-supervised target detection model. Obtaining a pseudo label corresponding to each unlabeled image in the unlabeled image set, wherein the pseudo label includes a pseudo category label and a pseudo position label, wherein the pseudo category label is used to indicate the category of the target object in the corresponding unlabeled image, and the pseudo position label is used to indicate the position of the target object in the corresponding unlabeled image; An estimation unit, used to obtain true category distribution information of the unlabeled image set; an alignment unit, configured to perform category distribution alignment processing on the pseudo category labels corresponding to each unlabeled image in the unlabeled image set based on the real category distribution information of the unlabeled image set, so as to obtain a target pseudo category label corresponding to each unlabeled image in the unlabeled image set; The determining unit is used to determine the target pseudo label corresponding to each unlabeled image based on the target pseudo category label and pseudo position label corresponding to each unlabeled image in the unlabeled images.

14. A training device for a semi-supervised target detection model, the semi-supervised target detection model comprising a teacher model and a student model, the device comprising: an acquisition unit, configured to acquire a labeled image set, sample labels corresponding to each labeled image in the labeled image set, an unlabeled image set, and target pseudo labels corresponding to each unlabeled image in the unlabeled image set, wherein the target pseudo labels corresponding to each unlabeled image are generated based on the label generation method according to any one of claims 1 to 9; The adjustment unit is used to iteratively train the semi-supervised target detection model based on the labeled image set, the sample labels corresponding to each labeled image in the labeled image set, the unlabeled image set, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set.

15. A target detection device, comprising: An acquisition unit, used for acquiring an image to be detected; A detection unit, configured to perform target detection on the image to be detected by using a target model in a semi-supervised target detection model, and obtain a target detection result corresponding to the image to be detected; Among them, the semi-supervised target detection model includes a teacher model and a student model, the target model includes the teacher model and / or the student model, the semi-supervised target detection model is trained based on a labeled image set and sample labels corresponding to the labeled images therein, an unlabeled image set and target pseudo labels corresponding to the unlabeled images therein, and the target pseudo labels corresponding to each unlabeled image in the unlabeled image set are generated based on the label generation method described in any one of claims 1 to 9.

16. An electronic device comprising: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the label generation method as described in any one of claims 1 to 9; or, the processor is configured to execute the instructions to implement the training method of the semi-supervised target detection model as described in claim 10 or 11; or, the processor is configured to execute the instructions to implement the target detection method as described in claim 12.

17. A computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is able to execute the label generation method as described in any one of claims 1 to 9; or, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to execute the training method of the semi-supervised target detection model as described in claim 10 or 11; or, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to execute the target detection method as described in claim 12.

Citation Information

Patent Citations

  • Visual detection-oriented target detection model training method and target detection method

    CN114882319A

  • Robust learning method based on class labels with noise and imbalance

    CN115331088A

  • RGB image semi-supervised target detection method based on double-pseudo-label optimization learning

    CN115393687A

  • Semi-supervised target detection model training method and device, equipment and medium

    CN115953633A

  • Process to learn new image classes without labels

    US20210182618A1

Cited By

  • Image label detection method and device, computer equipment and readable storage medium

    CN121170360A

  • Semi-supervised breast cancer AI prediction method and system based on influence sorting consistency

    CN122177371A

  • Semi-supervised breast cancer ai prediction method and system based on impact ranking consistency

    CN122177371B