Method and device for training semi-supervised object detection model, and object detection method and device

Through the two-stage training method, instance-balanced sampling and category-balanced sampling, the semi-supervised target detection model improves the detection ability of small-category targets, solves the problem of poor detection results caused by category imbalance in the existing technology, and realizes the detection of large-scale targets. Accurate detection of category and sub-category objects.

WO2024222444A1PCT designated stage expired Publication Date: 2024-10-31MASHANG CONSUMER FINANCE CO LTD

Patent Information

Application Number
PCT/CN2024/086669
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-27
Filing Date
2024-04-08
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

Existing semi-supervised target detection models have low detection accuracy for small-category targets in the field of image recognition. This is mainly due to the small number of small-category targets in the sample data set, resulting in poor model training results.

Method used

A two-stage training method is adopted. The first stage obtains a sample image set through instance balanced sampling, focusing on image feature extraction; the second stage obtains a sample image set through category balanced sampling, focusing on image classification and regression to ensure the number of targets under different categories. Balanced, thereby improving the model's detection ability for small categories of targets.

Benefits of technology

It effectively improves the model's detection accuracy for large and small categories of targets, solves the problem of poor learning effects caused by category imbalance, and ensures good performance of the model on all categories.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024086669_31102024_PF_FP_ABST
    Figure CN2024086669_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a method and device for training a semi-supervised object detection model, and an object detection method and device. The method for training a semi-supervised object detection model comprises: performing instance-balanced sampling on the basis of a sample image data set to obtain a first sample image set; performing iterative training on a first parameter set in an initial object detection model on the basis of the first sample image set to obtain a first object detection model; then performing class-balanced sampling on the basis of the sample image data set to obtain a second sample image set; performing iterative training on a second parameter set in the first object detection model on the basis of the second sample image set to obtain a second object detection model; and finally, determining a final semi-supervised object detection model on the basis of the second object detection model. In this way, the whole training process is divided into two training stages, and image sample sampling modes and parameter learning emphases in different training stages are different, so that the object detection model finally trained can ensure the object detection accuracy of both large and small classes.
Need to check novelty before this filing date? Find Prior Art

Description

Semi-supervised target detection model training, target detection method and device

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to Chinese patent application number 202310475583.2, filed on April 27, 2023, entitled “Training of Semi-Supervised Target Detection Model, Target Detection Method and Device,” the entire contents of which are incorporated herein by reference. Technical Field

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

[0004] At present, with the rapid development of artificial intelligence technology, neural network models have also been born. By iteratively training the model parameters in the neural network model based on a large amount of historical sample data, the neural network model can learn patterns from a large amount of historical sample data, thereby intelligently identifying new samples or making predictions about the future.

[0005] However, due to the difficulty in obtaining a large amount of labeled sample data for certain specific application scenarios, and considering that the training process of the semi-supervised model may complete the model training through a small number of labeled samples and a large number of unlabeled samples, the application of semi-supervised models is becoming more and more extensive. However, for application fields such as image recognition and text recognition, considering that there is a distinction between large categories and small categories between different categories, that is, the category with a relatively large number of targets in the image sample data set is called a large category or head category, and the category with a relatively small number of targets in the image sample data set is called a small category or tail category. For small category targets, since the number of targets belonging to small categories in the model training samples is relatively small, the detection learning effect of small category targets in the image during the model training process is poor. When using the existing semi-supervised target detection model for target detection, there is a problem of low detection accuracy of small category targets.

[0006] Summary of the Invention

[0007] In a first aspect, an embodiment of the present application provides a method for training a semi-supervised object detection model, the method comprising:

[0008] Acquire a sample image dataset; wherein the sample image dataset includes a plurality of unlabeled sample images and a plurality of labeled sample images;

[0009] Performing instance-balanced sampling on the multiple unlabeled sample images and the multiple labeled sample images to obtain a first sample image set;

[0010] Iteratively training a first parameter set in an initial object detection model based on the first sample image set to obtain a first object detection model;

[0011] Performing class-balanced sampling on the multiple unlabeled sample images and the multiple labeled sample images to obtain a second sample image set;

[0012] Iteratively training a second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model;

[0013] A semi-supervised object detection model for image recognition is determined based on the second object detection model.

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

[0015] Acquire target image data to be detected;

[0016] Utilize a pre-trained semi-supervised target detection model and perform target detection based on the target image data to obtain an image detection result of the target image data; wherein, the image detection result includes: category information and position information of the target object contained in the target image data, and the semi-supervised target detection model is trained by the method described in the first aspect.

[0017] In a third aspect, an embodiment of the present application provides a training device for a semi-supervised object detection model, the device comprising:

[0018] A sample image acquisition module is used to acquire a sample image dataset; wherein the sample image dataset includes a plurality of unlabeled sample images and a plurality of labeled sample images;

[0019] A first sample set generating module is configured to perform instance-balanced sampling on the plurality of unlabeled sample images and the plurality of labeled sample images to obtain a first sample image set;

[0020] A first model training module is configured to iteratively train a first parameter set in an initial object detection model based on the first set of sample images to obtain a first object detection model;

[0021] A second sample set generating module is configured to perform category-balanced sampling on the plurality of unlabeled sample images and the plurality of labeled sample images to obtain a second sample image set;

[0022] A second model training module is configured to iteratively train a second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model;

[0023] A target detection model determination module is used to determine a semi-supervised target detection model for image recognition based on the second target detection model.

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

[0025] An image acquisition module is used to acquire target image data to be detected;

[0026] A target detection module is used to use a pre-trained semi-supervised target detection model and perform target detection based on the target image data to obtain an image detection result of the target image data; wherein the image detection result includes: category information and position information of the target object contained in the target image data, and the semi-supervised target detection model is trained by the method described in the first aspect.

[0027] In a fifth aspect, an embodiment of the present application provides an electronic device, the device comprising:

[0028] A processor; and a memory arranged to store computer-executable instructions, the executable instructions being configured to be executed by the processor, the executable instructions comprising instructions for executing the steps of the method as described in the first aspect or the second aspect.

[0029] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the storage medium is used to store computer-executable instructions, and the executable instructions enable the computer to execute the steps in the method described in the first aspect or the second aspect.

[0030] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising computer-executable instructions, which enable a computer to execute the steps in the method described in the first aspect or the second aspect.

[0031] In an eighth aspect, an embodiment of the present application provides a computer program, which enables a computer to execute the steps in the method described in the first aspect or the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only one or more embodiments described in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0033] FIG1 is a schematic diagram of a first flow chart of a training method for a semi-supervised object detection model provided in an embodiment of the present application;

[0034] FIG2 is a schematic diagram of a second flow chart of a training method for a semi-supervised object detection model provided in an embodiment of the present application;

[0035] FIG3 is a schematic diagram of a first implementation principle of a training method for a semi-supervised object detection model provided in an embodiment of the present application;

[0036] FIG4 is a schematic diagram of a second implementation principle of the training method of the semi-supervised object detection model provided in an embodiment of the present application;

[0037] FIG5 is a schematic diagram of a third implementation principle of the training method for the semi-supervised object detection model provided in an embodiment of the present application;

[0038] FIG6 is a schematic diagram of a fourth implementation principle of the training method for a semi-supervised object detection model provided in an embodiment of the present application;

[0039] FIG7 is a schematic diagram of a flow chart of a target detection method provided in an embodiment of the present application;

[0040] FIG8 is a schematic diagram showing the implementation principle of the target detection method provided in an embodiment of the present application;

[0041] FIG9 is a schematic diagram of the module composition of a training device for a semi-supervised object detection model provided in an embodiment of the present application;

[0042] FIG10 is a schematic diagram of the module composition of the target detection device provided in an embodiment of the present application;

[0043] FIG11 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to enable those skilled in the art to better understand one or more technical solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the embodiments described are only one or more embodiments of the present application, not all embodiments. Based on one or more embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0045] It should be noted that, in the absence of conflict, one or more embodiments and features in the embodiments of the present application may be combined with each other. The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0046] One or more embodiments of the present application provide a training, target detection method and device for a semi-supervised target detection model, taking into account the need to encourage the model to simultaneously take into account the learning effects of large-category targets and small-category targets, wherein large-category targets can be understood as target objects with a relatively high probability of appearing in the sample image data set, that is, the number of large-category targets in the sample image data set is relatively large, and small-category targets can be understood as target objects with a relatively low probability of appearing in the sample image data set, that is, the number of small-category targets in the sample image data set is relatively small; for the sample image data set with such category imbalance, under normal circumstances, the classification loss weight of small-category targets is increased, and the classification loss weight of large-category targets is reduced. Although this can alleviate the problem of poor learning effect of the model on small-category targets due to the category imbalance of the sample image data set to a certain extent, adjusting the classification loss weight of targets between categories will inevitably lead to changes in the total weight of the classification loss function. , which will cause the weight ratio of the classification loss function and the regression loss function to change, that is, the original weight ratio of the classification loss function and the regression loss function is changed, which in turn causes the model to focus more on the learning of any one detection task in target classification detection and target bounding box detection, and cannot fundamentally solve the problem of poor training effect of some network parameters of the model due to the category imbalance of the image sample data set. Based on the above problem, this technical solution first performs instance balanced sampling based on the sample image data set to obtain a first sample image set; and iteratively trains the first parameter set in the initial target detection model based on the first sample image set to obtain a first target detection model; then, class balanced sampling is performed based on the sample image data set to obtain a second sample image set; and iteratively trains the second parameter set in the first target detection model based on the second sample image set to obtain a second target detection model; finally, the final semi-supervised target detection model is determined based on the second target detection model;In this way, the entire model training process is divided into two training stages, and the image sample sampling methods and learning focuses in different model training stages are different. In the first training stage, the instance balanced sampling method is used to obtain the first sample image set, focusing on learning image feature extraction, while the category balanced sampling method is used to obtain the second sample image set in the second training stage, focusing on learning image classification and regression. That is, the network parameters related to image representation learning that have been learned in the first training stage are fixed, and the focus is on adjusting the network parameters related to image classification and regression. Since the number of sample images under different categories in the second sample image set is the same, this can increase the number of small category targets, so that the number of targets under different categories will not be The bias is too large, ensuring that the model can simultaneously take into account the learning effects of large and small category targets, fundamentally solving the problem of poor learning effects on categories with insufficient examples due to category imbalance. As a result, the final trained semi-supervised object detection model can simultaneously ensure the detection accuracy of large and small categories of objects in the image to be detected. In addition, since the classification loss weights of different categories of targets in the classification loss function do not need to be adjusted throughout the model training process, the total weight of the classification loss function does not change, thus ensuring that the weight ratio of the classification loss function and the regression loss function remains unchanged, and thus does not cause the model to focus more on learning any one detection task: object classification detection or object bounding box detection.

[0047] FIG1 is a first flow chart of a method for training a semi-supervised object detection model according to one or more embodiments of the present application. The method in FIG1 can be executed by an electronic device, which may be a terminal device or a designated server. As shown in FIG1 , the method includes at least the following steps:

[0048] S102, obtaining a sample image dataset; wherein the sample image dataset includes a plurality of unlabeled sample images and a plurality of labeled sample images;

[0049] Specifically, the number of unlabeled sample images can be much larger than the number of labeled sample images. Unlabeled sample images may be sample images without label information, while labeled sample images may be sample images with label information. This label information includes the true label of each target object in the sample image. This true label may include a true category label and a true location label (i.e., bounding box coordinates). The true category label is one of multiple preset categories associated with the target detection task. Specifically, a sample image may include at least one target object, and different target objects may belong to the same or different categories.

[0050] S104, performing instance-balanced sampling on the plurality of unlabeled sample images and the plurality of labeled sample images to obtain a first sample image set;

[0051] Specifically, the process of iterative training of model parameters usually requires multiple rounds of training to adjust the model parameters. Considering that the number of sample images in the sample image dataset is relatively large, the model parameters need to be adjusted multiple times for each round of training; wherein, for each model parameter adjustment, a part of sample images (i.e., a set of sample images of a certain batch) is selected from the sample image dataset, and a parameter adjustment is performed based on the selected sample images; in addition, for the first training stage, the sample image set of each batch is obtained by selecting a first number of unlabeled sample images and a second number of labeled sample images from the sample image dataset using an instance-balanced sampling method; specifically, the first sample image sets of different batches can be pre-selected or selected in real time, that is, parameter adjustment and sample selection are performed alternately.

[0052] Specifically, the balanced sampling method in the above example refers to a sampling method that ensures that the participation probability of each sample image in the sample image dataset is equal. Therefore, for each round of model training, it can ensure that the deviation of the number of times different target objects in the sample image dataset participate in model training is less than the preset number threshold.

[0053] S106, iteratively training the first parameter set in the initial object detection model based on the first sample image set to obtain a first object detection model;

[0054] Specifically, since there are multiple first sample image sets, the model parameters can be adjusted multiple times based on the multiple first sample image sets to achieve iterative training of the first parameter set in the initial target detection model; wherein each first sample image set includes a first number of unlabeled sample images and a second number of labeled sample images, and for each first sample image set, a first semi-supervised loss value is calculated based on the predicted labels and pseudo labels of the first number of unlabeled sample images in the first sample image set, and the predicted labels and true labels of the second number of labeled sample images, and the first parameter set in the initial target detection model is adjusted multiple times based on the first semi-supervised loss values ​​corresponding to each first sample image set to obtain a first target detection model;

[0055] Specifically, since the above-mentioned first parameter set includes not only the network parameters of the characterization learning network, but also the network parameters of the target detection network, therefore, for the first training stage, it is achieved to promote the image representation learning and target detection task learning of the initial target detection model; wherein, the training end condition of the first training stage can be that the number of trained rounds is equal to the first preset number of rounds, or that the semi-supervised loss value corresponding to the above-mentioned initial target detection model is less than the preset loss threshold.

[0056] S108, performing class-balanced sampling on the plurality of unlabeled sample images and the plurality of labeled sample images to obtain a second sample image set;

[0057] Specifically, for the second training stage, the sample image set of each batch is obtained by selecting a third number of unlabeled sample images and a fourth number of labeled sample images from the sample image dataset using a class-balanced sampling method to obtain initial sample image subsets corresponding to preset categories, and further determining the set of initial sample image subsets corresponding to each of the preset categories as the second sample image set;

[0058] Specifically, different batches of second sample image sets can be pre-selected or selected in real time, that is, parameter adjustment and sample selection are performed alternately. Also, considering that the efficiency of image sample loading is relatively low, it is preferred that multiple batches of second sample image sets are pre-selected. For the second training stage, multiple class-balanced sampling processes are pre-performed based on the multiple unlabeled sample images and the multiple labeled sample images to obtain multiple second sample image sets. Each second sample image set is used as a sample image set of a certain batch, and parameter adjustment is performed on the second parameter set once.

[0059] Specifically, the above-mentioned category-balanced sampling method refers to a sampling method that ensures that the number of sample images under different preset categories in the second sample image set is the same. Therefore, for each category-balanced sampling, it can ensure that the number of target objects under multiple preset categories in the second sample image set is less than the preset number threshold, that is, the number of large category targets and small category targets in the second sample image set is not much different.

[0060] In some example embodiments, the number of unlabeled sample images and labeled sample images included in the second sample image set may not be limited. In other example embodiments, the number of unlabeled sample images and labeled sample images included in the second sample image set may also be limited.

[0061] S110, iteratively training the second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model;

[0062] Specifically, since there are multiple second sample image sets, the model parameters can be adjusted multiple times based on the multiple second sample image sets, thereby achieving iterative training of the second parameter set in the first object detection model. For each second sample image set, a second semi-supervised loss value is calculated based on the predicted labels and pseudo-labels of the unlabeled sample images in the second sample image set, as well as the predicted labels and true labels of the labeled sample images. Based on the second semi-supervised loss values ​​corresponding to each second sample image set, the second parameter set in the first object detection model is adjusted multiple times to obtain a second object detection model.

[0063] Specifically, since the above-mentioned second parameter set only includes the network parameters of the target detection network, that is, it does not include the network parameters of the representation learning network. Therefore, for the second training stage, the network parameters of the representation learning network obtained in the first training stage are fixed, and only the parameters related to the target detection task of the first target detection model are adjusted; wherein, the training end condition of the second training stage can be that the number of trained rounds is equal to the second preset number of rounds, or it can be that the semi-supervised loss function corresponding to the above-mentioned first target detection model converges.

[0064] S112: Determine a semi-supervised object detection model for image recognition based on the second object detection model.

[0065] The above-mentioned initial target detection model may include two sub-models with the same model structure. For example, the initial target detection model includes a first sub-model and a second sub-model with the same model structure. Specifically, the model parameters of the second sub-model can be obtained by tuning the model parameters using the gradient descent method through back propagation, and the model parameters of the first sub-model can be obtained by updating the parameters based on the parameter values ​​after each update of the second sub-model using the EMA method (Exponential Moving Average). After the second target detection model is obtained after the first training stage and the second training stage, the first sub-model in the second target detection model is determined as a semi-supervised target detection model for image recognition.

[0066] FIG2 is a second flow chart of a method for training a semi-supervised object detection model according to one or more embodiments of the present application. The method in FIG2 can be executed by an electronic device, which may be a terminal device or a designated server. As shown in FIG2 , the method includes at least the following steps:

[0067] S202, obtaining a sample image dataset; wherein the sample image dataset includes N unlabeled sample images and M labeled sample images;

[0068] Specifically, N and M are both integers greater than 1, and the value of N can be much larger than the value of M, that is, the number of unlabeled sample images can be much larger than the number of labeled sample images; the unlabeled sample images may be sample images without label information, and the labeled sample images may be sample images with label information, where the label information includes the true label of each target object in the sample image, and the true label may include a true category label and a true position label (i.e., a bounding box coordinate), and the true category label is one of multiple preset categories associated with the target detection task;

[0069] Specifically, a sample image may include at least one target object, and the categories to which different target objects belong may be the same or different; for example, a sample image includes a pedestrian and a dog, and the categories to which the target objects belong are people and animals, respectively; for another example, a sample image includes a shopping mall and a car, and the categories to which the target objects belong are buildings and vehicles, respectively; for another example, for a specific application scenario, targeted message push is performed based on the gender, occupation or age group of the target pedestrian in the image. Correspondingly, a sample image may include people of different genders, occupations or age groups, and the categories to which the target objects belong may be divided according to gender, occupation or age group; among which, how the categories of specific target objects are divided and which preset categories are included can be limited according to actual needs, and this application does not impose any restrictions on this.

[0070] S204, performing instance-balanced sampling processing based on the N unlabeled sample images and the M labeled sample images to obtain a first sample image set;

[0071] Specifically, the iterative training process of the model parameters usually requires multiple rounds of training to adjust the model parameters. Considering that the number of sample images in the sample image dataset is relatively large, the model parameters need to be adjusted multiple times for each round of training. For each model parameter adjustment, a portion of sample images (i.e., a set of sample images of a certain batch) is selected from the sample image dataset, and a parameter adjustment is performed based on the selected sample images. In addition, for the first training stage, the sample image set of each batch is obtained by selecting a first number of unlabeled sample images and a second number of labeled sample images from the sample image dataset using an instance-balanced sampling method to obtain a first sample image set.

[0072] Specifically, different batches of first sample image sets can be pre-selected or selected in real time, that is, parameter adjustment and sample selection are performed alternately. Considering the relatively low efficiency of image sample loading, it is preferred that multiple batches of first sample image sets are pre-selected. For the first training phase, multiple instance-balanced sampling processes are pre-performed based on the N unlabeled sample images and the M labeled sample images to obtain multiple first sample image sets. Each first sample image set is used as a sample image set of a certain batch, and parameter adjustment is performed on the first parameter set once.

[0073] Specifically, the balanced sampling method in the above example refers to a sampling method that ensures that the participation probability of each sample image in the sample image dataset is equal. Therefore, for each round of model training, it can ensure that the deviation of the number of times different target objects in the sample image dataset participate in model training is less than the preset number threshold.

[0074] S206, iteratively training a first parameter set in the initial object detection model based on the first sample image set to obtain a first object detection model; wherein the initial object detection model includes a representation learning network and a target detection network, and the first parameter set includes network parameters of the representation learning network and network parameters of the target detection network;

[0075] Specifically, since there are multiple first sample image sets, the model parameters can be adjusted multiple times based on the multiple first sample image sets to achieve iterative training of the first parameter set in the initial target detection model; wherein each first sample image set includes a first number of unlabeled sample images and a second number of labeled sample images, and for each first sample image set, a first semi-supervised loss value is calculated based on the predicted labels and pseudo labels of the first number of unlabeled sample images in the first sample image set, and the predicted labels and true labels of the second number of labeled sample images, and the first parameter set in the initial target detection model is adjusted multiple times based on the first semi-supervised loss values ​​corresponding to each first sample image set to obtain a first target detection model;

[0076] Specifically, since the above-mentioned first parameter set includes not only the network parameters of the characterization learning network, but also the network parameters of the target detection network, therefore, for the first training stage, it is achieved to promote the image representation learning and target detection task learning of the initial target detection model; wherein, the training end condition of the first training stage can be that the number of trained rounds is equal to the first preset number of rounds, or that the semi-supervised loss value corresponding to the above-mentioned initial target detection model is less than the preset loss threshold.

[0077] S208: Performing class-balanced sampling processing on the N unlabeled sample images and the M labeled sample images to obtain a second sample image set; wherein the second sample image set includes m initial sample image subsets, each initial sample image subset includes n initial sample images belonging to any preset category, where m represents the number of preset categories, and both m and n are integers greater than 1;

[0078] Specifically, for the second training stage, the sample image set of each batch is obtained by selecting a third number of unlabeled sample images and a fourth number of labeled sample images from the sample image dataset using a class-balanced sampling method to obtain an initial sample image subset corresponding to a preset class, and further determining a second sample image set including the m initial sample image subsets;

[0079] Specifically, different batches of second sample image sets can be pre-selected or selected in real time, that is, parameter adjustment and sample selection are performed alternately. Also, considering that the image sample loading efficiency is relatively low, it is preferred that multiple batches of second sample image sets are pre-selected. For the second training stage, multiple class-balanced sampling processes are pre-performed based on the N unlabeled sample images and the M labeled sample images to obtain multiple second sample image sets. Each second sample image set is used as a sample image set of a certain batch, and parameter adjustment is performed on the second parameter set once.

[0080] Specifically, the above-mentioned category-balanced sampling method refers to a sampling method that ensures that the number of sample images under different preset categories in the second sample image set is the same. Therefore, for each category-balanced sampling, it can ensure that the number of target objects under multiple preset categories in the second sample image set is less than the preset number threshold, that is, the number of large category targets and small category targets in the second sample image set is not much different.

[0081] In some example embodiments, the number of unlabeled sample images and labeled sample images included in the second sample image set may not be limited. Specifically, N unlabeled sample images are divided into unlabeled sample image subsets corresponding to multiple preset categories, and M labeled sample images are divided into labeled sample image subsets corresponding to multiple preset categories. The set of unlabeled sample image subsets and labeled sample image subsets with the same preset category is determined as a candidate sample image subset; for each preset category, n sample images are randomly selected from the candidate sample image subset corresponding to the preset category to obtain an initial sample image subset; the set of initial sample image subsets corresponding to m preset categories is determined as the second sample image set; in this way, each preset category in the second sample image set contains n initial sample images.

[0082] In other example embodiments, the number of unlabeled sample images and labeled sample images included in the second sample image set may also be limited. Specifically, N unlabeled sample images are divided into unlabeled sample image subsets corresponding to multiple preset categories, and M labeled sample images are divided into labeled sample image subsets corresponding to multiple preset categories; for each preset category, a third number of unlabeled sample images are randomly selected from the unlabeled sample image subset corresponding to the preset category, and a fourth number of labeled sample images are randomly selected from the labeled sample image subset corresponding to the preset category; based on the third number of unlabeled sample images and the fourth number of labeled sample images, an initial sample image subset corresponding to the preset category is obtained; wherein the sum of the third number and the fourth number is equal to n; the set of initial sample image subsets corresponding to m preset categories is determined as the second sample image set; in this way, each preset category in the second sample image set contains n initial sample images.

[0083] S210, iteratively training a second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model; wherein the second parameter set includes network parameters of the object detection network;

[0084] Specifically, since the number of second sample image sets is also multiple, the model parameters can be adjusted multiple times based on the multiple second sample image sets to achieve iterative training of the second parameter set in the first target detection model; wherein the initial sample image subset corresponding to the preset category in each second sample image set includes a third number of unlabeled sample images and a fourth number of labeled sample images, and for each second sample image set, based on the predicted labels and pseudo labels of the unlabeled sample images in the second sample image set, and the predicted labels and true labels of the labeled sample images, a second semi-supervised loss value is calculated, and based on the second semi-supervised loss value corresponding to each second sample image set, the second parameter set in the first target detection model is adjusted multiple times to obtain a second target detection model;

[0085] Specifically, since the above-mentioned second parameter set only includes the network parameters of the target detection network, that is, it does not include the network parameters of the representation learning network. Therefore, for the second training stage, the network parameters of the representation learning network obtained in the first training stage are fixed, and only the parameters related to the target detection task of the first target detection model are adjusted; wherein, the training end condition of the second training stage can be that the number of trained rounds is equal to the second preset number of rounds (that is, the sum of the second preset number of rounds and the above-mentioned first preset number of rounds can be equal to the total number of training rounds, the product of the first ratio of the first preset number of rounds and the total number of training rounds can be equal to the first preset number of rounds, the product of the second ratio of the second preset number of rounds and the total number of training rounds can be equal to the second preset number of rounds, and the sum of the first ratio and the second ratio is equal to 100%), or it can be that the semi-supervised loss function corresponding to the above-mentioned first target detection model converges.

[0086] In addition, considering that a certain sample image i usually contains both target object 1 belonging to preset category a and target object 2 belonging to preset category b, the initial sample image subset corresponding to preset category a and the initial sample image subset corresponding to preset category b may both include sample image i; however, in the process of calculating the second semi-supervised loss value, for sample image i in the initial sample image subset corresponding to preset category a, only the label loss value of target object 1 is considered, while for sample image i in the initial sample image subset corresponding to preset category b, only the label loss value of target object 2 is considered; and considering that sample images containing small category targets are usually relatively small, taking the preset category b belonging to a small category as an example, the number of sample images contained in the unlabeled sample image subset and the labeled sample image subset corresponding to preset category b are both relatively small. In order to ensure that the number of sample images in the initial sample image subset corresponding to preset category b is n, the initial sample image subset corresponding to preset category b can include multiple identical sample images i, that is, the same sample image i is repeatedly selected. At this time, multiple identical sample images i all participate in the calculation of the second semi-supervised loss value.

[0087] S212: Determine a semi-supervised object detection model for image recognition based on the second object detection model.

[0088] Specifically, the above-mentioned initial target detection model can be composed of a neural network model. However, in order to improve the parameter accuracy of the final semi-supervised target detection model, thereby further improving the target detection accuracy of the final semi-supervised target detection model, the above-mentioned initial target detection model can include two sub-models with the same model structure. For example, the initial target detection model includes a first sub-model and a second sub-model with the same model structure; wherein the first representation learning layer in the first sub-model or the second representation learning layer in the second sub-model can adopt a convolutional neural network (CNN) network structure; the first target detection layer in the first sub-model or the second target detection layer in the second sub-model can include a candidate box extraction layer RPN (i.e., region proposal network, region candidate box extraction), an ROI pooling layer (i.e., region of interest, region of interest extraction), a shared convolutional layer, and a first convolutional layer (corresponding to the classification task, for outputting category information) and a second convolutional layer (corresponding to the regression task, for outputting bounding box information) connected to the shared convolutional layer; the representation learning layer is connected to the candidate box extraction layer RPN and the ROI pooling layer.

[0089] Specifically, the model parameters of the second sub-model can be obtained by tuning the model parameters using the gradient descent method and back propagation, and the model parameters of the first sub-model can be obtained by updating the parameters based on the parameter values ​​after each update of the second sub-model using the EMA method (Exponential Moving Average); after the second target detection model is obtained through the first training stage and the second training stage, the first sub-model in the second target detection model is determined as a semi-supervised target detection model for image recognition.

[0090] It should be noted that the model trained based on the training method of the semi-supervised target detection model provided in the embodiment of the present application can be applied to any specific application scenario that requires target detection on the image to be detected. For example, in specific application scenario 1, target detection is performed on the image to be detected obtained by using the image acquisition device at the entrance of a shopping mall to obtain the category information and position information of the pedestrian in the image to be detected. For example, in specific application scenario 2, target detection is performed on the image to be detected obtained by using the image acquisition device at a certain moving vehicle monitoring point to obtain the category information and position information of the vehicle in the image to be detected; for example, in specific application scenario 3, target detection is performed on the target face image obtained by using a certain face recognition device to obtain the image detection result of the target face image; the image detection result includes the category information (for example, age, gender, etc.) and position information of the target face, as well as the category information (for example, building color, shape, or door and window color, shape, etc.) and position information of at least one reference target object in the face background area; then, based on the image detection result, it is determined whether the target user is a risky user.

[0091] Among them, due to the different specific application scenarios of the target detection model, the sample image data sets used in the target detection model training process are also different. For the specific application scenario 1, the sample image data set can be the historical sample images collected at the entrance of a designated shopping mall within a preset historical time period. Correspondingly, the preset categories can be divided according to gender, occupation or age group, and the target object can be the target pedestrian. The large category target can be a pedestrian belonging to a preset category a and appearing more frequently, and the small category target can be a pedestrian belonging to a preset category b and appearing less frequently. For the specific application scenario 2, the sample image data set can be the historical sample images collected at a designated driving vehicle monitoring point within a preset historical time period. Correspondingly, the preset categories can be divided according to vehicle. For specific application scenario 3, the sample image dataset may be historical face sample images collected by face recognition equipment within a preset historical time period. Correspondingly, the preset categories may be divided according to the basic attributes of the user and the background reference objects. The target objects may be target users, target reference objects (such as landmark buildings, interior decorations, etc.), the large category targets may be target reference objects belonging to a preset category e and appearing more frequently, and the small category targets may be target reference objects belonging to a preset category f and appearing less frequently.

[0092] In an embodiment of the present application, the entire model training process is divided into two training stages, and the image sample sampling methods and learning focuses in different model training stages are different. The first training stage adopts an instance-balanced sampling method to obtain a first sample image set, focusing on learning image feature extraction, while the second training stage adopts a category-balanced sampling method to obtain a second sample image set, focusing on learning image classification and regression. That is, the network parameters related to image representation learning that have been learned in the first training stage are fixed, and the network parameters related to image classification and regression are adjusted. Since the number of targets under different categories in the second sample image set will not deviate too much, it is ensured that the model can take into account the learning effects of large category targets and small category targets at the same time, and fundamentally solve the problem of poor learning effect of the model on categories with missing instances due to category imbalance, so that the semi-supervised target detection model finally trained can simultaneously ensure the accuracy of target detection of large categories and small categories in the image to be detected.

[0093] In a specific embodiment, as shown in FIG3 , a specific implementation process of a training method for a semi-supervised object detection model is provided, which mainly includes:

[0094] Obtain a sample image dataset; wherein the sample image dataset includes N unlabeled sample images (i.e., sample images without label information) and M labeled sample images (i.e., sample images with real label information), the real label information includes the real label of each target object in the sample image, and the real label may include the real category label and the real position label (i.e., bounding box coordinates); for example, unlabeled sample images 1 to unlabeled sample images N, and labeled sample images 1 to labeled sample images M;

[0095] Performing instance-balanced sampling processing on the N unlabeled sample images and the M labeled sample images to obtain a first sample image set;

[0096] Iteratively updating a first parameter set in an initial object detection model based on a first set of sample images generated for each parameter update in the first training phase to obtain a first object detection model; wherein the initial object detection model includes a representation learning network and a target detection network, and the first parameter set includes network parameters of the representation learning network and network parameters of the target detection network;

[0097] Performing category-balanced sampling processing based on the N unlabeled sample images and the M labeled sample images to obtain a second sample image set;

[0098] Iteratively updating a second parameter set in the first object detection model based on a second set of sample images generated for each parameter update in the second training phase to obtain a second object detection model; wherein the second parameter set includes network parameters of the object detection network;

[0099] A semi-supervised object detection model for image recognition is determined based on the second object detection model.

[0100] Wherein, for the case where the above-mentioned initial target detection model includes a first sub-model and a second sub-model, since the model structures of the first sub-model and the second sub-model are the same, each sub-model includes a representation learning layer and a target detection layer. Therefore, the representation learning network in the above-mentioned initial target detection model includes the first representation learning layer in the first sub-model and the second representation learning layer in the second sub-model, and the target detection network in the above-mentioned initial target detection model includes the first target detection layer in the first sub-model and the second target detection layer in the second sub-model;

[0101] Correspondingly, the above S112 and S212, determining a semi-supervised object detection model for image recognition based on the above second object detection model, specifically include:

[0102] The first sub-model in the second object detection model is determined as a semi-supervised object detection model for image recognition.

[0103] Specifically, taking the above-mentioned first sub-model as the teacher model and the above-mentioned second sub-model as the student model as an example, the model parameters of the student model can be obtained by tuning the model parameters using the gradient descent method and back propagation, and the model parameters of the teacher model can be obtained by updating the parameters based on the parameter values ​​after each update of the student model using the EMA method; then the teacher model obtained after the first training stage and the second training stage is determined as the final semi-supervised target detection model.

[0104] Here, the above-mentioned initial target detection model still includes the first sub-model and the second sub-model as an example, and the above-mentioned first sample image set includes a plurality of labeled sample images and a plurality of unlabeled sample images;

[0105] Correspondingly, for the process of iteratively updating the model parameters in the first training phase, the above S106 and S206 iteratively train the first parameter set in the initial object detection model based on the above first sample image set to obtain the first object detection model, specifically including:

[0106] Step A1: for each unlabeled sample image in the first sample image set, perform weak enhancement processing on the unlabeled sample image to obtain a weakly enhanced sample image; and perform strong enhancement processing on the unlabeled sample image to obtain a strongly enhanced sample image;

[0107] Specifically, weak enhancement processing and strong enhancement processing are performed on the plurality of unlabeled sample images in the first sample image set to obtain an enhanced sample image combination corresponding to each unlabeled sample image, the enhanced sample image combination including a weakly enhanced sample image and a strongly enhanced sample image;

[0108] Specifically, the weak enhancement processing may include image scaling, image cropping, and other enhancement processing that does not change the image information; the strong enhancement processing may include deleting some image areas and other enhancement processing that may change the image information.

[0109] Step A2: Input the weakly enhanced sample images corresponding to the unlabeled sample images in the first sample image set into the first sub-model of the initial object detection model after the latest parameter adjustment to perform pseudo-label recognition, and obtain the category pseudo-labels and bounding box pseudo-labels of the unlabeled sample images;

[0110] Specifically, for unlabeled sample images, it is impossible to directly obtain the true label information of the unlabeled sample images. Therefore, the above-mentioned first sub-model can be used to predict the pseudo-label of the unlabeled sample images, and the role of the pseudo-label is equivalent to the role of the true label of the labeled sample image; in the specific implementation, for each unlabeled sample image in the above-mentioned first sample image set, the weakly enhanced sample image corresponding to the unlabeled sample image is input into the first sub-model after the last parameter update, and the first representation learning layer in the first sub-model is used to perform feature extraction to obtain the image feature representation vector of the weakly enhanced sample image, and then the first target detection layer in the first sub-model is used and based on the image feature representation vector to predict the pseudo-label information of the weakly enhanced sample image; wherein, the pseudo-label information includes the category pseudo-label and bounding box pseudo-label of each target object in the above-mentioned unlabeled sample image.

[0111] Step A3: Input the strongly enhanced sample image corresponding to each unlabeled sample image in the first sample image set into the second sub-model of the initial object detection model after the latest parameter adjustment for label prediction, and obtain the category prediction label and bounding box prediction label of the unlabeled sample image;

[0112] Specifically, for unlabeled sample images, it is also necessary to obtain the predicted label information of the unlabeled sample images. Based on the predicted label and pseudo label of the unlabeled sample images, the unsupervised sub-loss of the unlabeled sample images can be determined. Therefore, the above-mentioned second sub-model can be used to output the predicted label of the unlabeled sample images; in the specific implementation, for each unlabeled sample image in the above-mentioned first sample image set, the strongly enhanced sample image corresponding to the unlabeled sample image is input into the second sub-model after the last parameter update, and the second representation learning layer in the second sub-model is used to perform feature extraction to obtain the image feature representation vector of the strongly enhanced sample image, and then the second target detection layer in the second sub-model is used and based on the image feature representation vector to predict the predicted label information of the strongly enhanced sample image; wherein, the predicted label information includes the category prediction label and bounding box prediction label of each target object in the above-mentioned unlabeled sample image.

[0113] Step A4: Input each labeled sample image in the first sample image set into the second sub-model of the initial object detection model after the latest parameter adjustment to perform label prediction, and obtain the category prediction label and bounding box prediction label of the labeled sample image;

[0114] Specifically, for labeled sample images, since the true label information of the labeled sample images can be directly obtained, it is only necessary to obtain the predicted label information of the labeled sample images. Based on the predicted label and the true label of the labeled sample images, the supervised sub-loss of the labeled sample images can be determined; in the specific implementation, for each labeled sample image in the above-mentioned first sample image set, the labeled sample image is input into the second sub-model after the last parameter update, and the second representation learning layer in the second sub-model is used to perform feature extraction to obtain the image feature representation vector of the labeled sample image, and then the second target detection layer in the second sub-model is used and based on the image feature representation vector to predict the predicted label information of the labeled sample image; wherein, the predicted label information includes the category prediction label and bounding box prediction label of each target object in the above-mentioned labeled sample image.

[0115] Step A5: determining a semi-supervised classification regression loss based on the category pseudo-labels and bounding box pseudo-labels of the unlabeled sample images, the category prediction labels and bounding box prediction labels of the unlabeled sample images, and the category prediction labels and bounding box prediction labels of the labeled sample images;

[0116] Specifically, based on the category pseudo-labels and bounding box pseudo-labels of the above-mentioned unlabeled sample images, the category prediction labels and bounding box prediction labels of the above-mentioned unlabeled sample images, and the preset unsupervised loss function, the unsupervised classification regression loss is calculated; and based on the category prediction labels and bounding box prediction labels of the above-mentioned labeled sample images, the true category labels and true bounding box labels, and the supervised loss function, the supervised classification regression loss is calculated; and the semi-supervised classification regression loss is determined based on the unsupervised classification regression loss and the supervised classification regression loss.

[0117] Step A6: Iteratively train the first parameter set in the initial target detection model based on the semi-supervised classification regression loss to obtain a first target detection model.

[0118] Specifically, the gradient descent method is used for back propagation, and the parameters of the second representation learning layer and the second target detection layer in the second sub-model are adjusted based on the above-mentioned semi-supervised classification regression loss to obtain the second sub-model with updated parameters; and the EMA method is used to adjust the parameters of the first representation learning layer and the first target detection layer in the first sub-model based on the parameter values ​​after each update of the second sub-model to obtain the first sub-model with updated parameters; after the first training stage, the combination of the first sub-model and the second sub-model after the iterative parameter update is determined as the first target detection model.

[0119] In the process of determining the semi-supervised classification regression loss used for each parameter adjustment in a round of model training, step A5 determines the semi-supervised classification regression loss based on the category pseudo-labels and bounding box pseudo-labels of the unlabeled sample images, the category prediction labels and bounding box prediction labels of the unlabeled sample images, and the category prediction labels and bounding box prediction labels of the labeled sample images, and specifically includes:

[0120] Step A51, determining an unsupervised classification loss based on the category pseudo label and the category prediction label of each unlabeled sample image in the first sample image set;

[0121] Step A52: determining an unsupervised regression loss based on the bounding box pseudo label and the bounding box predicted label of each unlabeled sample image in the first sample image set;

[0122] Step A53: determining a supervised classification loss based on the true category label and the category prediction label of each labeled sample image in the first sample image set;

[0123] Step A54: determining a supervised regression loss based on the true bounding box label and the predicted bounding box label of each labeled sample image in the first sample image set;

[0124] Step A55: Determine the semi-supervised classification regression loss based on the unsupervised classification loss and unsupervised regression loss of each unlabeled sample image in the above-mentioned first sample image set, and the supervised classification loss and supervised regression loss of each labeled sample image in the above-mentioned first sample image set.

[0125] In a specific embodiment, taking the above-mentioned initial target detection model including the first sub-model and the second sub-model and the above-mentioned first sample image set including the first number of unlabeled sample images and the second number of labeled sample images as an example, the iterative update process of the model parameters in the first training stage is shown in Figure 4. The first parameter set in the initial target detection model is iteratively updated based on the first sample image set generated for each parameter update in the first training stage in Figure 3 to obtain the first target detection model, which mainly includes:

[0126] performing weak enhancement processing on a first number of unlabeled sample images in the first sample image set to obtain a first number of weakly enhanced sample images; and performing strong enhancement processing on a first number of unlabeled sample images in the first sample image set to obtain a first number of strongly enhanced sample images;

[0127] Input the weakly enhanced sample images corresponding to each unlabeled sample image in the first sample image set into the first sub-model of the initial target detection model for pseudo-label recognition, and obtain the category pseudo-label and bounding box pseudo-label of each unlabeled sample image;

[0128] Input the strongly enhanced sample images corresponding to each unlabeled sample image in the first sample image set into the second sub-model of the initial object detection model for label prediction, and obtain the category prediction label and bounding box prediction label of each unlabeled sample image;

[0129] Input each labeled sample image in the first sample image set into the second sub-model of the initial object detection model for label prediction, and obtain a category prediction label and a bounding box prediction label for each labeled sample image;

[0130] Determining an unsupervised classification loss based on the category pseudo label and the category predicted label of each unlabeled sample image in the first sample image set;

[0131] determining an unsupervised regression loss based on the bounding box pseudo-label and the bounding box predicted label of each unlabeled sample image in the first sample image set;

[0132] Determining a supervised classification loss based on the true category label and the category prediction label of each labeled sample image in the first sample image set;

[0133] determining a supervised regression loss based on the true bounding box label and the predicted bounding box label of each labeled sample image in the first sample image set;

[0134] Determine a semi-supervised classification and regression loss based on the unsupervised classification loss and unsupervised regression loss of each unlabeled sample image in the first sample image set, and the supervised classification loss and supervised regression loss of each labeled sample image in the first sample image set;

[0135] Based on the above-mentioned semi-supervised classification regression loss, the first parameter set in the initial target detection model is iteratively updated to obtain the first target detection model; specifically, the model parameters of the second sub-model can be obtained by tuning the model parameters based on the semi-supervised classification regression loss using the gradient descent method through back propagation, and the model parameters of the first sub-model can be obtained by updating the parameters based on the parameter values ​​after each update of the second sub-model using the EMA method.

[0136] In the process of obtaining the first sample image set by using the instance-balanced sampling method, the above S204 performs instance-balanced sampling based on the N unlabeled sample images and the M labeled sample images to obtain the first sample image set, specifically including:

[0137] Step B1: selecting a first number of unlabeled sample images from the N unlabeled sample images; wherein the value of the first number is determined based on the total number N of unlabeled sample images and the number of sample sampling batches included in each round of training;

[0138] Specifically, taking the example that the number of sample sampling batches included in each round of training is 5 and N is 1000, that is, for each round of model training, it is necessary to obtain 5 first sample image sets and perform 5 parameter adjustments on the first parameter set; if the value of the first number is equal to the quotient of the total number of unlabeled sample images N and the number of sample sampling batches included in each round of training, then the value of the first number is equal to 200, so that after one round of model training, each unlabeled sample image participates in one parameter adjustment; if the value of the first number is equal to the quotient of the total number of unlabeled sample images N and the number of sample sampling batches included in each round of training multiplied by 2, then the value of the first number is equal to 400, so that after one round of model training, each unlabeled sample image participates in two parameter adjustments; in specific implementation, the value of the first number can be equal to a positive integer multiple of the quotient of the total number of unlabeled sample images N and the number of sample sampling batches included in each round of training.

[0139] Step B2: selecting a second number of labeled sample images from the M labeled sample images; wherein the value of the second number is determined based on the total number M of labeled sample images and the number of sample sampling batches included in each round of training;

[0140] Specifically, taking the example that the number of sample sampling batches included in each round of training is 5 and M is 200, that is, for each round of model training, it is necessary to obtain 5 first sample image sets and perform 5 parameter adjustments on the first parameter set; if the value of the second number is equal to the quotient of the total number of labeled sample images M and the number of sample sampling batches included in each round of training, then the value of the second number is equal to 40, so that after one round of model training, each labeled sample image participates in one parameter adjustment; if the value of the second number is equal to the quotient of the total number of labeled sample images M and the number of sample sampling batches included in each round of training multiplied by 2, then the value of the second number is equal to 80, so that after one round of model training, each labeled sample image participates in two parameter adjustments; in specific implementation, the value of the second number can be equal to a positive integer multiple of the quotient of the total number of labeled sample images M and the number of sample sampling batches included in each round of training.

[0141] Step B3: generating a first sample image set based on the first number of unlabeled sample images and the second number of labeled sample images.

[0142] Specifically, still taking the example that the number of sample sampling batches included in each round of training is equal to 5, N is equal to 1000, and M is equal to 200, each first sample image set can include (200×k) unlabeled sample images and (40×k) labeled sample images; where k is an integer greater than zero.

[0143] In the process of obtaining the second sample image set by using the class-balanced sampling method, the sample image dataset is first split into an unlabeled sample image subset and a labeled sample image subset according to the class division method; then, a preset number of samples are sampled based on the unlabeled sample image subsets and the labeled sample image subsets corresponding to m preset categories to obtain the second sample image set. Specifically, the above S208, performing class-balanced sampling processing based on the above N unlabeled sample images and M labeled sample images to obtain the second sample image set, specifically includes:

[0144] Step C1, based on the category pseudo-label and bounding box pseudo-label of each unlabeled sample image in the sample image dataset, performing image classification on the N unlabeled sample images to obtain multiple unlabeled sample image subsets;

[0145] Specifically, taking the above-mentioned multiple preset categories including preset category 1, preset category 2, preset category 3, and preset category 4 as an example, preset category 1 corresponds to unlabeled sample image subset 1, preset category 2 corresponds to unlabeled sample image subset 2, preset category 3 corresponds to unlabeled sample image subset 3, and preset category 4 corresponds to unlabeled sample image subset 4. If the unlabeled sample image i contains a target object belonging to preset category 1 and the bounding box pseudo label of the target object meets the preset constraint conditions, the unlabeled sample image i is added to the unlabeled sample image subset 1; similarly, if the unlabeled sample image j contains a target object belonging to preset category 2 and the target object If the bounding box pseudo-label of satisfies the preset constraint condition, the unlabeled sample image j is added to the unlabeled sample image subset 2; and so on, the N unlabeled sample images can be divided into the unlabeled sample image subsets 1 to 4; wherein the preset constraint condition may include at least one of a first constraint condition requiring that the bounding box coordinates are within a preset range and a second constraint condition requiring that the coordinate overlap area between the target objects is less than a preset overlap threshold. For the first constraint condition, the unlabeled sample images with the target object at the edge of the image can be eliminated, and for the second constraint condition, the unlabeled sample images with a relatively large overlap area containing two or more target objects can be eliminated;

[0146] In addition, if the unlabeled sample image i contains both a target object belonging to preset category 1 and a target object belonging to preset category 2 and the bounding box pseudo labels of these two target objects satisfy the preset constraints, then not only is the unlabeled sample image i added to the unlabeled sample image subset 1, but the unlabeled sample image i also needs to be added to the unlabeled sample image subset 2; it should be noted that when calculating the unsupervised classification loss and the unsupervised regression loss for the unlabeled sample image i in the unlabeled sample image subset 1, the target object belonging to the preset category 1 participates in the loss calculation, while the target object belonging to the preset category 2 does not participate in the loss calculation; when calculating the unsupervised classification loss and the unsupervised regression loss for the unlabeled sample image i in the unlabeled sample image subset 2, the target object belonging to the preset category 2 participates in the loss calculation, while the target object belonging to the preset category 1 does not participate in the loss calculation;

[0147] Specifically, the category pseudo-label and bounding box pseudo-label of each unlabeled sample image in the above-mentioned sample image dataset can be obtained by pseudo-label recognition using the first target detection model obtained in the first training stage; it can also be obtained by pseudo-label recognition using the first target detection model after the second parameter set is updated in the previous round in the second training stage, that is, with the iterative update of the second parameter set in the first target detection model, before each round of model training, the latest first target detection model is first used to perform pseudo-label recognition to obtain the category pseudo-label and bounding box pseudo-label of each unlabeled sample image; it can also be obtained by pseudo-label recognition using the first target detection model after the second parameter set is updated in the previous training stage, that is, with the iterative update of the second parameter set in the first target detection model, before each parameter update of the current round of model training, the latest first target detection model is first used to perform pseudo-label recognition to obtain the category pseudo-label and bounding box pseudo-label of each unlabeled sample image.

[0148] Step C2: for each preset category, selecting a third number of unlabeled sample images based on the subset of unlabeled sample images corresponding to the preset category;

[0149] Specifically, after splitting the above-mentioned N unlabeled sample images into unlabeled sample image subsets corresponding to m preset categories, a third number of unlabeled sample images can be randomly selected from the unlabeled sample image subsets corresponding to any preset category, or a third number of unlabeled sample images can be selected from the unlabeled sample image subsets corresponding to any preset category in a certain order.

[0150] Specifically, since there are usually relatively few unlabeled sample images containing small category targets, taking the preset category 4 belonging to the small category as an example, the number of unlabeled sample images classified into the unlabeled sample image subset 4 corresponding to the preset category 4 will be relatively small. In order to ensure that the third number of unlabeled sample images selected from the unlabeled sample image subset 4 are all high-quality sample images, a certain unlabeled sample image can be selected repeatedly, that is, the initial sample image subset 4 corresponding to the preset category 4 can include at least two identical unlabeled sample images.

[0151] Step C3, based on the true category label and the true bounding box label of each labeled sample image in the sample image dataset, performing image classification on the M labeled sample images to obtain multiple labeled sample image subsets;

[0152] Specifically, still taking the above-mentioned multiple preset categories including preset category 1, preset category 2, preset category 3, and preset category 4 as an example, preset category 1 corresponds to labeled sample image subset 1, preset category 2 corresponds to labeled sample image subset 2, preset category 3 corresponds to labeled sample image subset 3, and preset category 4 corresponds to labeled sample image subset 4. If the labeled sample image e contains a target object belonging to preset category 1 and the bounding box pseudo label of the target object meets the preset constraint conditions, the labeled sample image e is added to the labeled sample image subset 1; similarly, if the labeled sample image f contains a target object belonging to preset category 2 and the target object If the bounding box pseudo-label of the target object satisfies the preset constraint condition, the labeled sample image f is added to the labeled sample image subset 2; and so on, the M labeled sample images can be divided into labeled sample image subsets 1 to 4; wherein the preset constraint condition may include at least one of a first constraint condition requiring the bounding box coordinates to be within a preset range and a second constraint condition requiring the coordinate overlap area between the target objects to be less than a preset overlap threshold. For the first constraint condition, the labeled sample images with the target object at the edge of the image can be eliminated, and for the second constraint condition, the labeled sample images with a relatively large overlap area containing two or more target objects can be eliminated;

[0153] In addition, if the labeled sample image e contains both a target object belonging to the preset category 1 and a target object belonging to the preset category 2 and the bounding box pseudo labels of these two target objects satisfy the preset constraints, then not only the labeled sample image e is added to the labeled sample image subset 1, but the labeled sample image e also needs to be added to the labeled sample image subset 2; it should be noted that when calculating the supervised classification loss and the supervised regression loss for the labeled sample image e in the labeled sample image subset 1, the target object belonging to the preset category 1 participates in the loss calculation, while the target object belonging to the preset category 2 does not participate in the loss calculation; when calculating the supervised classification loss and the supervised regression loss for the labeled sample image e in the labeled sample image subset 2, the target object belonging to the preset category 2 participates in the loss calculation, while the target object belonging to the preset category 1 does not participate in the loss calculation.

[0154] Step C4: for each preset category, based on the subset of labeled sample images corresponding to the preset category, selecting a fourth number of labeled sample images; wherein the sum of the fourth number and the third number is equal to n;

[0155] Specifically, after splitting the above-mentioned M labeled sample images into labeled sample image subsets corresponding to m preset categories, a fourth number of labeled sample images can be randomly selected from the labeled sample image subsets corresponding to any preset category, or a fourth number of labeled sample images can be selected from the labeled sample image subsets corresponding to any preset category in a certain order.

[0156] Specifically, since there are usually relatively few labeled sample images containing small category targets, taking the preset category 4 belonging to the small category as an example, the number of labeled sample images classified into the labeled sample image subset 4 corresponding to the preset category 4 will be relatively small. In order to ensure that the fourth number of labeled sample images selected from the labeled sample image subset 4 are all high-quality sample images, a certain labeled sample image can be selected repeatedly, that is, the initial sample image subset 4 corresponding to the preset category 4 can include at least two identical labeled sample images.

[0157] Step C5, generating an initial sample image subset corresponding to each preset category based on the third number of unlabeled sample images and the fourth number of labeled sample images corresponding to each preset category;

[0158] Specifically, still taking the above-mentioned multiple preset categories including preset category 1, preset category 2, preset category 3, and preset category 4 as an example, for preset category 1, the third number of unlabeled sample images corresponding to preset category 1 are selected from unlabeled sample image subset 1, and the fourth number of labeled sample images corresponding to preset category 1 are selected from labeled sample image subset 1. Based on the third number of unlabeled sample images and the fourth number of labeled sample images corresponding to preset category 1, the initial sample image subset 1 corresponding to preset category 1 is obtained; and so on, the initial sample image subset 2 corresponding to preset category 2 is obtained, the initial sample image subset 3 corresponding to preset category 3 is obtained, and the initial sample image subset 4 corresponding to preset category 4 is obtained.

[0159] Step C6, determining a set of initial sample image subsets corresponding to the m preset categories as a second sample image set;

[0160] Specifically, still taking the above-mentioned multiple preset categories including preset category 1, preset category 2, preset category 3, and preset category 4 as an example, a second sample image set is generated based on the above-mentioned initial sample image subset 1, initial sample image subset 2, initial sample image subset 3, and initial sample image subset 4; wherein, the number of sample images under different preset categories in the second sample image set is the same, thereby ensuring the category balance of the second sample image set to a certain extent.

[0161] In a specific embodiment, still taking the above-mentioned multiple preset categories including preset category 1, preset category 2, preset category 3, and preset category 4 as an example, the generation process of the second sample image set is shown in FIG4. The above-mentioned FIG2 is based on the above-mentioned N unlabeled sample images and M labeled sample images. The second sample image set is obtained by performing category balanced sampling processing, which mainly includes:

[0162] Based on the category pseudo-label and bounding box pseudo-label of each unlabeled sample image in the above sample image dataset, image classification is performed on the above N unlabeled sample images to obtain multiple unlabeled sample image subsets; for example, preset category 1 corresponds to unlabeled sample image subset 1, preset category 2 corresponds to unlabeled sample image subset 2, preset category 3 corresponds to unlabeled sample image subset 3, and preset category 4 corresponds to unlabeled sample image subset 4;

[0163] For each preset category, selecting a third number of unlabeled sample images based on the subset of unlabeled sample images corresponding to the preset category;

[0164] Based on the true category label and the true bounding box label of each labeled sample image in the above sample image dataset, the M labeled sample images are classified to obtain multiple labeled sample image subsets; for example, preset category 1 corresponds to labeled sample image subset 1, preset category 2 corresponds to labeled sample image subset 2, preset category 3 corresponds to labeled sample image subset 3, and preset category 4 corresponds to labeled sample image subset 4;

[0165] For each preset category, based on the subset of labeled sample images corresponding to the preset category, select a fourth number of labeled sample images; wherein the sum of the fourth number and the third number is equal to n;

[0166] Based on the third number of unlabeled sample images and the fourth number of labeled sample images corresponding to each preset category, generating initial sample image subsets corresponding to the preset categories; for example, preset category 1 corresponds to initial sample image subset 1, preset category 2 corresponds to initial sample image subset 2, preset category 3 corresponds to initial sample image subset 3, and preset category 4 corresponds to initial sample image subset 4;

[0167] A set of initial sample image subsets corresponding to the m preset categories is determined as a second sample image set. For example, the value of m is 4.

[0168] In the process of iteratively updating the model parameters in the second training phase, S110 and S210 iteratively train the second parameter set in the first object detection model based on the second sample image set to obtain the second object detection model, specifically including:

[0169] Step D1: for each preset category, performing weak enhancement processing on a third number of unlabeled sample images in the initial sample image subset corresponding to the preset category to obtain a third number of weakly enhanced sample images; and performing strong enhancement processing on the third number of unlabeled sample images in the initial sample image subset corresponding to the preset category to obtain a third number of strongly enhanced sample images;

[0170] Specifically, for the unlabeled sample images corresponding to any preset category in the above-mentioned second sample image set, a weakly enhanced sample image and a strongly enhanced sample image are generated; still taking the above-mentioned multiple preset categories including preset category 1, preset category 2, preset category 3, and preset category 4 as an example, for preset category 1, each unlabeled sample image in the initial sample image subset 1 corresponding to the preset category 1 is subjected to weak enhancement processing and strong enhancement processing respectively, and a weakly enhanced sample image and a strongly enhanced sample image corresponding to each unlabeled sample image are obtained, and so on, the initial sample image subset 2 corresponding to the preset category 2, the initial sample image subset 3 corresponding to the preset category 3, and the preset category 4 corresponding to the initial sample image subset 4 are respectively subjected to strong enhancement processing. The initial sample image subset 4 is weakly enhanced and strongly enhanced; in addition, it should be noted that, in order to highlight the enhancement effect of the unlabeled sample image, the enhancement area targeted by the weak enhancement and strong enhancement is determined based on the preset category corresponding to the initial sample image subset to which the unlabeled sample image belongs, that is, the enhancement area may include the image area where the target object belongs to the specified preset category (that is, the preset category corresponding to the initial sample image subset to which the unlabeled sample image belongs); for example, for the initial sample image subset 1, the image area where the target object belongs to the preset category 1 in each unlabeled sample image contained in the initial sample image subset 1 is weakly enhanced and strongly enhanced first.

[0171] Step D2, determining a target sample image subset corresponding to the preset category based on the third number of weakly enhanced sample images, the third number of strongly enhanced sample images, and the fourth number of labeled sample images in the initial sample image subset;

[0172] Specifically, still taking the above-mentioned multiple preset categories including preset category 1, preset category 2, preset category 3, and preset category 4 as an example, for preset category 1, the weakly enhanced sample images and strongly enhanced sample images corresponding to the third number of unlabeled sample images in the above-mentioned initial sample image subset 1, and the set of the fourth number of labeled sample images in the above-mentioned initial sample image subset 1 are determined as the target sample image subset 1 corresponding to preset category 1, and so on, to obtain the target sample image subset 2 corresponding to preset category 2, the target sample image subset 3 corresponding to preset category 3, and the target sample image subset 4 corresponding to preset category 4.

[0173] Step D3: inputting a subset of target sample images corresponding to each preset category into the first target detection model, iteratively training the second parameter set in the first target detection model, and obtaining a second target detection model;

[0174] Specifically, still taking the above-mentioned multiple preset categories including preset category 1, preset category 2, preset category 3, and preset category 4 as an example, for each parameter update in the current round of model training (i.e. corresponding to a sample sampling batch), the target sample image subset 1 corresponding to preset category 1, the target sample image subset 2 corresponding to preset category 2, the target sample image subset 3 corresponding to preset category 3, and the target sample image subset 4 corresponding to preset category 4 are input into the first target detection model after the last parameter update, and the second parameter set in the first target detection model is updated once. After multiple rounds of model training (i.e. after the second training stage), the second target detection model is obtained.

[0175] In specific implementation, still taking the above-mentioned initial target detection model including the first sub-model and the second sub-model as an example, correspondingly, the above-mentioned first target detection model includes the first sub-model and the second sub-model; specifically, the above-mentioned step D3, inputting the target sample image subset corresponding to each preset category into the above-mentioned first target detection model, iteratively training the second parameter set in the first target detection model, to obtain the second target detection model, specifically includes:

[0176] Step D31: Input the weakly enhanced sample images in the target sample image subset corresponding to each preset category into the first submodel of the first target detection model after the latest parameter adjustment for pseudo-label recognition, and obtain the category pseudo-label and bounding box pseudo-label of the unlabeled sample image corresponding to the weakly enhanced sample image; wherein the category pseudo-label is the category pseudo-label of the target object belonging to the specified preset category, the bounding box pseudo-label is the bounding box pseudo-label of the target object belonging to the specified preset category, and the specified preset category is the preset category corresponding to the target sample image subset to which the weakly enhanced sample image belongs; for example, for the weakly enhanced sample image in target sample image subset 1, the specified preset category is preset category 1;

[0177] Step D32: Input the strongly enhanced sample images in the target sample image subset corresponding to each preset category into the second submodel of the first target detection model after the latest parameter adjustment for label prediction, and obtain the category prediction label and bounding box prediction label of the unlabeled sample image corresponding to the strongly enhanced sample image; wherein the category prediction label is the category prediction label of the target object belonging to the specified preset category, the bounding box prediction label is the bounding box prediction label of the target object belonging to the specified preset category, and the specified preset category is the preset category corresponding to the target sample image subset to which the strongly enhanced sample image belongs; for example, for the strongly enhanced sample image in the target sample image subset 1, the specified preset category is preset category 1;

[0178] Step D33: Input the labeled sample images in the target sample image subset corresponding to each preset category into the second submodel of the first target detection model after the latest parameter adjustment for label prediction, and obtain the category prediction label and bounding box prediction label of the labeled sample image; wherein the category prediction label is the category prediction label of the target object belonging to the specified preset category, the bounding box prediction label is the bounding box prediction label of the target object belonging to the specified preset category, and the specified preset category is the preset category corresponding to the target sample image subset to which the labeled sample image belongs; for example, for the labeled sample images in target sample image subset 1, the specified preset category is preset category 1;

[0179] Step D34: determining a semi-supervised classification regression loss based on the class pseudo-labels and bounding box pseudo-labels of the unlabeled sample images, the class prediction labels and bounding box prediction labels of the unlabeled sample images, and the class prediction labels and bounding box prediction labels of the labeled sample images.

[0180] Step D35: Iteratively train the second parameter set in the first target detection model based on the above-mentioned semi-supervised classification regression loss to obtain a second target detection model.

[0181] Specifically, step D34 determines the semi-supervised classification regression loss based on the category pseudo-labels and bounding box pseudo-labels of the unlabeled sample images, the category prediction labels and bounding box prediction labels of the unlabeled sample images, and the category prediction labels and bounding box prediction labels of the labeled sample images, and specifically includes:

[0182] Determining an unsupervised classification loss based on the category pseudo labels and category prediction labels of a third number of unlabeled sample images in the initial sample image subset corresponding to each preset category;

[0183] determining an unsupervised regression loss based on the bounding box pseudo labels and bounding box predicted labels of a third number of unlabeled sample images in the initial sample image subset corresponding to each preset category;

[0184] Determining a supervised classification loss based on the true category labels and the category prediction labels of a fourth number of labeled sample images in the initial sample image subset corresponding to each preset category;

[0185] determining a supervised regression loss based on the true bounding box labels and the predicted bounding box labels of a fourth number of labeled sample images in the initial sample image subset corresponding to each preset category;

[0186] Based on the unsupervised classification loss, the unsupervised regression loss, the supervised classification loss, and the supervised regression loss, a semi-supervised classification regression loss is determined.

[0187] Specifically, for the process of determining the semi-supervised classification regression loss in the second training stage, and the process of iteratively training the second parameter set in the first target detection model based on the semi-supervised classification regression loss, refer to the relevant process of the first training stage above and will not be repeated here.

[0188] In a specific embodiment, still taking the above-mentioned first target detection model including the first sub-model and the second sub-model and the above-mentioned second sample image set including the initial sample image subset 1, the initial sample image subset 2, the initial sample image subset 3, and the initial sample image subset 4 as an example, the iterative update process of the model parameters in the second training stage is shown in FIG6. The second parameter set in the first target detection model is iteratively updated based on the second sample image set generated for each parameter update in the second training stage in FIG3 to obtain the second target detection model, which mainly includes:

[0189] For each preset category, performing weak enhancement processing on a third number of unlabeled sample images in the initial sample image subset corresponding to the preset category to obtain a third number of weakly enhanced sample images; and performing strong enhancement processing on the third number of unlabeled sample images in the initial sample image subset corresponding to the preset category to obtain a third number of strongly enhanced sample images;

[0190] For each preset category, input a third number of weakly enhanced sample images corresponding to the preset category into the first submodel of the first object detection model for pseudo-label recognition, and obtain the category pseudo-label and bounding box pseudo-label of each unlabeled sample image in the initial sample image subset corresponding to the preset category;

[0191] For each preset category, input a third number of strongly enhanced sample images corresponding to the preset category into the second submodel of the first object detection model for label prediction, and obtain the category prediction label and bounding box prediction label of each unlabeled sample image in the initial sample image subset corresponding to the preset category;

[0192] For each preset category, input a fourth number of labeled sample images corresponding to the preset category into the second submodel of the first object detection model for label prediction, and obtain a category prediction label and a bounding box prediction label for each labeled sample image in the initial sample image subset corresponding to the preset category;

[0193] Determining an unsupervised classification loss based on the category pseudo label and the category predicted label of each unlabeled sample image in the second sample image set;

[0194] determining an unsupervised regression loss based on the bounding box pseudo-label and the bounding box predicted label of each unlabeled sample image in the second sample image set;

[0195] Determining a supervised classification loss based on the true category label and the category prediction label of each labeled sample image in the second sample image set;

[0196] determining a supervised regression loss based on the true bounding box label and the predicted bounding box label of each labeled sample image in the second sample image set;

[0197] Determine a semi-supervised classification regression loss based on the unsupervised classification loss and the unsupervised regression loss of each unlabeled sample image in the second sample image set, and the supervised classification loss and the supervised regression loss of each labeled sample image in the second sample image set;

[0198] Based on the above-mentioned semi-supervised classification regression loss, the second parameter set in the first target detection model is iteratively updated to obtain a second target detection model; specifically, the model parameters of the second sub-model can be obtained by tuning the model parameters based on the semi-supervised classification regression loss using the gradient descent method through back propagation, and the model parameters of the first sub-model can be obtained by updating the parameters based on the parameter values ​​after each update of the second sub-model using the EMA method.

[0199] It should be noted that in the above Figure 6, for the sake of simplicity of illustration, the initial sample image subset 1 is taken as an example for detailed explanation. The specific implementation process of the initial sample image subset 2, the initial sample image subset 3, and the initial sample image subset 4 refers to the processing process of the initial sample image subset 1 and will not be repeated here.

[0200] In order to take into account both the model training effect and the model training accuracy, preferably, the category pseudo-label and the bounding box pseudo-label of each unlabeled sample image in the above-mentioned sample image dataset are obtained by performing pseudo-label recognition using the first target detection model after the second parameter set is updated in the previous round in the second training stage, that is, as the second parameter set in the first target detection model is iteratively updated, before each round of model training, the latest first target detection model is first used to perform pseudo-label recognition to obtain the category pseudo-label and bounding box pseudo-label of each unlabeled sample image, and then based on the category pseudo-label and bounding box pseudo-label of each unlabeled sample image, the above-mentioned N unlabeled sample images are classified; specifically, before performing image classification on the above-mentioned N unlabeled sample images based on the category pseudo-label and bounding box pseudo-label of each of the above-mentioned unlabeled sample images to obtain multiple unlabeled sample image subsets, it also includes:

[0201] The weakly enhanced sample images corresponding to the above N unlabeled sample images are respectively input into the first target detection model after the previous round of parameter update for pseudo-label recognition, and the category pseudo-label and bounding box pseudo-label of each unlabeled sample image are obtained; wherein, the category pseudo-label is used to characterize the category information of the target to be detected contained in the unlabeled sample image, and the bounding box pseudo-label is used to characterize the position information of the target to be detected contained in the unlabeled sample image, and the above-mentioned target to be detected is a target object belonging to any preset category.

[0202] Specifically, still taking the above-mentioned initial target detection model including the first sub-model and the second sub-model as an example, correspondingly, the above-mentioned first target detection model includes the first sub-model and the second sub-model; the weakly enhanced sample images corresponding to the above-mentioned N unlabeled sample images are input into the first sub-model in the first target detection model after the previous round of parameter update for pseudo-label recognition, and the category pseudo-label and bounding box pseudo-label of each unlabeled sample image are obtained; then, based on the category pseudo-label and bounding box pseudo-label of each unlabeled sample image, the above-mentioned N unlabeled sample images are classified to obtain multiple unlabeled sample image subsets.

[0203] It should be noted that, since the true category labels and true bounding box labels of the labeled sample images are unchanged, the process of performing image classification on the above M labeled sample images based on the true category labels and true bounding box labels of each labeled sample image to obtain multiple labeled sample image subsets can be performed only once.

[0204] Furthermore, considering that both labeled sample images and unlabeled sample images may contain image areas where at least two target objects overlap, such image areas are bound to affect the training accuracy of the model parameters. Considering that in the second training stage, for a certain sample image (i.e., unlabeled sample image or labeled sample image), only the label information of the target object of the specified preset category in the sample image is involved in the loss calculation, if there is a certain overlapping area between the target object of the specified preset category and the target object of the non-specified preset category in the sample image, then the image features of the target object of the non-specified preset category will inevitably be extracted from the image area where the target object of the specified preset category is located, thereby affecting the training accuracy of the model parameters. Therefore, In the process of selecting sample images participating in model training, the coordinate overlap of target objects of different categories can be considered. Based on the area size of the target overlap area between categories of each sample image, the selection priority of each sample image is determined, and the sample images participating in model training are selected based on the selection priority of each sample image; that is, sample images that do not contain target overlap areas between categories are preferentially selected, and sample images that contain target overlap areas between categories that are less than a first preset threshold are secondly selected, and sample images that contain target overlap areas between categories that are greater than a second preset threshold can even be eliminated. Specifically, the above step C2, for each preset category, based on the subset of unlabeled sample images corresponding to the preset category, selects a third number of unlabeled sample images, specifically including:

[0205] For each preset category, based on the first inter-category target overlap information of the unlabeled sample image subset corresponding to the preset category, a third number of unlabeled sample images are selected from the unlabeled sample image subset; wherein the first inter-category target overlap information includes inter-category target overlap area information of each unlabeled sample image in the unlabeled sample image subset, and the inter-category target overlap area information includes the degree of coordinate overlap between target objects belonging to the specified preset category and target objects belonging to non-specified preset categories in the unlabeled sample images;

[0206] Specifically, the designated preset category is the preset category corresponding to the unlabeled sample image subset to which the unlabeled sample image belongs, and the non-designated preset category is the preset category other than the preset category corresponding to the unlabeled sample image subset to which the unlabeled sample image belongs;

[0207] Specifically, for each preset category, the selection priority of each unlabeled sample image is determined based on the inter-category target overlapping area information of each unlabeled sample image in the unlabeled sample image subset corresponding to the preset category, and based on the selection priority of each unlabeled sample image, a third number of unlabeled sample images are selected from the unlabeled sample image subset; that is, unlabeled sample images that do not contain inter-category target overlapping areas are preferentially selected, and then unlabeled sample images that contain inter-category target overlapping areas smaller than a first preset threshold are selected, and even unlabeled sample images that contain inter-category target overlapping areas larger than a second preset threshold can be eliminated.

[0208] Correspondingly, the above step C4, for each preset category, selects a fourth number of labeled sample images based on the subset of labeled sample images corresponding to the preset category, specifically including:

[0209] For each preset category, based on the second inter-category target overlap information of the labeled sample image subset corresponding to the preset category, a fourth number of labeled sample images are selected from the labeled sample image subset; wherein the above-mentioned second inter-category target overlap information includes the inter-category target overlap area information of each labeled sample image in the labeled sample image subset, and the inter-category target overlap area information includes the degree of coordinate overlap between the target object belonging to the specified preset category and the target object belonging to the non-specified preset category in the labeled sample image.

[0210] Specifically, the designated preset category is the preset category corresponding to the labeled sample image subset to which the labeled sample image belongs, and the non-designated preset category is the preset category other than the preset category corresponding to the labeled sample image subset to which the labeled sample image belongs;

[0211] Specifically, for each preset category, the selection priority of each labeled sample image is determined based on the inter-category target overlapping area information of each labeled sample image in the labeled sample image subset corresponding to the preset category, and based on the selection priority of each labeled sample image, a fourth number of labeled sample images are selected from the labeled sample image subset; that is, labeled sample images that do not contain inter-category target overlapping areas are preferentially selected, and then labeled sample images containing inter-category target overlapping areas smaller than a first preset threshold are selected, and even labeled sample images containing inter-category target overlapping areas larger than a second preset threshold can be eliminated.

[0212] The training method of the semi-supervised target detection model in the embodiment of the present application first performs instance balanced sampling based on the sample image data set to obtain a first sample image set; and iteratively trains the first parameter set in the initial target detection model based on the first sample image set to obtain a first target detection model; then, class balanced sampling is performed based on the sample image data set to obtain a second sample image set; and iteratively trains the second parameter set in the first target detection model based on the second sample image set to obtain a second target detection model; finally, the final semi-supervised target detection model is determined based on the second target detection model; in this way, the entire model training process is divided into two training stages, and the image sample sampling methods and learning focuses in different model training stages are different, wherein the first training stage adopts instance balanced sampling. The first sample image set is obtained by the balanced sampling method, focusing on learning image feature extraction, while the second training stage adopts the category balanced sampling method to obtain the second sample image set, focusing on learning image classification and regression, that is, the network parameters related to image representation learning that have been learned in the first training stage are fixed, and the network parameters related to image classification and regression are adjusted. Since the number of targets under different categories in the second sample image set will not deviate too much, it ensures that the model can take into account the learning effects of large category targets and small category targets at the same time, and fundamentally solves the problem of poor learning effect of the model on categories with missing instances due to category imbalance, so that the semi-supervised target detection model finally trained can simultaneously ensure the detection accuracy of large and small categories of targets in the image to be detected.

[0213] Corresponding to the training method of the semi-supervised target detection model described in Figures 1 to 6 above, based on the same technical concept, an embodiment of the present application also provides a target detection method. Figure 7 is a flow chart of the target detection method provided in an embodiment of the present application. The method in Figure 7 can be executed by an electronic device, which can be a terminal device or a designated server. As shown in Figure 7, the method includes at least the following steps:

[0214] S702, obtaining target image data to be detected; wherein the target image data is an image to be detected acquired by an image acquisition device at a designated monitoring point;

[0215] S704, using a pre-trained semi-supervised target detection model and performing target detection based on the above-mentioned target image data to obtain an image detection result of the target image data; wherein the image detection result includes: category information and position information of the target object contained in the target image data, the above-mentioned semi-supervised target detection model is trained by the above-mentioned model training method, and the training process of the semi-supervised target detection model is detailed in the above-mentioned specific embodiment and will not be repeated here.

[0216] Specifically, the model trained by the training method of the semi-supervised target detection model provided in the embodiment of the present application can be applied to any specific application scenario that requires target detection on the image to be detected. For example, in specific application scenario 1, target detection is performed on the image to be detected obtained by using an image acquisition device at the entrance of a shopping mall to obtain the category information and position information of pedestrians in the image to be detected. For another example, in specific application scenario 2, target detection is performed on the image to be detected obtained by using an image acquisition device at a certain moving vehicle monitoring point to obtain the category information and position information of the vehicle in the image to be detected.

[0217] For another example, in specific application scenario 3, after detecting a face recognition request of a target user, a target face image of the target user is obtained; wherein, the target face image includes a user face area and a face background area; a pre-trained semi-supervised target detection model is used to perform target detection based on the above target face image to obtain an image detection result of the target face image; the image detection result includes category information (for example, age, gender, etc.) and location information of the target face, and category information (for example, building color, shape, or door and window color, shape, etc.) and location information of at least one reference target object in the face background area; based on the category information and location information of the target user, and the category information and location information of at least one reference target object, it is determined whether the target user is a risky user. If the target user is a risky user, user, it is determined that the target user's face recognition fails, so as to intercept the target user's business application request; specifically, if the correlation between the image detection result and the risk scenario characteristics of the preliminary screening is greater than the preset threshold, the target user is determined to be a risk user; for example, the risk scenario characteristics of the preliminary screening include the user's age being in a certain age range, the background containing a certain landmark building, and the relative position of the user and the certain landmark building being in a certain position range, then, if the target user's age falls within the age range, at least one reference target object includes the landmark building, and the relative position of the target user and the landmark building falls within the position range, the target user is determined to be a risk user; in this way, it is possible to identify whether the target user is from a certain risk user group, thereby realizing the management and control of the business applications of risk users.

[0218] Specifically, if the semi-supervised object detection model includes the first sub-model in the second object detection model, correspondingly, the above S704 uses the pre-trained semi-supervised object detection model and performs object detection based on the target image data to obtain an image detection result of the target image data, specifically including:

[0219] Performing weak enhancement processing on the target image data to obtain a target weakly enhanced image;

[0220] The above-mentioned target weakly enhanced image is input into the first sub-model in the semi-supervised target detection model for target detection to obtain the image detection result of the target image data.

[0221] It should be noted that, during the model training process (i.e., iteratively updating the model parameters), the initial target detection model to be trained includes a first sub-model and a second sub-model with the same model structure, and the first sub-model inputs a weakly enhanced sample image, and the first sub-model performs label prediction based on the weakly enhanced sample image, and the second sub-model inputs a strongly enhanced sample image, and the second sub-model performs label prediction based on the strongly enhanced sample image. Since the weakly enhanced sample image is obtained by performing enhancement processing such as image scaling and image cropping on the unlabeled sample image that does not change the image information, the output result of the label prediction by the first sub-model can be used as a pseudo-label (equivalent to the role of the real label of the labeled sample image), and the output result of the label prediction by the second sub-model is used as the predicted label, and the model loss is calculated based on the pseudo-label and the predicted label of the unlabeled sample. In the model application stage (i.e., target detection is performed on the image to be detected), the first sub-model after iterative parameter update is used as a semi-supervised target detection model. The target image data to be detected can be directly input into the semi-supervised target detection model for target detection, or the target weakly enhanced image corresponding to the target image data to be detected can be input into the semi-supervised target detection model for target detection to obtain an image detection result; the image detection result includes: the category information and position information of the target object contained in the target image data; the target detection performed by the semi-supervised target detection model is essentially a label prediction for the target image data, so that the category information in the image detection result (i.e., including the category to which each target object belongs) is equivalent to the above-mentioned category pseudo-label, and the position information in the image detection result (i.e., including the coordinate information of the bounding box used to encircle the target object) is equivalent to the above-mentioned bounding box pseudo-label.

[0222] In a specific embodiment, as shown in FIG8 , a specific implementation process of a target detection method is provided, which mainly includes:

[0223] Acquire target image data to be detected; wherein the target image data is the image to be detected acquired by an image acquisition device at a designated monitoring point;

[0224] Performing weak enhancement processing on the target image data to obtain a target weakly enhanced image;

[0225] The above-mentioned target weakly enhanced image is input into the trained semi-supervised target detection model for target detection to obtain the category information and position information of the target object contained in the target image data; wherein, the semi-supervised target detection model can be the first submodel of the second target detection model obtained through the above-mentioned second training stage.

[0226] In the target detection method of the embodiment of the present application, target image data to be detected is input into a pre-trained semi-supervised target detection model for target detection, thereby obtaining category information and location information of the target object contained in the target image data. In this method, the entire model training process of the semi-supervised target detection model is divided into two training stages, and the image sample sampling methods and learning emphases in different model training stages are different. In the first training stage, an instance-balanced sampling method is used to obtain a first sample image set, focusing on learning image feature extraction, while in the second training stage, a class-balanced sampling method is used to obtain a second sample image set, focusing on learning image classification and regression. That is, the network parameters related to image representation learning learned in the first training stage are fixed, and the network parameters related to image classification and regression are adjusted. Since the number of targets under different categories in the second sample image set does not deviate too much, the model can simultaneously take into account the learning effects of large-category targets and small-category targets, fundamentally solving the problem of poor learning effect of the model on categories with missing instances due to class imbalance. As a result, the semi-supervised target detection model finally trained can simultaneously ensure the target classification accuracy and target position prediction accuracy of the image to be detected.

[0227] It should be noted that this embodiment in the present application and the previous embodiment in the present application are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the training method of the aforementioned semi-supervised target detection model, and the repeated parts will not be repeated.

[0228] Corresponding to the training method of the semi-supervised target detection model described in Figures 1 to 6 above, based on the same technical concept, an embodiment of the present application also provides a training device for a semi-supervised target detection model. Figure 9 is a schematic diagram of the module composition of the training device for the semi-supervised target detection model provided in an embodiment of the present application. The device is used to perform the training method of the semi-supervised target detection model described in Figures 1 to 6. As shown in Figure 9, the device includes:

[0229] The sample image acquisition module 902 is used to acquire a sample image dataset; wherein the sample image dataset includes N unlabeled sample images and M labeled sample images; wherein N and M are both integers greater than 1;

[0230] A first sample set generating module 904 is configured to perform instance-balanced sampling processing based on the N unlabeled sample images and the M labeled sample images to obtain a first sample image set;

[0231] a first model training module 906 for iteratively training a first parameter set in an initial object detection model based on the first set of sample images to obtain a first object detection model; wherein the initial object detection model includes a representation learning network and an object detection network, and the first parameter set includes network parameters of the representation learning network and network parameters of the object detection network;

[0232] A second sample set generation module 908 is configured to perform class-balanced sampling processing based on the N unlabeled sample images and the M labeled sample images to obtain a second sample image set; wherein the second sample image set includes m initial sample image subsets, each of which includes n initial sample images belonging to any preset category, where m represents the number of preset categories, and both m and n are integers greater than 1;

[0233] A second model training module 910 is configured to iteratively train a second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model; wherein the second parameter set includes network parameters of the object detection network;

[0234] The target detection model determination module 912 is used to determine a semi-supervised target detection model for image recognition based on the second target detection model.

[0235] The training device of the semi-supervised target detection model in the embodiment of the present application first performs instance balanced sampling based on the sample image data set to obtain a first sample image set; and iteratively trains the first parameter set in the initial target detection model based on the first sample image set to obtain the first target detection model; then, class balanced sampling is performed based on the sample image data set to obtain a second sample image set; and iteratively trains the second parameter set in the first target detection model based on the second sample image set to obtain the second target detection model; finally, the final semi-supervised target detection model is determined based on the second target detection model; in this way, the entire model training process is divided into two training stages, and the image sample sampling methods and learning focuses in different model training stages are different, wherein the first training stage adopts instance balanced sampling. The first sample image set is obtained by the balanced sampling method, focusing on learning image feature extraction, while the second training stage adopts the category balanced sampling method to obtain the second sample image set, focusing on learning image classification and regression, that is, the network parameters related to image representation learning that have been learned in the first training stage are fixed, and the network parameters related to image classification and regression are adjusted. Since the number of targets under different categories in the second sample image set will not deviate too much, it ensures that the model can take into account the learning effects of large category targets and small category targets at the same time, and fundamentally solves the problem of poor learning effect of the model on categories with missing instances due to category imbalance, so that the semi-supervised target detection model finally trained can simultaneously ensure the detection accuracy of large and small categories of targets in the image to be detected.

[0236] It should be noted that the embodiment of the training device for the semi-supervised target detection model in this application and the embodiment of the training method for the semi-supervised target detection model in this application are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding training method for the semi-supervised target detection model mentioned above, and the repeated parts will be omitted.

[0237] Corresponding to the target detection method described in Figures 7 to 8 above, based on the same technical concept, an embodiment of the present application further provides a target detection device. Figure 10 is a schematic diagram of the module composition of the target detection device provided in an embodiment of the present application. The device is used to perform the target detection method described in Figures 7 to 8. As shown in Figure 10, the device includes:

[0238] The image acquisition module 1002 is used to acquire the target image data to be detected;

[0239] The target detection module 1004 is used to use a pre-trained semi-supervised target detection model and perform target detection based on the target image data to obtain an image detection result of the target image data; wherein the image detection result includes: category information and location information of the target object contained in the target image data, and the semi-supervised target detection model is trained by the above-mentioned model training method.

[0240] In the target detection device of the embodiment of the present application, target image data to be detected is input into a pre-trained semi-supervised target detection model for target detection, thereby obtaining category information and location information of the target object contained in the target image data. In this embodiment, the entire model training process of the semi-supervised target detection model is divided into two training stages, and the image sample sampling methods and learning emphases in different model training stages are different. In the first training stage, an instance-balanced sampling method is used to obtain a first sample image set, focusing on learning image feature extraction, while in the second training stage, a class-balanced sampling method is used to obtain a second sample image set, focusing on learning image classification and regression. That is, the network parameters related to image representation learning learned in the first training stage are fixed, and the network parameters related to image classification and regression are adjusted. Since the number of targets under different categories in the second sample image set does not deviate too much, the model can simultaneously take into account the learning effects of large-category targets and small-category targets, fundamentally solving the problem of poor learning effect of the model on categories with missing instances due to class imbalance. As a result, the semi-supervised target detection model finally trained can simultaneously ensure the target classification accuracy and target position prediction accuracy of the image to be detected.

[0241] Furthermore, corresponding to the methods shown in Figures 1 to 8 above, based on the same technical concept, an embodiment of the present application also provides an electronic device for executing the above-mentioned training method of the semi-supervised target detection model or the target detection method, as shown in Figure 11.

[0242] Electronic devices may vary greatly due to different configurations or performance, and may include one or more processors 1101 and memory 1102, and the memory 1102 may store one or more applications or data. The memory 1102 may be a temporary storage or a persistent storage. The application stored in the memory 1102 may include one or more modules (not shown in the figure), each module may include a series of computer-executable instructions in the electronic device. Furthermore, the processor 1101 may be configured to communicate with the memory 1102 to execute a series of computer-executable instructions in the memory 1102 on the electronic device. The electronic device may also include one or more power supplies 1103, one or more wired or wireless network interfaces 1104, one or more input and output interfaces 1105, one or more keyboards 1106, etc.

[0243] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions in the electronic device, and is configured to be executed by one or more processors to perform the following operations:

[0244] Obtain a sample image dataset; wherein the sample image dataset includes N unlabeled sample images and M labeled sample images; wherein N and M are both integers greater than 1;

[0245] Performing instance-balanced sampling processing on the N unlabeled sample images and the M labeled sample images to obtain a first sample image set;

[0246] Iteratively training a first parameter set in an initial target detection model based on the first set of sample images to obtain a first target detection model; wherein the initial target detection model includes a representation learning network and a target detection network, and the first parameter set includes network parameters of the representation learning network and network parameters of the target detection network;

[0247] Performing a class-balanced sampling process on the N unlabeled sample images and the M labeled sample images to obtain a second sample image set; wherein the second sample image set includes m initial sample image subsets, each of which includes n initial sample images belonging to any preset category, where m represents the number of preset categories, and both m and n are integers greater than 1;

[0248] Iteratively training a second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model; wherein the second parameter set includes network parameters of the object detection network;

[0249] A semi-supervised object detection model for image recognition is determined based on the second object detection model.

[0250] In another specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions in the electronic device, and is configured to be executed by one or more processors to perform the following operations:

[0251] Acquire target image data to be detected;

[0252] Target detection is performed based on the target image data using a pre-trained semi-supervised target detection model to obtain an image detection result of the target image data; wherein the image detection result includes: category information and location information of the target object contained in the target image data, and the semi-supervised target detection model is trained by the above-mentioned model training method.

[0253] The electronic device in the embodiment of the present application first performs instance balanced sampling based on the sample image data set to obtain a first sample image set; and iteratively trains the first parameter set in the initial target detection model based on the first sample image set to obtain a first target detection model; then, class balanced sampling is performed based on the sample image data set to obtain a second sample image set; and iteratively trains the second parameter set in the first target detection model based on the second sample image set to obtain a second target detection model; finally, the final semi-supervised target detection model is determined based on the second target detection model; in this way, the entire model training process is divided into two training stages, and the image sample sampling method and learning focus in different model training stages are different, among which the first training stage adopts instance balanced sampling method The first sample image set is obtained, focusing on learning image feature extraction, while the second training stage adopts a class-balanced sampling method to obtain the second sample image set, focusing on learning image classification and regression. That is, the network parameters related to image representation learning that have been learned in the first training stage are fixed, and the network parameters related to image classification and regression are adjusted. Since the number of targets under different categories in the second sample image set will not deviate too much, it ensures that the model can take into account the learning effects of large and small category targets at the same time, and fundamentally solves the problem of poor learning effect of the model on categories with missing instances due to class imbalance, so that the semi-supervised target detection model finally trained can simultaneously ensure the accuracy of target detection of large and small categories in the image to be detected.

[0254] It should be noted that the embodiment of the electronic device in this application and the embodiment of the training method of the semi-supervised target detection model in this application are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding training method of the semi-supervised target detection model mentioned above, and the repeated parts will not be repeated.

[0255] Furthermore, corresponding to the methods shown in FIG. 1 to FIG. 8 above, based on the same technical concept, an embodiment of the present application further provides a computer-readable storage medium for storing computer-executable instructions. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer-executable instructions stored in the storage medium are executed by a processor, the following process can be implemented:

[0256] Obtain a sample image dataset; wherein the sample image dataset includes N unlabeled sample images and M labeled sample images; wherein N and M are both integers greater than 1;

[0257] Performing instance-balanced sampling processing on the N unlabeled sample images and the M labeled sample images to obtain a first sample image set;

[0258] Iteratively training a first parameter set in an initial target detection model based on the first set of sample images to obtain a first target detection model; wherein the initial target detection model includes a representation learning network and a target detection network, and the first parameter set includes network parameters of the representation learning network and network parameters of the target detection network;

[0259] Performing a class-balanced sampling process on the N unlabeled sample images and the M labeled sample images to obtain a second sample image set; wherein the second sample image set includes m initial sample image subsets, each of which includes n initial sample images belonging to any preset category, where m represents the number of preset categories, and both m and n are integers greater than 1;

[0260] Iteratively training a second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model; wherein the second parameter set includes network parameters of the object detection network;

[0261] A semi-supervised object detection model for image recognition is determined based on the second object detection model.

[0262] In another specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc., and the computer executable instructions stored in the storage medium, when executed by the processor, can implement the following process:

[0263] Acquire target image data to be detected;

[0264] Target detection is performed based on the target image data using a pre-trained semi-supervised target detection model to obtain an image detection result of the target image data; wherein the image detection result includes: category information and location information of the target object contained in the target image data, and the semi-supervised target detection model is trained by the above-mentioned model training method.

[0265] When the computer executable instructions stored in the storage medium in the embodiment of the present application are executed by the processor, instance balanced sampling is first performed based on the sample image data set to obtain a first sample image set; and the first parameter set in the initial target detection model is iteratively trained based on the first sample image set to obtain a first target detection model; then, category balanced sampling is performed based on the sample image data set to obtain a second sample image set; and the second parameter set in the first target detection model is iteratively trained based on the second sample image set to obtain a second target detection model; finally, the final semi-supervised target detection model is determined based on the second target detection model; in this way, the entire model training process is divided into two training stages, and the image sample sampling methods and learning focuses in different model training stages are different, wherein the first training stage samples The first sample image set is obtained by instance-balanced sampling, focusing on learning image feature extraction, while the second sample image set is obtained by category-balanced sampling in the second training stage, focusing on learning image classification and regression. That is, the network parameters related to image representation learning that have been learned in the first training stage are fixed, and the network parameters related to image classification and regression are adjusted. Since the number of targets under different categories in the second sample image set will not deviate too much, it ensures that the model can take into account the learning effects of large and small category targets at the same time, and fundamentally solves the problem of poor learning effect of the model on categories with missing instances due to category imbalance, so that the semi-supervised target detection model finally trained can simultaneously ensure the accuracy of target detection of large and small categories in the image to be detected.

[0266] It should be noted that the embodiment of the storage medium in this application and the embodiment of the training method of the semi-supervised target detection model in this application are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding training method of the semi-supervised target detection model mentioned above, and the repeated parts will not be repeated.

[0267] The foregoing description describes specific embodiments of the present application. 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.

[0268] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the embodiments of the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the application can adopt the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to magnetic disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program code.

[0269] The present application is described with reference to the flow chart and / or block diagram of the method, device (system), and computer program product according to the embodiment of the present application. It should be understood that each flow process and / or box in the flow chart and / or block diagram and the combination of the flow process and / or box in the flow chart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processing machine or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one flow chart flow or multiple flows and / or one box or multiple boxes of the block diagram.

[0270] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device that implements the functions specified in one or more processes of the flowchart and / or one or more blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes of the flowchart and / or one or more blocks of the block diagram.

[0271] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), input / output interfaces, network interfaces, and memory. Memory may include non-permanent memory in a computer-readable medium, random-access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium. Computer-readable media, including permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology to store information. 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 Random-Access 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 technologies, 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 medium for storing information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0272] 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.

[0273] The embodiments of the present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present application can also be practiced in a distributed computing environment, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices. The various embodiments in the present application are described in a progressive manner, and the same and similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0274] The foregoing description is merely an example of the present invention and is not intended to limit the present invention. Persons skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims herein.

Claims

1. A training method for a semi-supervised object detection model, It is characterized in that The method comprises: Acquire a sample image data set; wherein the sample image data set includes a plurality of unlabeled sample images and a plurality of labeled sample images; Performing instance-balanced sampling on the multiple unlabeled sample images and the multiple labeled sample images to obtain a first sample image set; Iteratively training a first parameter set in an initial object detection model based on the first sample image set to obtain a first object detection model; Performing category-balanced sampling on the multiple unlabeled sample images and the multiple labeled sample images to obtain a second sample image set; Iteratively training a second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model; A semi-supervised object detection model for image recognition is determined based on the second object detection model.

2. The method according to claim 1, It is characterized in that The initial target detection model includes a representation learning network and a target detection network, and the first parameter set includes network parameters of the representation learning network and network parameters of the target detection network.

3. The method according to claim 2, It is characterized in that The initial target detection model includes a first sub-model and a second sub-model; the representation learning network includes a first representation learning layer in the first sub-model and a second representation learning layer in the second sub-model, and the target detection network includes a first target detection layer in the first sub-model and a second target detection layer in the second sub-model; The determining of a semi-supervised target detection model for image recognition based on the second target detection model includes: The first sub-model in the second object detection model is determined as a semi-supervised object detection model for image recognition.

4. The method according to claim 3, It is characterized in that The first sample image set includes a plurality of labeled sample images and a plurality of unlabeled sample images; The iterative training of the first parameter set in the initial target detection model based on the first sample image set to obtain the first target detection model includes: For each of the unlabeled sample images, performing weak enhancement processing on the unlabeled sample image to obtain a weakly enhanced sample image; and performing strong enhancement processing on the unlabeled sample image to obtain a strongly enhanced sample image; Inputting the weakly enhanced sample images corresponding to each of the unlabeled sample images into the first sub-model for pseudo-label recognition to obtain the category pseudo-labels and bounding box pseudo-labels of the unlabeled sample images; Inputting the strongly enhanced sample images corresponding to each of the unlabeled sample images into the second sub-model for label prediction to obtain the category prediction labels and bounding box prediction labels of the unlabeled sample images; Input each of the labeled sample images into the second sub-model for label prediction to obtain a category prediction label and a bounding box prediction label of the labeled sample image; Determine a semi-supervised classification regression loss based on the category pseudo-label and the bounding box pseudo-label of the unlabeled sample image, the category prediction label and the bounding box prediction label of the unlabeled sample image, and the category prediction label and the bounding box prediction label of the labeled sample image; The first parameter set in the initial target detection model is iteratively trained based on the semi-supervised classification regression loss, and the To the first object detection model.

5. The method according to claim 4, It is characterized in that The determining of the semi-supervised classification regression loss based on the category pseudo-label and the bounding box pseudo-label of the unlabeled sample image, the category prediction label and the bounding box prediction label of the unlabeled sample image, and the category prediction label and the bounding box prediction label of the labeled sample image comprises: Determining an unsupervised classification loss based on the category pseudo-label and the category prediction label of the unlabeled sample image; Determining an unsupervised regression loss based on the bounding box pseudo-label and the bounding box predicted label of the unlabeled sample image; Determining a supervised classification loss based on the true category label and the category prediction label of the labeled sample image; Determining a supervised regression loss based on the true bounding box label and the predicted bounding box label of the labeled sample image; A semi-supervised classification regression loss is determined based on the unsupervised classification loss, the unsupervised regression loss, the supervised classification loss, and the supervised regression loss.

6. The method according to claim 1, It is characterized in that The performing instance balanced sampling processing based on the multiple unlabeled sample images and the multiple labeled sample images to obtain a first sample image set includes: Determine a first number of unlabeled sample images from the plurality of unlabeled sample images; wherein the value of the first number is determined based on the total number of unlabeled sample images and the number of sample sampling batches included in each round of training; Determine a second number of labeled sample images from the plurality of labeled sample images; wherein the value of the second number is determined based on the total number of labeled sample images and the number of sample sampling batches included in each round of training; A first sample image set is generated based on the first number of unlabeled sample images and the second number of labeled sample images.

7. The method according to claim 1, It is characterized in that The performing category-balanced sampling processing based on the multiple unlabeled sample images and the multiple labeled sample images to obtain a second sample image set includes: Based on the category pseudo labels and bounding box pseudo labels of the unlabeled sample images, performing image classification on the multiple unlabeled sample images to obtain multiple unlabeled sample image subsets; Determine a third number of unlabeled sample images based on each preset category and the subset of unlabeled sample images corresponding to the preset category; Based on the true category labels and true bounding box labels of the labeled sample images, performing image classification on the multiple labeled sample images to obtain multiple labeled sample image subsets; Determine a fourth number of labeled sample images based on each of the preset categories and the labeled sample image subsets corresponding to the preset categories; Based on a third number of unlabeled sample images and a fourth number of labeled sample images corresponding to the preset category, generating an initial sample image subset corresponding to the preset category; A set of initial sample image subsets corresponding to each of the preset categories is determined as a second sample image set.

8. The method according to claim 7, It is characterized in that The iterative training of the second parameter set in the first object detection model based on the second sample image set to obtain the second object detection model includes: For each of the preset categories, weak enhancement processing is performed on a third number of unlabeled sample images in the initial sample image subset corresponding to the preset category to obtain a third number of weakly enhanced sample images; and strong enhancement processing is performed on a third number of unlabeled sample images in the initial sample image subset corresponding to the preset category to obtain a third number of strongly enhanced sample images; Determine a target sample image subset corresponding to the preset category based on the third number of weakly enhanced sample images, the third number of strongly enhanced sample images, and a fourth number of labeled sample images in the initial sample image subset; A subset of target sample images corresponding to each of the preset categories is input into the first target detection model, and a second parameter set in the first target detection model is iteratively trained to obtain a second target detection model.

9. The method according to claim 7 or 8, It is characterized in that Before classifying the plurality of unlabeled sample images based on the category pseudo labels and bounding box pseudo labels of the unlabeled sample images to obtain a plurality of unlabeled sample image subsets, the method further includes: The weakly enhanced sample images corresponding to the multiple unlabeled sample images are respectively input into the first target detection model for pseudo-label recognition to obtain the category pseudo-label and bounding box pseudo-label of each of the unlabeled sample images; wherein the category pseudo-label is used to characterize the category information of the target to be detected contained in the unlabeled sample image, and the bounding box pseudo-label is used to characterize the position information of the target to be detected contained in the unlabeled sample image, and the target to be detected is a target object belonging to any preset category.

10. The method according to claim 7, It is characterized in that The determining of a third number of unlabeled sample images based on each preset category and the unlabeled sample image subset corresponding to the preset category comprises: Based on the first inter-category target overlap information of the unlabeled sample image subset corresponding to the preset category, a third number of unlabeled sample images are selected from the unlabeled sample image subset; wherein the first inter-category target overlap information includes inter-category target overlap area information of each unlabeled sample image in the unlabeled sample image subset, and the inter-category target overlap area information includes the degree of coordinate overlap between the target object belonging to the specified preset category and the target object belonging to the non-specified preset category in the unlabeled sample image; The determining, based on each preset category and the subset of labeled sample images corresponding to the preset category, a fourth number of labeled sample images comprises: Based on the second inter-category target overlap information of the subset of labeled sample images corresponding to the preset category, a fourth number of labeled sample images are selected from the subset of labeled sample images; wherein the second inter-category target overlap information includes the inter-category target overlap area information of each labeled sample image in the subset of labeled sample images, and the inter-category target overlap area information includes the degree of coordinate overlap between the target objects belonging to the specified preset category and the target objects belonging to the non-specified preset category in the labeled sample images.

11. A target detection method, It is characterized in that The method comprises: Acquire target image data to be detected; Utilize a pre-trained semi-supervised target detection model and perform target detection based on the target image data to obtain an image detection result of the target image data; wherein the image detection result includes: category information and location information of the target object contained in the target image data, and the semi-supervised target detection model is trained by the method described in any one of claims 1 to 10.

12. The method according to claim 11, It is characterized in that The semi-supervised object detection model includes a first sub-model in the second object detection model; The method of using a pre-trained semi-supervised target detection model and performing target detection based on the target image data to obtain an image detection result of the target image data includes: Performing weak enhancement processing on the target image data to obtain a target weakly enhanced image; The target weakly enhanced image is input into the first sub-model for target detection, and the target image data is obtained. The image detection results.

13. A training device for a semi-supervised object detection model, It is characterized in that The device comprises: A sample image acquisition module, used to acquire a sample image data set; wherein the sample image data set includes a plurality of unlabeled sample images and a plurality of labeled sample images; A first sample set generating module, configured to perform instance-balanced sampling on the plurality of unlabeled sample images and the plurality of labeled sample images to obtain a first sample image set; A first model training module, configured to iteratively train a first parameter set in an initial target detection model based on the first set of sample images to obtain a first target detection model; A second sample set generating module, configured to perform category-balanced sampling on the plurality of unlabeled sample images and the plurality of labeled sample images to obtain a second sample image set; A second model training module, configured to iteratively train a second parameter set in the first object detection model based on the second sample image set to obtain a second object detection model; A target detection model determination module is used to determine a semi-supervised target detection model for image recognition based on the second target detection model.

14. A target detection device, It is characterized in that The device comprises: An image acquisition module is used to acquire target image data to be detected; A target detection module, used to use a pre-trained semi-supervised target detection model and perform target detection based on the target image data to obtain an image detection result of the target image data; wherein the image detection result includes: category information and location information of the target object contained in the target image data, and the semi-supervised target detection model is trained by the method described in any one of claims 1 to 10.

15. An electronic device, It is characterized in that The device comprises: Processor; and A memory arranged to store computer executable instructions, the executable instructions being configured to be executed by the processor, the executable instructions comprising instructions for performing the steps of the method according to any one of claims 1 to 10 or claims 11 or 12.

16. A computer-readable storage medium, It is characterized in that The storage medium is used to store computer-executable instructions, and the executable instructions enable a computer to execute the method according to any one of claims 1 to 10 or claim 11 or 12.

17. A computer program product comprising computer executable instructions, wherein the computer executable instructions enable a computer to perform the method according to any one of claims 1 to 10 or claim 11 or 12.

18. A computer program, the computer program causing a computer to execute the method according to any one of claims 1 to 10 or claim 11 or 12.

Citation Information

Patent Citations

  • Classification network training method and device, classification method and device and electronic equipment

    CN109800807A

  • Image recognition model training method and device, computer equipment and storage medium

    CN111291841A

  • Instance segmentation model training method and device based on artificial intelligence, and storage medium

    CN114399512A

  • Improved two-stage machine learning for imbalanced datasets

    WO2022177581A1

Cited By

  • Pseudo-label enhancement training method using predicted inconsistent samples

    CN120087502A

  • Semi-supervised semantic segmentation and model training method and device based on weighted comparison network

    CN120259673A

  • Image-text content auditing method based on multi-modal large model

    CN120673211A

  • A weak and small target recognition method based on semantic feature restoration

    CN122799371A