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

By adopting the two-stage method of instance balancing and category balancing sampling in the semi-supervised target detection model training, the problem of low detection accuracy of small category targets is solved, and the detection accuracy of large and small category targets is improved simultaneously.

CN118865009APending Publication Date: 2024-10-29MASHANG CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310475583.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-27
Publication Date
2024-10-29

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 model training samples, resulting in category imbalance.

Method used

The model training process is divided into two stages. The first stage uses instance balanced sampling to focus on image feature extraction, and the second stage uses category balanced sampling to focus on image classification and regression to ensure a balanced number of targets in different categories, thereby improving small category targets. detection effect.

Benefits of technology

Through this method, the model can simultaneously improve the detection accuracy of large and small category targets, solve the problem of poor learning effect caused by category imbalance, and ensure the accurate detection of all targets in the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865009A_ABST
    Figure CN118865009A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a semi-supervised target detection model training and target detection method and device, and the method comprises the steps: carrying out the instance balance sampling based on a sample image data set, and obtaining a first sample image set; performing iterative training on a first parameter set in the initial target detection model based on the first sample image set to obtain a first target detection model; performing class balance sampling based on the sample image data set to obtain a second sample image set; performing iterative training on a second parameter set in the first target detection model based on the second sample image set to obtain a second target detection model; and finally, determining a final semi-supervised target detection model based on the second target detection model. In this way, the whole training process is divided into two training stages, and image sample sampling modes and parameter learning emphasis points in different training stages are different, so that the target detection model obtained through final training can simultaneously ensure the detection accuracy of large-category and small-category targets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] 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 rules from a large amount of historical sample data, thereby intelligently identifying new samples or making predictions for the future.

[0003] 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 a head category, and the category with a relatively small number of targets in the image sample data set is called a small category or a 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. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a training, target detection method and device for a semi-supervised target detection model, splitting the entire model training process into two training stages, and the image sample sampling method and parameter learning focus in different training stages are different, so that the target detection model finally trained can simultaneously ensure the accuracy of target detection of large and small categories in the image to be detected.

[0005] In order to implement the above technical solution, the embodiment of the present application is implemented as follows:

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

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

[0008] 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;

[0009] 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;

[0010] Performing a class-balanced sampling process 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, and the initial sample image subsets include n initial sample images belonging to any preset category, where m represents the number of preset categories, and m and n are both integers greater than 1;

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

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

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

[0014] Acquire target image data to be detected;

[0015] 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 the first aspect.

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

[0017] A sample image acquisition module, used to acquire a sample image data set; wherein the sample image data set includes N unlabeled sample images and M labeled sample images; wherein N and M are both integers greater than 1;

[0018] A first sample set generating module, 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;

[0019] 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; 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;

[0020] A second sample set generation module is used to perform category-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, and the initial sample image subsets include n initial sample images belonging to any preset category, where m represents the number of preset categories, and m and n are both integers greater than 1;

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

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

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

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

[0025] 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 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 the first aspect.

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

[0027] 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 in the method as described in the first aspect or the second aspect.

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

[0029] It can be seen that in the embodiment of the present application, instance balanced sampling is first performed based on the sample image data set to obtain a first sample image set; and based on the first sample image set, the first parameter set in the initial target detection model is iteratively trained 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 based on the second sample image set, the second parameter set in the first target detection model is iteratively trained 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 emphases in different model training stages are different, among which the first training stage adopts instance balanced sampling method. A first set of sample images is obtained, focusing on learning image feature extraction, while a second set of sample images is obtained in a class-balanced sampling manner 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 in different categories in the second sample image set will not deviate too much, the model can take into account the learning effects of both large and small category targets at the same time, thereby solving the problem of poor learning effect of the model on categories with missing instances due to class imbalance, and thus the semi-supervised target detection model finally trained can simultaneously ensure the accuracy of target detection of both large and small categories in the image to be detected. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0031] Figure 1 A first flow chart of a method for training a semi-supervised target detection model provided in an embodiment of the present application;

[0032] Figure 2 A schematic diagram of a first implementation principle of a training method for a semi-supervised target detection model provided in an embodiment of the present application;

[0033] Figure 3 A schematic diagram of a second implementation principle of the training method for the semi-supervised target detection model provided in an embodiment of the present application;

[0034] Figure 4A schematic diagram of a third implementation principle of the training method for a semi-supervised target detection model provided in an embodiment of the present application;

[0035] Figure 5 A schematic diagram of a fourth implementation principle of the training method for a semi-supervised target detection model provided in an embodiment of the present application;

[0036] Figure 6 A schematic diagram of a target detection method provided in an embodiment of the present application;

[0037] Figure 7 A schematic diagram of the implementation principle of the target detection method provided in the embodiment of the present application;

[0038] Figure 8 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;

[0039] Fig. 9 A schematic diagram of the module composition of the target detection device provided in an embodiment of the present application;

[0040] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to enable those skilled in the art to better understand the technical solutions in one or more 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 described embodiments are only one or more partial embodiments of the present application, rather than all embodiments. Based on one or more embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

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

[0043] 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 learning effects of both large category targets and small category targets at the same time in order to prompt the model, wherein the 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 the 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 imbalanced categories, usually, 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 imbalanced categories of the sample image data set to a certain extent, by adjusting the classification loss weight of targets between categories, the total weight of the classification loss function will inevitably change. , 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 will cause the model to focus more on the learning of any one of the detection tasks 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, the 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 are different in different model training stages. 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 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 sample images under different categories in the second sample image set is the same, the number of small category targets can be increased, so that the number of targets under different categories will not be increased. The deviation is too large, so as to ensure that the model can take into account the learning effects of large 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 ensure the accuracy of target detection of large and small categories in the image to be detected at the same time; in addition, since there is no need to adjust the weights of the classification loss of different categories of targets in the classification loss function during the entire process of model training, the total weight of the classification loss function will not change, so as to ensure that the weight ratio of the classification loss function and the regression loss function remains unchanged, and thus the model will not focus more on the learning of any detection task in target classification detection and target bounding box detection. ;

[0044] in, Figure 1 A first flow chart of a method for training a semi-supervised target detection model provided in one or more embodiments of the present application, Figure 1 The method in can be executed by an electronic device, which may be a terminal device or a designated server; Figure 1 As shown, the method comprises at least the following steps:

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

[0046] Specifically, N and M are both integers greater than 1, and the value of N can be much greater than the value of M, that is, the number of unlabeled sample images can be much greater 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, the label information including the true label of each target object in the sample image, 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 a plurality of preset categories associated with the target detection task;

[0047] Specifically, a sample image may include at least one target object, and different target objects may belong to the same or different categories; for example, a sample image includes a pedestrian and a dog, and the target objects belong to the categories of human and animal, respectively; for another example, a sample image includes a shopping mall and a car, and the target objects belong to the categories of building and vehicle, 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, and 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 limit this.

[0048] S104, 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;

[0049] Specifically, for the process of iterative training of model parameters, it is usually necessary to adjust the model parameters through multiple rounds of training. Considering that the number of sample images in the sample image data set 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 data set, and a parameter adjustment is performed based on the selected sample images; in addition, for the first training stage, the set of sample images 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 data set using an instance balanced sampling method, so as to obtain a first set of sample images;

[0050] Specifically, the first sample image sets of different batches may be pre-selected or selected in real time, that is, parameter adjustment and sample selection are performed alternately; considering that the image sample loading efficiency is relatively low, it is preferred that multiple batches of first sample image sets are pre-selected, and for the first training stage, multiple instance balanced sampling processes are pre-performed based on the above-mentioned N unlabeled sample images and M labeled sample images to obtain multiple first sample image sets; wherein each first sample image set is used as a sample image set of a certain batch, and parameter adjustment is performed once on the first parameter set;

[0051] 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 data set 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 data set participate in model training is less than the preset number threshold.

[0052] S106, iteratively training a first parameter set in an initial target detection model based on a first sample image set 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;

[0053] 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, 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, a first semi-supervised loss value is calculated, and based on the first semi-supervised loss values ​​corresponding to each first sample image set, the first parameter set in the initial target detection model is adjusted multiple times to obtain a first target detection model;

[0054] 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, the image representation learning and target detection task learning of the initial target detection model are achieved; wherein, the training end condition of the first training stage may 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.

[0055] S108, 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; 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, m represents the number of preset categories, and m and n are both integers greater than 1;

[0056] 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 data set using a class-balanced sampling method to obtain a second sample image set;

[0057] Specifically, different batches of second sample image sets may 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, therefore, preferably, multiple batches of second sample image sets are pre-selected, and for the second training stage, multiple class-balanced sampling processes are pre-performed based on the above-mentioned N unlabeled sample images and M labeled sample images to obtain multiple second sample image sets; wherein each second sample image set is used as a sample image set of a certain batch, and parameter adjustment is performed once on the second parameter set;

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

[0059] 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, and the sets of unlabeled sample image subsets and labeled sample image subsets with the same preset category are 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.

[0060] In some 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.

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

[0062] 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 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 image set, based on the predicted labels and pseudo labels of the third number of unlabeled sample images in the second sample image set, and the predicted labels and true labels of the fourth number of labeled sample images, a second semi-supervised loss value is calculated, and based on the second semi-supervised loss values ​​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;

[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 characterization learning network, therefore, for the second training stage, the network parameters of the characterization 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 may 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 may 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, the product of the second ratio of the second preset number of rounds and the total number of training rounds, and the sum of the first ratio and the second ratio is equal to 100%), or it may be that the semi-supervised loss function corresponding to the above-mentioned first target detection model converges.

[0064] In addition, considering that there is usually a sample image i that contains both target object 1 belonging to preset category a and target object 2 belonging to preset category b, therefore, 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, therefore, 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 the 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 the preset category b is n, then, the initial sample image subset corresponding to the preset category b may include multiple identical sample images i, that is, the same sample image i is repeatedly selected, and at this time, multiple identical sample images i all participate in the calculation of the second semi-supervised loss value.

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

[0066] 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 the network structure of a convolutional neural network CNN; 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), a ROI pooling layer (i.e., Region Of Interest, region of interest extraction), a shared convolutional layer, and a first convolutional layer (corresponding to a classification task, used to output category information) and a second convolutional layer (corresponding to a regression task, used to output 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.

[0067] Specifically, the model parameters of the second sub-model can be obtained by tuning the model parameters by back propagation using the gradient descent method, 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.

[0068] It should be noted that 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; for another 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.

[0069] Among them, due to the different specific application scenarios of the target detection model, the sample image data set used in the target detection model training process is 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 the designated driving vehicle monitoring point within the preset historical time period. Correspondingly, the preset categories can be divided according to vehicle. For specific application scenario 3, the sample image data set 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 basic user attributes and 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.

[0070] In the embodiment of the present application, the entire model training process is divided into two training stages, and the image sample sampling methods and learning emphases 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 and small categories in the image to be detected.

[0071] In a specific embodiment, Figure 2 As shown in the figure, a specific implementation process of a training method for a semi-supervised target detection model is given, which mainly includes:

[0072] Acquire 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., the bounding box coordinate); for example, unlabeled sample images 1 to unlabeled sample images N, labeled sample images 1 to labeled sample images M;

[0073] 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;

[0074] Iteratively updating a first parameter set in an initial target detection model based on a first sample image set generated for each parameter update in a first training stage 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;

[0075] Based on the above N unlabeled sample images and the M labeled sample images, a category-balanced sampling process is performed to obtain a second sample image set;

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

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

[0078] Wherein, for the case where the above-mentioned initial target detection model includes the first sub-model and the 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;

[0079] Correspondingly, the above S112, determining a semi-supervised object detection model for image recognition based on the above second object detection model, specifically includes:

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

[0081] Specifically, taking the first sub-model as the teacher model and the 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 by back propagation using the gradient descent method, 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 through the first training stage and the second training stage is determined as the final semi-supervised target detection model.

[0082] 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;

[0083] Correspondingly, for the process of iteratively updating the model parameters in the first training stage, the above S106, iteratively training the first parameter set in the initial target detection model based on the above first sample image set to obtain the first target detection model, specifically includes:

[0084] Step A1, for each unlabeled sample image in the first sample image set, 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;

[0085] Specifically, based on the multiple unlabeled sample images in the first sample image set, weak enhancement processing and strong enhancement processing are performed to obtain an enhanced sample image combination corresponding to each unlabeled sample image, where the enhanced sample image combination includes a weakly enhanced sample image and a strongly enhanced sample image;

[0086] Specifically, the weak enhancement processing may include enhancement processing such as image scaling and image cropping that will not change the image information; the strong enhancement processing may include enhancement processing such as deleting part of the image area that may change the image information.

[0087] Step A2, inputting 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 after the latest parameter adjustment for pseudo-label recognition, and obtaining the category pseudo-label and bounding box pseudo-label of the unlabeled sample image;

[0088] 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 extract features 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, the pseudo-label information of the weakly enhanced sample image is predicted; 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.

[0089] Step A3, inputting 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 target detection model after the latest parameter adjustment for label prediction, and obtaining the category prediction label and bounding box prediction label of the unlabeled sample image;

[0090] Specifically, for the 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 images.

[0091] Step A4, inputting each labeled sample image in the first sample image set into the second sub-model of the initial target detection model after the latest parameter adjustment to perform label prediction, and obtaining the category prediction label and bounding box prediction label of the labeled sample image;

[0092] 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, and 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 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 extract features 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, the predicted label information of the labeled sample image is predicted; wherein the predicted label information includes the category prediction label and the bounding box prediction label of each target object in the above-mentioned labeled sample image.

[0093] Step A5, determining a semi-supervised classification regression loss based on the category pseudo-label and bounding box pseudo-label of the unlabeled sample image, the category prediction label and bounding box prediction label of the unlabeled sample image, and the category prediction label and bounding box prediction label of the labeled sample image;

[0094] Specifically, 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 a preset unsupervised loss function, an unsupervised classification regression loss is calculated; and based on the category prediction labels and bounding box prediction labels of the labeled sample images, the true category labels and true bounding box labels, and a supervised loss function, a supervised classification regression loss is calculated; and a semi-supervised classification regression loss is determined based on the unsupervised classification regression loss and the supervised classification regression loss.

[0095] Step A6, iteratively training the first parameter set in the initial target detection model based on the above semi-supervised classification regression loss to obtain a first target detection model.

[0096] 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 after parameter update; 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 after parameter update; 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.

[0097] Among them, for the process of determining the semi-supervised classification regression loss used for each parameter adjustment in a certain round of model training, the above step A5 determines the semi-supervised classification regression loss based on the category pseudo-label and bounding box pseudo-label of the above unlabeled sample image, the category prediction label and bounding box prediction label of the above unlabeled sample image, and the category prediction label and bounding box prediction label of the above labeled sample image, and specifically includes:

[0098] Step A51, determining the 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;

[0099] 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;

[0100] 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;

[0101] 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;

[0102] Step A55, determining the semi-supervised classification 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.

[0103] 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 model parameter iterative update process for the first training stage is as follows: Figure 3 As shown above Figure 2 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 to obtain a first target detection model, mainly including:

[0104] 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;

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

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

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

[0108] Determine 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;

[0109] 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;

[0110] Determine 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;

[0111] 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;

[0112] 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 first sample image set, and the supervised classification loss and the supervised regression loss of each labeled sample image in the first sample image set;

[0113] 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 by back propagation using the gradient descent method, 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 by using the EMA method.

[0114] Among them, for the process of obtaining the first sample image set by using the instance balanced sampling method, the above S104, based on the above N unlabeled sample images and the M labeled sample images, performs instance balanced sampling processing to obtain the first sample image set, specifically includes:

[0115] 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;

[0116] 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 secondary parameter adjustment; 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.

[0117] 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;

[0118] 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 secondary parameter adjustment; 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.

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

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

[0121] Among them, for the process of obtaining the second sample image set by using the category balanced sampling method, the sample image data set is first split into an unlabeled sample image subset and a labeled sample image subset according to the category division method; then a preset number of samplings are performed based on the unlabeled sample image subsets and the labeled sample image subsets corresponding to m preset categories respectively to obtain the second sample image set. Specifically, the above S108, based on the above N unlabeled sample images and M labeled sample images, the category balanced sampling process is performed to obtain the second sample image set, which specifically includes:

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

[0123] 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 satisfies the preset constraint condition, 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 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 unlabeled sample images with the target objects 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;

[0124] 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 the 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;

[0125] Specifically, the category pseudo-label and bounding box pseudo-label of each unlabeled sample image in the above-mentioned sample image data set can be obtained by performing pseudo-label recognition using the first target detection model obtained in the first training stage; it can also be 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, 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 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, with the iterative update of the second parameter set in the first target detection model, before each parameter update in 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.

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

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

[0128] 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 repeatedly selected, that is, the initial sample image subset 4 corresponding to the preset category 4 can include at least two identical unlabeled sample images.

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

[0130] 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 satisfies the preset constraint condition, then 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; by analogy, 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, and for the first constraint condition, the labeled sample image with the target object at the edge of the image may be eliminated, and for the second constraint condition, the labeled sample image with a relatively large overlap area containing two or more target objects may be eliminated;

[0131] In addition, if the labeled sample image e 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 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.

[0132] 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;

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

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

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

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

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

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

[0139] 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 as follows: Figure 4 As shown above Figure 2 Based on the above N unlabeled sample images and M labeled sample images, a class-balanced sampling process is performed to obtain a second sample image set, which mainly includes:

[0140] Based on the category pseudo-label and bounding box pseudo-label of each unlabeled sample image in the sample image data set, the N unlabeled sample images are classified 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;

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

[0142] Based on the true category label and the true bounding box label of each labeled sample image in the sample image data set, 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;

[0143] 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;

[0144] 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;

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

[0146] In the process of iteratively updating the model parameters in the second training stage, the above S110, iteratively training the second parameter set in the above first target detection model based on the above second sample image set to obtain the second target detection model, specifically includes:

[0147] 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 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;

[0148] 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 preset category 1 is weakly enhanced and strongly enhanced respectively, to obtain the weakly enhanced sample images and strongly enhanced sample images corresponding to each unlabeled sample image, and so on, the initial sample image subset 2 corresponding to preset category 2, the initial sample image subset 3 corresponding to preset category 3, and the initial sample image subset 4 corresponding to preset category 4 are respectively subjected to weak enhancement processing and 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, with respect to 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.

[0149] 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 a fourth number of labeled sample images in the initial sample image subset;

[0150] 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 the 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.

[0151] Step D3, inputting the target sample image subsets 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;

[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, 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.

[0153] In the specific implementation, the above-mentioned initial target detection model still includes 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, and obtaining the second target detection model, specifically includes:

[0154] Step D31, inputting 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 obtaining 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 the target sample image subset 1, the specified preset category is preset category 1;

[0155] Step D32, inputting the strongly enhanced sample images in the target sample image subset corresponding to each preset category into the second submodel in the first target detection model after the latest parameter adjustment for label prediction, and obtaining 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;

[0156] Step D33, inputting 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 obtaining 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 the target sample image subset 1, the specified preset category is preset category 1;

[0157] Step D34, determining a semi-supervised classification regression loss based on the category pseudo-label and bounding box pseudo-label of the unlabeled sample image, the category prediction label and bounding box prediction label of the unlabeled sample image, and the category prediction label and bounding box prediction label of the labeled sample image;

[0158] Step D35, iteratively training 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.

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

[0160] Determine the 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;

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

[0162] 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;

[0163] 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;

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

[0165] 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 mentioned above, which will not be repeated here.

[0166] 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 model parameter iterative update process for the second training stage is as follows: Figure 5 As shown above Figure 2 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 to obtain a second target detection model, mainly including:

[0167] 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, respectively, to obtain a third number of weakly enhanced sample images; and performing strong 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 strongly enhanced sample images;

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

[0169] For each preset category, a third number of strongly enhanced sample images corresponding to the preset category are input into the second submodel in the first object detection model for label prediction, so as to 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;

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

[0171] Determine the unsupervised classification loss based on the category pseudo label and the category prediction label of each unlabeled sample image in the second sample image set;

[0172] 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;

[0173] Determine 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;

[0174] 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;

[0175] 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;

[0176] 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 by back propagation using the gradient descent method, 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 by using the EMA method.

[0177] It should be noted that in the above Figure 5 In order to simplify the illustration, the initial sample image subset 1 is taken as an example for detailed description, and the specific implementation processes of the initial sample image subset 2, the initial sample image subset 3, and the initial sample image subset 4 refer to the processing process of the initial sample image subset 1, which will not be repeated here.

[0178] Among them, 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 data set 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, 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 the bounding box pseudo-label of each unlabeled sample image, and then based on the category pseudo-label and the 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 the bounding box pseudo-label of each of the above-mentioned unlabeled sample images to obtain multiple unlabeled sample image subsets, it also includes:

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

[0180] 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 respectively 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.

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

[0182] Furthermore, considering that both the labeled sample image and the unlabeled sample image 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., the unlabeled sample image or the labeled sample image), only the label information of the target object of the specified preset category in the sample image participates 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, and the selection priority of each sample image is determined based on the area size of the target overlap area between categories of each sample image, 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 containing target overlap areas between categories that are less than a first preset threshold are secondly selected, and sample images containing 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 unlabeled sample image subset corresponding to the preset category, selects a third number of unlabeled sample images, specifically including:

[0183] 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 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;

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

[0185] Specifically, for each preset category, 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, the selection priority of each unlabeled sample image is determined, 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 unlabeled sample images that contain inter-category target overlapping areas less than a first preset threshold are secondly selected, and even unlabeled sample images that contain inter-category target overlapping areas greater than a second preset threshold can be eliminated.

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

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

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

[0189] Specifically, for each preset category, 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, the selection priority of each labeled sample image is determined, 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 labeled sample images that contain inter-category target overlapping areas less than a first preset threshold are then selected, and labeled sample images that contain inter-category target overlapping areas greater than a second preset threshold may even be eliminated.

[0190] 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 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 emphases in different model training stages are different, wherein the first training stage adopts instance balanced sampling. In the second training stage, the class-balanced sampling method is used to obtain the first sample image set, focusing on learning image feature extraction. In the second training stage, the class-balanced sampling method is used 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 in 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 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 class 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.

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

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

[0193] S604, 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; wherein the image detection result includes: category information and location information of the target object contained in the target image data, the semi-supervised target detection model is trained by the model training method, and the training process of the semi-supervised target detection model is detailed in the above-mentioned specific embodiment, which will not be repeated here.

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

[0195] For another example, in specific application scenario 3, upon 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 target face image to obtain an image detection result of the target face image; the image detection result includes category information (e.g., age, gender, etc.) and location information of the target face, and category information (e.g., 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, and if the target user is a risky user If a target user is found, it is determined that the face recognition of the target user has failed, so as to intercept the business application request of the target user; specifically, if the correlation between the image detection result and the risk scenario characteristics initially screened is greater than a preset threshold, the target user is determined to be a risky user; for example, the risk scenario characteristics initially screened include that the user's age is within a certain age range, the background includes a certain landmark building, and the relative position of the user and the landmark building is within 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 risky user; in this way, it is possible to identify whether the target user is from a certain risky user group, thereby realizing the management and control of business applications of risky users.

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

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

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

[0199] It should be noted that, in the process of model training (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 can be used as a predicted label, and the model loss is calculated based on the pseudo-label and predicted label of the unlabeled sample; In the model application stage (i.e., performing target detection 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: category information and position information of the target object contained in the target image data; target detection by the semi-supervised target detection model is essentially to perform label prediction on 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.

[0200] In a specific embodiment, Figure 7 As shown in the figure, a specific implementation process of a target detection method is given, which mainly includes:

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

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

[0203] 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 sub-model of the second target detection model obtained through the above-mentioned second training stage.

[0204] In the target detection method in the embodiment of the present application, the target image data to be detected is input into a pre-trained semi-supervised target detection model for target detection, so as to obtain the category information and position information of the target object contained in the target image data; wherein, by dividing the entire model training process of the semi-supervised target detection model into two training stages, and the image sample sampling methods and learning emphases 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, and 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 target classification accuracy and target position prediction accuracy of the image to be detected.

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

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

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

[0208] A first sample set generating module 804 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;

[0209] A first model training module 806 is used to iteratively train a first parameter set in an initial target detection model based on the first sample image set 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;

[0210] A second sample set generating module 808 is configured to perform a class-balanced sampling process 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, and the initial sample image subsets include n initial sample images belonging to any preset category, where m represents the number of preset categories, and m and n are both integers greater than 1;

[0211] A second model training module 810 is used 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;

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

[0213] 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 emphases in different model training stages are different, wherein the first training stage adopts instance balanced sampling. In the second training stage, the class-balanced sampling method is used to obtain the first sample image set, focusing on learning image feature extraction. In the second training stage, the class-balanced sampling method is used 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 in 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 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 class 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.

[0214] It should be noted that the embodiment of the training device for a semi-supervised target detection model in the present application and the embodiment of the training method for a semi-supervised target detection model in the present 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 a semi-supervised target detection model mentioned above, and the repeated parts will not be repeated.

[0215] Corresponding to the above Figure 6 to Figure 7 The target detection method described above is based on the same technical concept, and the embodiment of the present application also provides a target detection device. Fig. 9 This is a schematic diagram of the module composition of the target detection device provided in the embodiment of the present application, which is used to perform Figure 6 to Figure 7 The object detection method described, such as Fig. 9 As shown, the device comprises:

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

[0217] The target detection module 904 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.

[0218] In the target detection device in the embodiment of the present application, the target image data to be detected is input into the pre-trained semi-supervised target detection model for target detection, so as to obtain the category information and position information of the target object contained in the target image data; wherein, by dividing the entire model training process of the semi-supervised target detection model into two training stages, and the image sample sampling methods and learning emphases in different model training stages are different, the first training stage adopts the instance balanced sampling method to obtain the first sample image set, focusing on learning image feature extraction, and 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 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 solve the problem of poor learning effect of the model on categories with missing instances due to category imbalance from the root, so that 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.

[0219] Furthermore, corresponding to the above Figures 1 to 7 The method shown in the figure is based on the same technical concept. The embodiment of the present application also provides an electronic device, which is used to execute the training method of the semi-supervised target detection model or the target detection method, such as Fig.10 shown.

[0220] Electronic devices may have relatively large differences due to different configurations or performances, and may include one or more processors 1001 and memory 1002, and the memory 1002 may store one or more storage applications or data. Among them, the memory 1002 may be a short-term storage or a persistent storage. The application stored in the memory 1002 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 1001 may be configured to communicate with the memory 1002 and execute a series of computer executable instructions in the memory 1002 on the electronic device. The electronic device may also include one or more power supplies 1003, one or more wired or wireless network interfaces 1004, one or more input and output interfaces 1005, one or more keyboards 1006, etc.

[0221] 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 for the electronic device, and the one or more programs configured to be executed by one or more processors include the following computer executable instructions:

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

[0223] 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;

[0224] 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;

[0225] Performing a class-balanced sampling process 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, and the initial sample image subsets include n initial sample images belonging to any preset category, where m represents the number of preset categories, and m and n are both integers greater than 1;

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

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

[0228] 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 for the electronic device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following:

[0229] Acquire target image data to be detected;

[0230] 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 above-mentioned model training method.

[0231] 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, a 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 emphases in different model training stages are different, wherein the first training stage adopts instance balanced sampling A first set of sample images is obtained, focusing on learning image feature extraction, while a second set of sample images is obtained in a class-balanced sampling manner 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 in different categories in the second sample image set will not deviate too much, the model can take into account the learning effects of both large and small category targets at the same time, thereby solving the problem of poor learning effect of the model on categories with missing instances due to class imbalance, and thus the semi-supervised target detection model finally trained can simultaneously ensure the accuracy of target detection of both large and small categories in the image to be detected.

[0232] It should be noted that the embodiment of the electronic device in the present application and the embodiment of the training method of the semi-supervised target detection model in the present 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.

[0233] Furthermore, corresponding to the above Figures 1 to 7 The method shown is based on the same technical concept. The embodiment of the present application also provides a computer-readable storage medium for storing computer-executable instructions. In a specific embodiment, the storage medium can 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 the processor, the following process can be implemented:

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

[0235] 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;

[0236] 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;

[0237] Performing a class-balanced sampling process 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, and the initial sample image subsets include n initial sample images belonging to any preset category, where m represents the number of preset categories, and m and n are both integers greater than 1;

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

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

[0240] In another 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 the processor, the following process can be implemented:

[0241] Acquire target image data to be detected;

[0242] 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 above-mentioned model training method.

[0243] 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 based on the first sample image set, a first parameter set in the initial target detection model is iteratively trained 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 based on the second sample image set, a second parameter set in the first target detection model is iteratively trained to obtain a second target detection model; finally, a 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 emphases 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 in 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 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 and small categories in the image to be detected.

[0244] It should be noted that the embodiment of the storage medium in the present application and the embodiment of the training method of the semi-supervised target detection model in the present 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.

[0245] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0246] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the embodiments of the present application may adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the application may adopt the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0247] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented 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 processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0248] 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, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0249] In a typical configuration, a computing device includes one or more processors (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 include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media for storing information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0250] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0251] The embodiments of the present application can be described in the general context of computer executable instructions executed by a computer, such as a program module. Generally, a program module includes 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.

[0252] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.

Claims

1. A training method for a semi-supervised target detection model, characterized in that: The method comprises: Obtain a sample image data set; wherein the sample image data set includes N unlabeled sample images and M labeled sample images, where N and M are both integers greater than 1; 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; 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; Performing a class-balanced sampling process 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, and the initial sample image subsets include n initial sample images belonging to any preset category, where m represents the number of preset categories, and m and n are both integers greater than 1; Iteratively train a second parameter set in the first target detection model based on the second sample image set to obtain a second target detection model; wherein the second parameter set includes network parameters of the target detection network; 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, 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.

3. The method according to claim 2, 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; Based on the semi-supervised classification regression loss, a first parameter set in the initial target detection model is iteratively trained to obtain a first target detection model.

4. The method according to claim 3, 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 each of the unlabeled sample images; Determining an unsupervised regression loss based on the bounding box pseudo-label and the bounding box predicted label of each of the unlabeled sample images; Determining a supervised classification loss based on the true category label and the category prediction label of each of the labeled sample images; Determining a supervised regression loss based on the true bounding box label and the predicted bounding box label of each of the labeled sample images; 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.

5. The method according to claim 1, characterized in that The 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 includes: 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; 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; A first sample image set is generated based on the first number of unlabeled sample images and the second number of labeled sample images.

6. The method according to claim 1, characterized in that The 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 includes: Based on the category pseudo-label and the bounding box pseudo-label of each of the unlabeled sample images, performing image classification on the N unlabeled sample images to obtain a plurality of unlabeled sample image subsets; For each preset category, selecting a third number of unlabeled sample images based on the unlabeled sample image subset corresponding to the preset category; Based on the true category label and the true bounding box label of each of the labeled sample images, performing image classification on the M labeled sample images to obtain multiple labeled sample image subsets; For each of the preset categories, based on the subset of labeled sample images corresponding to the preset category, a fourth number of labeled sample images is selected; the sum of the fourth number and the third number is equal to n; Based on a third number of unlabeled sample images and a fourth number of labeled sample images corresponding to each of the preset categories, generating an initial sample image subset corresponding to the preset category; A set of initial sample image subsets corresponding to the m preset categories is determined as a second sample image set.

7. The method according to claim 6, 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.

8. The method according to claim 6, characterized in that Before classifying the N unlabeled sample images based on the category pseudo-label and the bounding box pseudo-label of each 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 N 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.

9. The method according to claim 6, characterized in that The selecting a third number of unlabeled sample images based on the unlabeled sample image subset corresponding to the preset category includes: 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 selecting a fourth number of labeled sample images based on the labeled sample image subset corresponding to the preset category includes: 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.

10. A target detection method, 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 9.

11. The method according to claim 10, 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 to obtain an image detection result of the target image data.

12. A training device for a semi-supervised target detection model, 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 N unlabeled sample images and M labeled sample images; wherein N and M are both integers greater than 1; A first sample set generating module, 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; 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; 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; A second sample set generation module is used to perform category-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, and the initial sample image subsets include n initial sample images belonging to any preset category, where m represents the number of preset categories, and m and n are both integers greater than 1; A second model training module, configured to iteratively train a second parameter set in the first target detection model based on the second sample image set to obtain a second target detection model; wherein the second parameter set includes network parameters of the target detection network; 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.

13. A target detection device, 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 9.

14. An electronic device, 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 9 or any one of claims 10 or 11.

15. A computer-readable storage medium, 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 9 or any one of claims 10 or 11.

Citation Information

Patent Citations

  • Image recognition method and device for processing unbalanced data

    CN114463582A

  • Improved two-stage machine learning for imbalanced datasets

    WO2022177581A1