Construction method and device of target detection model, electronic equipment and storage medium
By combining fusion training of labeled and unlabeled image data in the target detection model, and using the student module, teacher module and feature fusion module, the problem of data category imbalance is solved and the accuracy and prediction effect of target detection are improved.
Patent Information
- Application Number
- CN202310234381.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2024-09-10
AI Technical Summary
In the field of deep learning, especially in target detection models, the imbalance of data categories leads to the model having better performance in extracting category features with a larger number of samples and poorer performance in extracting category features with a smaller number of samples, resulting in poor classification results. , especially in semi-supervised target detection scenarios, category imbalance increases the prediction bias and affects the accuracy of target detection.
The method of building a target detection model is adopted, including obtaining an image sample set, inputting the model to be trained for training, using the target detection student module, teacher module and feature fusion module for prediction, encoding and feature fusion, generating pseudo labels and fusion features, and updating Model parameters are trained by combining labeled and unlabeled image data to reduce manual labeling workload and improve the prediction accuracy of the model.
In semi-supervised target detection scenarios, by making full use of unlabeled data and labeled data, the prediction accuracy of the model is improved, making the output results of the target detection model closer to the real distribution when put into use, and reducing the cost of manual labeling.
Smart Images

Figure CN118628853A
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology, and in particular to a method, device, electronic device and storage medium for constructing a target detection model. Background Art
[0002] With the development of electronic technology, deep learning is being used more and more widely. Unbalanced data distribution is very common. In the field of deep learning, unbalanced data distribution poses a huge challenge to target classification. In practical applications, the number of samples directly affects the training effect of the target detection model, especially when the number of samples of different categories varies greatly, that is, when the class is unbalanced, the target detection model may have a better detection effect on the target of the category with a large number of samples, and a poorer detection effect on the target of the category with a small number of samples. In the semi-supervised target detection scenario, class imbalance is likely to increase the prediction bias, so the accuracy of target detection needs to be improved. Summary of the invention
[0003] Embodiments of the present application provide a method, device, electronic device, and storage medium for constructing a target detection model to improve the accuracy of target detection based on image data in a semi-supervised target detection scenario.
[0004] In a first aspect, an embodiment of the present application provides a method for constructing a target detection model, comprising:
[0005] Acquire an image sample set; the image sample set includes annotated image samples and unannotated image samples;
[0006] Inputting the image sample set into a first target detection model to be trained to obtain a trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module;
[0007] The target detection student module is used to perform prediction processing according to the image sample set to obtain a target detection prediction result;
[0008] The target detection teacher module is used to perform encoding processing according to the image sample set to generate a first encoding result; and generate a corresponding target detection pseudo label according to the first encoding result;
[0009] The feature fusion module is used to generate a fusion feature according to the first encoding result, the annotated image sample and the unannotated image sample;
[0010] The model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo label and the fusion feature;
[0011] The target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters;
[0012] A target detection model is constructed based on the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model.
[0013] In a second aspect, an embodiment of the present application provides a target detection method, including:
[0014] Acquire the target image to be detected;
[0015] The target image is input into a target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by the target detection model construction method as described in the first aspect.
[0016] In a third aspect, an embodiment of the present application provides a device for constructing a target detection model, including:
[0017] A first acquisition unit is used to acquire an image sample set; the image sample set includes annotated image samples and unannotated image samples;
[0018] A training unit, used for inputting the image sample set into a first target detection model to be trained to obtain a trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module;
[0019] The target detection student module is used to perform prediction processing according to the image sample set to obtain a target detection prediction result;
[0020] The target detection teacher module is used to perform encoding processing according to the image sample set to generate a first encoding result; and generate a corresponding target detection pseudo label according to the first encoding result;
[0021] The feature fusion module is used to generate a fusion feature according to the first encoding result, the annotated image sample and the unannotated image sample;
[0022] The model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo label and the fusion feature;
[0023] The target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters;
[0024] A construction unit is used to construct a target detection model based on the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model.
[0025] In a fourth aspect, an embodiment of the present application provides a target detection device, including:
[0026] A second acquisition unit, used to acquire a target image to be detected;
[0027] The detection unit is used to input the target image into a target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by the target detection model construction method as described in the first aspect.
[0028] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory configured to store computer-executable instructions, wherein when the computer-executable instructions are executed, the processor executes the method for constructing a target detection model as described in the first aspect, or the target detection method as described in the second aspect.
[0029] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium for storing computer-executable instructions, which, when executed by a processor, implement the method for constructing a target detection model as described in the first aspect, or the target detection method as described in the second aspect.
[0030] It can be seen that in an embodiment of the present application, first, an image sample set is obtained; the image sample set includes labeled image samples and unlabeled image samples; then, the image sample set is input into the first target detection model to be trained for training to obtain the trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module; the target detection student module is used to perform prediction processing based on the image sample set to obtain a target detection prediction result; the target detection teacher module is used to perform encoding processing based on the image sample set to generate a first encoding result; based on the first encoding result, a corresponding target detection pseudo-label is generated; the feature fusion module is used to generate a fusion feature based on the first encoding result, the labeled image samples and the unlabeled image samples; the model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo-label and the fusion feature; the target detection student module is also used to update the parameters of the target detection teacher module based on the updated model parameters; finally, based on the trained first target detection model, a target detection model is constructed. The target detection model includes a target detection teacher module in the trained first target detection model, so that the model can be trained in a semi-supervised target detection scenario in combination with labeled image samples and unlabeled image samples. During the training process, prediction processing is performed through the target detection student module to obtain a target detection prediction result, encoding processing is performed through the target detection teacher module to obtain a first encoding result, and a target detection pseudo-label is generated according to the first encoding result. The labeled image samples and the unlabeled image samples are fused through the feature fusion module. Then, the target detection prediction result, the target detection pseudo-label and the fused feature can be used to drive the target detection student module to update the parameters, and the target detection student module after the parameter update can be used to drive the target detection teacher module parameter update, so that the model training process can fully utilize the unlabeled image data to reduce the workload of manual annotation, and the labeled image data can be used to guide model learning, so that the prediction result output by the target detection model constructed based on the trained first target detection model is closer to the real distribution when it is put into use, thereby improving the prediction accuracy of target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.
[0032] Figure 1 A processing flow chart of a method for constructing a target detection model provided in an embodiment of the present application;
[0033] Figure 2 A processing flow chart of another method for constructing a target detection model provided in an embodiment of the present application;
[0034] Figure 3 A processing flow chart of a target detection method provided in an embodiment of the present application;
[0035] Figure 4 A processing flow chart of another target detection method provided in an embodiment of the present application;
[0036] Figure 5 A schematic diagram of a device for constructing a target detection model provided in an embodiment of the present application;
[0037] Figure 6 A schematic diagram of a target detection device provided in an embodiment of the present application;
[0038] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the technical solutions in the embodiments 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 part of the embodiments of this specification, not all of the embodiments. Based on the 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.
[0040] In practical applications, the phenomenon of data category imbalance is very common. In target detection scenarios, category imbalance is likely to cause the model to have better feature extraction performance for categories with a larger number of samples during training, and poorer feature extraction performance for categories with a smaller number of samples, thereby affecting the classification effect of some categories. In semi-supervised target detection scenarios, since a portion of unlabeled data is used, and the category labels of the unlabeled data are unknown, there is a possibility of high category imbalance, which in turn increases the prediction bias, making the accuracy of target detection need to be improved. In order to solve the above problems, an embodiment of the present application provides a method for constructing a target detection model.
[0041] Figure 1 A processing flow chart of a method for constructing a target detection model provided in an embodiment of the present application. Figure 1 The method for constructing a target detection model can be executed by an electronic device, which can be a terminal device, such as a mobile phone, a laptop computer, an intelligent interactive device, etc.; or, the electronic device can also be a server, such as an independent physical server, a server cluster, or a cloud server capable of cloud computing. Figure 1 The method for constructing a target detection model provided in this embodiment specifically includes steps S102 to S106.
[0042] Step S102, obtaining an image sample set; the image sample set includes annotated image samples and unannotated image samples.
[0043] Computer vision is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision that uses cameras and computers to replace human eyes to identify, track and measure targets, and further performs image processing so that the computer processes the images into images that are more suitable for human observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain "information" from images or multidimensional data. The information here refers to information defined by Shannon that can be used to help make a "decision". Because perception can be seen as extracting information from sensory signals, computer vision can also be seen as a science that studies how to make artificial systems "perceive" from images or multidimensional data.
[0044] Object detection is a basic task in computer vision, which refers to detecting the location of an object and the category of the object in an image. The image used to perform the object detection task can contain one or more objects, which can be called the target to be detected in the image.
[0045] To perform the object detection task, it is necessary to predict both the category and the location of the object to be detected. The location of the object to be detected can be represented by a bounding box.
[0046] For example, the bounding box can be a rectangular box that just contains the object to be detected, which can be determined by the x and y axis coordinates of the upper left corner of the rectangle and the x and y axis coordinates of the lower right corner. The origin of the image coordinates can be set at the upper left corner, with the x axis pointing rightward as the positive direction and the y axis pointing downward as the positive direction.
[0047] The image sample set may include one or more labeled image samples, and may also include one or more unlabeled image samples.
[0048] The labeled image sample may be an image sample carrying label data. The label data may include a category label of the target to be detected and may also include a bounding box label of the target to be detected.
[0049] The category label may be an expression representing the true category of the target to be detected, and the true category may be one of a plurality of preset object categories. For example, the preset object category may be a "cat" category, a "dog" category, a "person" category, a "street lamp" category, etc. The bounding box label may be a true bounding box label reflecting the outer contour of the target to be detected, or may be another bounding box label of a preset shape reflecting the position information and size information of the target to be detected.
[0050] For example, the targets to be detected include dogs and cats, and the image sample may be a photo containing a cat and two dogs. The label data may include category label 1 corresponding to the cat in the photo, bounding box label 1 used to reflect the outer contour of the cat in the photo, category label 2 corresponding to the first dog in the photo, bounding box label 2 used to reflect the outer contour of the first dog in the photo, category label 2 corresponding to the second dog in the photo, and bounding box label 3 used to reflect the outer contour of the second dog in the photo.
[0051] An unlabeled image sample may be an image sample that does not carry any label data. In an unlabeled image sample, it is unknown whether there is an object to be detected. If there is an object to be detected, the category label and bounding box label of the object to be detected are also unknown.
[0052] In the image sample set, the ratio of the number of labeled image samples to the number of unlabeled image samples can be preconfigured.
[0053] For example, if the image sample set includes 2n image samples in total, and the ratio of the number of labeled image samples to the number of unlabeled image samples is 1:1, then the image sample set includes n labeled image samples and n unlabeled image samples. n can be a natural number greater than 0.
[0054] The labeled image samples can be used with D s means, specifically:
[0055]
[0056] Wherein, N is used to represent the total number of labeled image samples, and N can be a natural number greater than 1. Labeled image samples D s The i-th labeled image sample in It indicates that, is the image sample corresponding to the i-th labeled image sample, For this image sample Carrying label data. Image sample The image sample may contain one or more bounding boxes, and the position information, size information of the bounding box and the category information of the target to be detected surrounded by the bounding box in the image sample can be obtained through the image sample. Carried tag data Determine. i can be a natural number greater than or equal to 1 and less than or equal to N. Each bounding box surrounds a corresponding object to be detected.
[0057] The i-th image sample Carried tag data It can be used as the ground-truth for classification and regression. Ground-truth refers to the accurate setting value of the training set for the classification result in supervised learning, which is generally used for error estimation and effect evaluation. Carried tag data Can include category labels and bounding box labels, where Represents the category label, K is the total number of category labels, which can be used Represents the bounding box label. K can be a natural number greater than 1.
[0058] In the i-th image sample When there is only one target to be detected in The number is one, The number of is one. The category label corresponding to the unique target to be detected is The bounding box label corresponding to the unique target to be detected is
[0059] In the i-th image sample When there are h targets to be detected, The number of is h, for example, The number of is h, for example, h can be a natural number greater than 1. Among the h targets to be detected, the category label corresponding to the first target to be detected is The bounding box label corresponding to the first target to be detected is ...The category label corresponding to the hth target to be detected is The bounding box label corresponding to the hth target to be detected is
[0060] For example, the targets to be detected include cats and dogs, and the labeled image sample D s The third image sample in It could be a photo of a cat and two dogs. Carried tag data This can include:
[0061] The category label of the cat in the photo category;
[0062] The bounding box label that reflects the outer contour of the cat in the photo
[0063] The class label for the first dog in the photo category;
[0064] The bounding box label that reflects the outline of the first dog in the photo
[0065] The class label for the second dog in the photo category;
[0066] and a bounding box label that reflects the outer contour of the second dog in the photo
[0067] Unlabeled image samples can be used with D u means, specifically:
[0068]
[0069] Where M is used to represent the total number of unlabeled image samples. M can be a natural number greater than 1. u The i-th image sample in The image sample may contain one or more targets to be detected, but since the image sample does not carry any label data, the position information and size information of the bounding box surrounding the target to be detected and the category information of the target to be detected in the image sample are unknown.
[0070] In specific implementation, N k It represents the number of image samples carrying the k-th category label in the labeled image samples, which can be expressed as M k Indicates the number of image samples corresponding to the kth category label of the unlabeled image sample. k can be a natural number greater than 1. Considering that each image sample in the unlabeled image sample does not carry any label data, the category label corresponding to the image sample in the unlabeled image sample can be the category label used to represent the true category of the target to be detected when the image sample contains the target to be detected.
[0071] For example, the total number of category labels K=3, which are the first category label, the second category label, and the third category label. Assume k=2, that is, k corresponds to the second category label. The total number of annotated image samples N=10, and N2 can be used to represent the number of image samples carrying the second category label in the annotated image samples. Assume N2=4, then there are 10 annotated image samples in total, of which 4 image samples carry the second category label.
[0072] For another example, the total number of category labels K=2, which are the first category label and the second category label. Assume k=1, that is, k corresponds to the first category label. The total number of unlabeled image samples M=5, M1 can be used to represent the number of image samples corresponding to the first category label in the unlabeled image samples. Assume M1=3, there are 5 image samples in the unlabeled image samples, of which 3 image samples correspond to the first category label.
[0073] In the case where each image sample corresponds to only one category label, N k and M k Satisfies the following formula:
[0074]
[0075]
[0076] Wherein, N is used to represent the total number of labeled image samples, and N can be a natural number greater than 1. K is used to represent the total number of category labels, and K can be a natural number greater than 1. M is used to represent the total number of unlabeled image samples, and M can be a natural number greater than 1. In addition, k can be a natural number greater than or equal to 1 and less than or equal to K.
[0077] For example, the total number of category labels K=3, which are the first category label, the second category label, and the third category label. When k=1, k corresponds to the first category label; when k=2, k corresponds to the second category label; when k=3, k corresponds to the third category label. The total number of annotated image samples N=10, N1 can be used to represent the number of image samples carrying the first category label in the annotated image sample, N2 can be used to represent the number of image samples carrying the second category label in the annotated image sample, and N3 can be used to represent the number of image samples carrying the third category label in the annotated image sample. In the case where each image sample carries only one category label, assuming N1=5, N2=4, and N3=1, there are a total of 10 annotated image samples, of which 5 image samples carry the first category label, 4 image samples carry the second category label, and 1 image sample carries the third category label. And N1+N2+N3=5+4+1=10=N.
[0078] For another example, the total number of category labels K=2, which are the first category label and the second category label respectively. When k=1, k corresponds to the first category label; when k=2, k corresponds to the second category label. The total number of unlabeled image samples M=5, M1 can be used to represent the number of image samples corresponding to the first category label in the unlabeled image samples, and M2 can be used to represent the number of image samples corresponding to the second category label in the unlabeled image samples. In the case where each image sample corresponds to only one category label, assuming M1=3, M2=2, there are a total of 5 image samples in the unlabeled image samples, of which 3 image samples correspond to the first category label and 2 image samples correspond to the second category label. And M1+M2=3+2=5=M.
[0079] Step S104, input the image sample set into the first target detection model to be trained for training, and obtain the trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module; the target detection student module is used to perform prediction processing based on the image sample set to obtain a target detection prediction result; the target detection teacher module is used to perform encoding processing based on the image sample set to generate a first encoding result; based on the first encoding result, a corresponding target detection pseudo-label is generated; the feature fusion module is used to generate a fusion feature based on the first encoding result, annotated image samples and unlabeled image samples; the model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo-label and the fusion feature; the target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters.
[0080] The first target detection model to be trained may be a target detection model to be trained with model parameters, and can achieve end-to-end class-imbalanced semi-supervised target detection training by learning two-stage target detection from labeled image samples and unlabeled image samples, and performing feature fusion at the same time. The two-stage target detection includes obtaining a region proposal network (RPN) in the first stage and obtaining a region of interest (ROI) for target detection in the second stage.
[0081] In a specific implementation, the target detection teacher module includes a first processing submodule, a first encoding submodule, a first classification submodule and a first regression submodule: the target detection pseudo-label includes a classification pseudo-label and a bounding box pseudo-label; the first processing submodule is used to generate a third image sample corresponding to the image sample set according to each image sample in the image sample set; the first encoding submodule is used to perform encoding processing based on the third image sample to generate a first encoding result; the first classification submodule is used to perform classification prediction processing based on the first encoding result to generate a classification pseudo-label; the first regression submodule is used to perform regression prediction processing based on the first encoding result to generate a bounding box pseudo-label.
[0082] The first processing submodule can be used for sampling processing of pattern samples, and can also be used for weak enhancement processing of image samples.
[0083] In a specific implementation, a third image sample corresponding to the image sample set is generated according to each image sample in the image sample set, including: if the image sample is a labeled image sample, performing class-balanced sampling processing on the image sample to obtain a first image sample corresponding to the image sample; if the image sample is an unlabeled image sample, performing random sampling processing on the image sample to obtain a second image sample corresponding to the image sample; and performing weak enhancement processing on the first image sample and the second image sample, respectively, to obtain a third image sample corresponding to the image sample set.
[0084] According to each image sample in the image sample set, a third image sample corresponding to the image sample set is generated, which may be that the image sample set is first sampled and then weakly enhanced to obtain the third image sample corresponding to the image sample set. In the specific implementation process of first sampling the image sample set, if the image sample is a labeled image sample, sampling the image sample set may include performing class-balanced sampling on the image sample; if the image sample is an unlabeled image sample, sampling the image sample set may include performing random sampling on the image sample.
[0085] Each image sample in the image sample set may be one of a labeled image sample and an unlabeled image sample.
[0086] For example, the image sample set includes 20 image samples in total. Specifically, the image sample set may include annotated image samples D s And unlabeled image samples D u , where the labeled image sample D s The total number of N = 10, the number of unlabeled image samples D u The total number M=10. Among the 20 image samples included in the image sample set, 10 image samples carry corresponding label data, and the other 10 image samples do not carry any label data.
[0087] The number of image samples included in the image sample set can be represented by S1, and S1 can be a natural number greater than 1. S1=M+N. M can be a natural number greater than 1, and N can be a natural number greater than 1.
[0088] The image sample set is first sampled and then weakly enhanced to obtain the third image sample corresponding to the image sample set. The method may be: first, sample S1 image samples to obtain S2 image samples; then, weakly enhance each of the S2 image samples to obtain S2 weakly enhanced image samples; finally, each of the S2 weakly enhanced image samples is determined as the third image sample corresponding to the image sample set. The number of the third image samples corresponding to the image sample set may be S2. S2 may be a natural number greater than 1. The value of S1 is greater than the value of S2.
[0089] In the case where the image sample is a labeled image sample, a class-balanced sampling process is performed on the image sample to obtain a first image sample corresponding to the image sample, which may be a first image sample corresponding to the labeled image sample. Perform class-balanced sampling processing to obtain first image samples corresponding to the labeled image samples. N is used to represent the total number of labeled image samples. N can be a natural number greater than 1. i can be a natural number greater than 1 and less than or equal to N. The number of first image samples corresponding to the labeled image samples can be represented by N'. N' can be a natural number greater than 1 and less than N.
[0090] For example, the labeled image sample D s The total number N=10, class balanced sampling processing is performed on the 10 image samples to obtain N' first image samples, N'=4.
[0091] In specific implementation, the i-th labeled image sample in the labeled image sample can be used It indicates that, is the image sample in the i-th labeled image sample, For this image sample The first processing submodule processes the labeled image sample D s Perform class-balanced sampling. After sampling, some labeled image samples are removed, and other labeled image samples are retained. The i-th labeled image sample is retained and can be determined as the first image sample, using express.
[0092] Class-balanced sampling means that each class has an equal probability of being selected, that is, each class is selected fairly, and then samples are selected from the class.
[0093] Considering Used to represent the i-th image sample, It is used to represent the label data carried by the i-th image sample, which includes the category label. s The class balanced sampling process can be based on the category label of the labeled image sample D s Perform class-balanced sampling processing.
[0094] In specific implementation, a class-balanced sampler can be used to label the image sample D s Perform class-balanced sampling processing.
[0095] In the case where the image sample is an unlabeled image sample, random sampling is performed on the image sample to obtain a second image sample corresponding to the image sample, which can be the unlabeled image sample. A random sampling process is performed to obtain a second image sample corresponding to the unlabeled image sample. M is used to represent the total number of unlabeled image samples. M can be a natural number greater than 1. i can be a natural number greater than or equal to 1 and less than or equal to M. The number of second image samples corresponding to the unlabeled image sample can be represented by M'. M' can be a natural number greater than 1 and less than M.
[0096] The number of third image samples corresponding to the image sample set is S2=N′+M′.
[0097] In specific implementation, the i-th unlabeled image sample in the unlabeled image sample can be used The first processing submodule processes the unlabeled image sample D u After random sampling, some unlabeled image samples are removed and other unlabeled image samples are retained. is retained and can be determined as the second image sample, using express.
[0098] Random sampling means that when taking sub-samples, no human will is imposed on the sampling location and time, so that materials in any part have the opportunity to be sampled.
[0099] In specific implementation, the unlabeled image samples D can be randomly sampled. u Perform random sampling.
[0100] The first image samples and the second image samples are weakly enhanced to obtain the third image samples corresponding to the image sample set. The N' first image samples and the M' second image samples are weakly enhanced and the image samples after the weak enhancement are determined as the third image samples.
[0101] In a specific implementation, first, a sampling process is performed on an image sample set including S1 image samples to obtain S2 intermediate image samples x; the S2 intermediate image samples x include N' first image samples obtained by class-balanced sampling of a total number of N labeled image samples, and also include M' second image samples obtained by random sampling of a total number of M unlabeled image samples; then, a weak enhancement process is performed on the S2 intermediate image samples x to obtain a third image sample α(x) corresponding to each intermediate image sample x, and the S2 third image samples α(x) are determined as the third image samples corresponding to the image sample set.
[0102] α() can be used to indicate weak image enhancement.
[0103] Specifically, the weak enhancement method can be standard flipping and translation.
[0104] In another implementation, generating a third image sample corresponding to the image sample set according to each image sample in the image sample set may be performed by sampling the image sample set to obtain the third image sample corresponding to the image sample set. In the specific implementation of sampling the image sample set, if the image sample is a labeled image sample, sampling the image sample set may include performing class-balanced sampling on the image sample; if the image sample is an unlabeled image sample, sampling the image sample set may include performing random sampling on the image sample. That is, the first processing submodule may be used only for sampling the image sample, and not for weak enhancement processing of the image sample.
[0105] The first encoding submodule is used to perform encoding processing according to the third image sample to generate a first encoding result. In specific implementation, the first encoding submodule can be a feature representative ξ in a teacher model of semi-supervised object detection, or a momentum encoder, or other modules with encoding functions.
[0106] The output of the first encoding submodule may be the input of the first classification submodule, and the output of the first encoding submodule may be the input of the first regression submodule.
[0107] The first classification submodule is used to perform classification prediction processing according to the first encoding result to generate a classification pseudo label. In specific implementation, the first classification submodule can be a classifier h located after the feature indicator ξ. r , used to perform classification prediction processing on the classification label corresponding to the third image sample to obtain a classification prediction result, and determine the classification prediction result as a classification pseudo label. Exemplarily, the classification pseudo label corresponding to the i-th image sample in the image sample set can be express.
[0108] The pseudo-label method is a supervised paradigm that learns from both unlabeled data and labeled data. Specifically, taking image classification as an example, the pseudo-label method can use the category with the maximum prediction probability in the image category prediction results as the classification pseudo-label, and the classification pseudo-label is used for parameter training of the image classification model.
[0109] The first regression submodule is used to perform regression prediction processing according to the first encoding result to generate a bounding box pseudo label. In a specific implementation, the first regression submodule can be a regressor r located after the feature representative ξ, which is used to perform regression prediction processing on the bounding box label corresponding to the third image sample to obtain a regression prediction result, and determine the regression prediction result as the bounding box pseudo label. Exemplarily, the bounding box pseudo label corresponding to the i-th image sample in the image sample set can be express.
[0110] In a specific implementation, the target detection student module includes a second processing submodule, a second encoding submodule, a second classification submodule and a second regression submodule: the target detection prediction result includes a classification prediction result and a bounding box prediction result; the second processing submodule is used to generate a fourth image sample corresponding to the image sample set according to each image sample in the image sample set; the second encoding submodule is used to perform encoding processing based on the fourth image sample to generate a second encoding result; the second classification submodule is used to perform classification prediction processing based on the second encoding result to obtain a classification prediction result; the second regression submodule is used to perform regression prediction processing based on the second encoding result to obtain a bounding box prediction result.
[0111] The second processing submodule can be used for sampling processing of image samples, and can also be used for strong enhancement processing of image samples.
[0112] In a specific implementation method, a fourth image sample corresponding to the image sample set is generated according to each image sample in the image sample set, including: if the image sample is a labeled image sample, randomly sampling the image sample to obtain a fourth image sample corresponding to the image sample; if the image sample is an unlabeled image sample, randomly sampling the image sample to obtain a fifth image sample corresponding to the image sample; and strongly enhancing the fifth image sample to obtain a fourth image sample corresponding to the image sample.
[0113] Each image sample in the image sample set may be one of a labeled image sample and an unlabeled image sample.
[0114] For example, the image sample set includes 20 image samples in total. Specifically, the image sample set may include annotated image samples D s And unlabeled image samples D u , where the labeled image sample D sThe total number of N = 10, the number of unlabeled image samples D u The total number M=10. Among the 20 image samples included in the image sample set, 10 image samples carry corresponding label data, and the other 10 image samples do not carry any label data.
[0115] The number of image samples included in the image sample set can be represented by S1, and S1 can be a natural number greater than 1. S1=M+N. M can be a natural number greater than 1, and N can be a natural number greater than 1.
[0116] In the case where the image sample is a labeled image sample, random sampling is performed on the image sample to obtain a fourth image sample corresponding to the image sample, which may be a random sampling of the labeled image sample. A random sampling process is performed to obtain a fourth image sample corresponding to the labeled image sample. N is used to represent the total number of labeled image samples. N may be a natural number greater than 1. i may be a natural number greater than 1 and less than or equal to N. The number of fourth image samples corresponding to the labeled image sample may be represented by n. n may be a natural number greater than 1 and less than N.
[0117] For example, the labeled image sample D s The total number N=10, the 10 image samples are randomly sampled to obtain n fourth image samples, where n=5.
[0118] In specific implementation, the i-th labeled image sample in the labeled image sample can be used It indicates that, is the image sample in the i-th labeled image sample, For this image sample The second processing submodule processes the labeled image sample D s After random sampling, some of the labeled image samples are removed and the other part of the labeled image samples are retained. is retained and can be determined as the fourth image sample.
[0119] In specific implementation, the random sampler can be used to label the image sample D s Perform random sampling.
[0120] When the image sample is an unlabeled image sample, a random sampling process is performed on the image sample to obtain a fifth image sample corresponding to the image sample; and a strong enhancement process is performed on the fifth image sample to obtain a fourth image sample corresponding to the image sample.
[0121] In the case where the image sample is an unlabeled image sample, random sampling is performed on the image sample to obtain a fifth image sample corresponding to the image sample, which may be the unlabeled image sample. A random sampling process is performed to obtain a fifth image sample corresponding to the unlabeled image sample. M is used to represent the total number of unlabeled image samples. M may be a natural number greater than 1. i may be a natural number greater than or equal to 1 and less than or equal to M. The number of the fifth image samples corresponding to the unlabeled image sample may be represented by m. m may be a natural number greater than 1 and less than M.
[0122] In specific implementation, the i-th unlabeled image sample in the unlabeled image sample can be used The second processing submodule is used to process the unlabeled image sample D u After random sampling, some unlabeled image samples are removed and other unlabeled image samples are retained. is retained and can be determined as the fifth image sample.
[0123] By performing strong enhancement processing on the fifth image sample, a fourth image sample corresponding to the unlabeled image sample can be obtained.
[0124] According to each image sample in the image sample set, a fourth image sample corresponding to the image sample set is generated. In a specific implementation, a random sampling process is performed on the image sample set including S1 image samples to obtain S3 sampled image samples x′; the S3 sampled image samples x′ include n fourth image samples obtained by randomly sampling a total number of N labeled image samples, and also include m fifth image samples obtained by randomly sampling a total number of M unlabeled image samples; the m fifth image samples x′ are strongly enhanced to obtain a fourth image sample corresponding to each fifth image sample x′ The aforementioned n fourth image samples and m fourth image samples The fourth image sample corresponding to the image sample set is determined. It can be used to indicate strong image enhancement.
[0125] Exemplarily, the strong enhancement method adopted by the strong enhancement processing may be CutOut, CTAugment, RandAugment, and the like.
[0126] The second encoding submodule is used to perform encoding processing according to the fourth image sample to generate a second encoding result. In specific implementation, the second encoding submodule can be a feature representative ξ in a student model of semi-supervised target detection, or a momentum encoder, or other modules with encoding functions.
[0127] The output of the second encoding submodule may be the input of the second classification submodule, and the output of the second encoding submodule may be the input of the second regression submodule.
[0128] The second classification submodule is used to perform classification prediction processing according to the second encoding result to obtain a classification prediction result. In specific implementation, the second classification submodule can be a classifier h located after the feature indicator ξ. r , used to perform classification prediction processing on the fourth image sample to obtain a classification prediction result. Exemplarily, the classification prediction result corresponding to the i-th image sample in the image sample set can be used express.
[0129] The second regression submodule is used to perform regression prediction processing according to the second encoding result to obtain a bounding box prediction result. In specific implementation, the second regression submodule can be a regressor r located after the feature representative ξ, which is used to perform regression prediction processing on the bounding box label corresponding to the fourth image sample to obtain a regression prediction result. Exemplarily, the bounding box prediction result corresponding to the i-th image sample in the image sample set can be expressed as express.
[0130] In a specific implementation, the annotated image sample includes first image data and label data; the label data includes at least one of N preset categories; the unlabeled image sample includes second image data; based on the first encoding result, the annotated image sample and the unlabeled image sample, a fusion feature is generated, including: performing statistical processing on the label data to obtain a statistical result of the number of samples corresponding to each preset category; determining a feature fusion probability corresponding to each preset category based on the statistical result; uniformly sampling a preset numerical interval to obtain a target sampling value; generating a fusion feature based on a comparison result of the target sampling value and the feature fusion probability, the first encoding result, the annotated image sample and the unlabeled image sample.
[0131] Annotated image sample D s The first image data may include and Carried tag data The tag data At least one category label is included, and each category label corresponds to one of N preset categories.
[0132] Unlabeled image samples D u The second image data may include
[0133] Perform statistical processing on the label data to obtain the statistical results of the number of samples corresponding to each preset category, which can be in the labeled image sample D s In , for each preset category, the number of image samples carrying the category label of the preset category is counted, that is, the number of samples corresponding to each preset category.
[0134] Uniformly sample a preset numerical interval to obtain target sampling values.
[0135] Exemplarily, the preset numerical interval can be [0, 1]. Uniformly sampling [0, 1] to obtain target sampling values can be generating a random number greater than or equal to 0 and less than or equal to 1, and the generation probability of this random number follows a uniform distribution.
[0136] In a specific implementation manner, according to the statistical results, determine the feature fusion probability corresponding to each preset category, including: according to the statistical results, determine the target preset category as the preset category with the largest number of samples; according to the number of samples corresponding to each preset category and the number of target samples corresponding to the target preset category, determine the feature fusion probability corresponding to each preset category.
[0137] Specifically in implementation, according to the statistical results, determining the target preset category as the preset category with the largest number of samples can be sorting the number of samples corresponding to each preset category in descending order; according to the sorting result, determine the target category with the largest number of samples and the number of target samples corresponding to the target category.
[0138] In the labeled image sample D s , the categories can be sorted in descending order according to the number of training data, that is, N1 ≥ N2 ≥... ≥ N k , then the number of target samples corresponding to the target category with the largest number of samples is N1.
[0139] N1, N2......N k can all be natural numbers greater than or equal to 0.
[0140] Exemplarily, the feature fusion probability corresponding to each preset category can be determined with reference to the following formula:
[0141]
[0142] where P k is used to represent the feature fusion probability corresponding to the kth preset category, k can be any natural number in the numerical interval [1, N], and N k is used to represent the number of samples corresponding to the kth preset category, and N is used to represent the total number of preset categories. N can be a natural number greater than 1.
[0143] For example, the K preset categories include the first preset category, the second preset category, and the third preset category. Among them, the number of samples corresponding to the first preset category is a1, the number of samples corresponding to the second preset category is a2, and the number of samples corresponding to the third preset category is a3, and a1 < a3 < a2. a1, a2, and a3 can all be natural numbers greater than or equal to 0.
[0144] In order to sort the categories in descending order according to the number of training data, the following method can be used:
[0145] N1 is used to represent the number of samples corresponding to the second preset category, that is, the second preset category is the first preset category among the three preset categories. The feature fusion probability P1 corresponding to the first preset category is 0.
[0146] N2 is used to represent the number of samples corresponding to the third preset category, that is, the third preset category is the second preset category among the three preset categories. The feature fusion probability corresponding to the second preset category is
[0147] N3 is used to represent the number of samples corresponding to the first preset category, that is, the first preset category is the third preset category among the three preset categories. The feature fusion probability corresponding to the third preset category is
[0148] The above feature fusion probability, as the mixed probability of the dependent category, can encourage more data enhancement of feature mixing from the long-tail category, thereby improving the data diversity of the long-tail category.
[0149] The feature fusion probability can also be generated using other category-dependent mixed probability calculation methods.
[0150] In a specific implementation method, a fusion feature is generated based on a size comparison result of a target sampling value and a feature fusion probability, a first encoding result, an annotated image sample, and an unannotated image sample, including: if the size comparison result is used to characterize that the target sampling value is less than the feature fusion probability, then a fusion feature is generated based on a preset fusion factor, a first encoding result corresponding to the first image data, a first encoding result corresponding to the second image data, and label data; if the size comparison result is used to characterize that the target sampling value is greater than or equal to the feature fusion probability, then a fusion feature is generated based on a preset fusion factor, a first encoding result corresponding to the first image data, and label data.
[0151] It should be emphasized that the first processing submodule performs sampling processing on the labeled image samples and the unlabeled image samples respectively through different sampling methods, and then performs weak enhancement processing after sampling to obtain the third image samples. Therefore, part of the third image samples are derived from the labeled image samples, and the other part of the third image samples are derived from the unlabeled image samples. The first encoding submodule performs encoding processing on the third image samples to obtain the first encoding result. Therefore, part of the first encoding result is derived from the labeled image samples, and the other part of the first encoding result is derived from the unlabeled image samples. In addition, the labeled image samples include the first image data, and the unlabeled image samples include the second image data. Therefore, part of the first encoding result corresponds to the first image data, and the other part of the first encoding result corresponds to the second image data.
[0152] The preset fusion factor λ obeys a uniform distribution (μ, 1), where μ is a preset hyperparameter, that is, λ is obtained by uniform sampling from the numerical interval [μ, 1].
[0153] For synthetic samples, this embodiment uses a preset fusion factor λ to ensure that the label data Specifically, λ can be used to adjust the ratio of labeled image data to unlabeled image data in the fused data. When the ratio of labeled image data is greater than a preset ratio threshold, the reliability of the label data in the fused data is higher.
[0154] If the target sampling value is less than the feature fusion probability, a fusion feature is generated according to the preset fusion factor λ, the first encoding result corresponding to the first image data, the first encoding result corresponding to the second image data, and the label data. Exemplarily, the fusion feature can be determined by referring to the following formula:
[0155]
[0156]
[0157] in, Used to represent the first sub-feature in the i-th fusion feature, It is used to represent the second sub-feature in the i-th fusion feature. The first sub-feature can be based on the first image data. The corresponding first encoding result Second image data The corresponding first encoding result And the preset fusion factor λ is calculated, the second sub-feature can be based on the first image data Carried tag data OK. i can be a natural number greater than 0.
[0158] First image data The corresponding first encoding result The first image data may be first subjected to quasi-balanced sampling processing by the first processing submodule, and then subjected to weak enhancement processing to obtain third image data corresponding to the first image data, and then the third image data may be encoded by the first encoding submodule to obtain a first encoding result.
[0159] Second image data The corresponding first encoding result The second image data may be first randomly sampled by the first processing submodule, then weakly enhanced to obtain third image data corresponding to the second image data, and then encoded by the first encoding submodule to obtain a first encoding result.
[0160] If the target sampling value is greater than or equal to the feature fusion probability, a fusion feature is generated according to a preset fusion factor, a first encoding result corresponding to the first image data, and the label data. For example, the fusion feature can be determined by referring to the following formula:
[0161]
[0162]
[0163] in, Used to represent the first sub-feature in the i-th fusion feature, It is used to represent the second sub-feature in the i-th fusion feature. The first sub-feature can be based on the first image data. The corresponding first encoding result And the preset fusion factor λ is calculated, the second sub-feature can be based on the first image data Carried tag data OK. i can be a natural number greater than 0.
[0164] First image data The corresponding first encoding result The first image data may be first subjected to quasi-balanced sampling processing by the first processing submodule, and then subjected to weak enhancement processing to obtain third image data corresponding to the first image data, and then the third image data may be encoded by the first encoding submodule to obtain a first encoding result.
[0165] After generating the fusion features, classification prediction processing can be performed based on the fusion features to obtain the classification prediction results corresponding to the fusion features. The classification prediction results can be used to drive the parameter update of the target detection student module.
[0166] The first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module. The model parameters of the target detection student module are updated based on the target detection prediction results, the target detection pseudo labels, and the fusion features.
[0167] In specific implementation, the model parameters of the target detection student module can be updated according to the target detection prediction results, the target detection pseudo labels and the fusion features. For example, in the i-th training, the loss function value of the i-th training is generated according to the target detection prediction results, the target detection pseudo labels and the fusion features; according to the loss function value of the i-th training, the model parameters of the target detection student module are updated. i can be a natural number greater than 0.
[0168] The loss function value of the i-th training can include the loss function L for supervised training of target detection on labeled image datas , the loss function L for semi-supervised object detection on unlabeled image data u , characterizing the classification loss function L of the fusion c One or more of .
[0169] For example, the loss function value L of the i-th training total You can refer to the following formula:
[0170] L total =L s +λ u L u +λ c L c (10)
[0171] Among them, λ u It is used to represent the fusion factor corresponding to semi-supervised target detection on unlabeled image data, λ u Can be a fixed value of a custom setting. c Used to represent the fusion factor corresponding to feature fusion, λ c Can be a fixed value of a custom setting.
[0172] The loss function L for supervised training of object detection on labeled image data s It can be composed of four parts, RPN classification loss function RPN regression loss function ROI classifier h r The loss function ROI regression loss function
[0173] The target detection student module may include a PRN submodule and a ROI submodule, wherein the target detection prediction results obtained by performing target detection through the PRN submodule include the classification prediction results and bounding box prediction results corresponding to the region candidate box PRN; the target detection prediction results obtained by performing target detection through the ROI submodule include the classification prediction results and bounding box prediction results corresponding to the region of interest ROI.
[0174] The data processing flow of the PRN submodule and the ROI submodule can refer to the corresponding description part of "The target detection student module includes a second processing submodule, a second encoding submodule, a second classification submodule and a second regression submodule".
[0175] The target detection prediction results obtained by the target detection student module through prediction processing based on the image sample set may include the classification prediction results and bounding box prediction results corresponding to the region candidate box PRN and the classification prediction results and bounding box prediction results corresponding to the region of interest ROI.
[0176] L s The generation method can refer to the following formula:
[0177]
[0178] Wherein, B is used to represent the sample batch size set in model training, that is, the number of samples corresponding to a batch of image samples. i can be a natural number greater than 0 and less than or equal to B. B can be a natural number greater than 1.
[0179] In a batch of image samples, the RPN classification loss function corresponding to the i-th image sample is It can be generated based on the classification prediction result and the true classification label corresponding to the region candidate box PRN. In the case where the image sample is a labeled image sample, the true classification label can be the classification label in the label data carried by the labeled image sample; in the case where the image sample is an unlabeled image sample, the true classification label can be the classification pseudo label generated by the target detection teacher model for the unlabeled image sample. In a batch of image samples, the RPN regression loss function corresponding to the i-th image sample It can be generated based on the bounding box prediction result and the true bounding box label corresponding to the region candidate box PRN. In the case where the image sample is a labeled image sample, the true bounding box label can be the bounding box label in the label data carried by the labeled image sample; in the case where the image sample is an unlabeled image sample, the true bounding box label can be the bounding box pseudo label generated by the target detection teacher model for the unlabeled image sample. In a batch of image samples, the ROI classifier h corresponding to the i-th image sample r The loss function It can be generated based on the classification prediction result and the true classification label corresponding to the region of interest ROI. In the case where the image sample is a labeled image sample, the true classification label can be the classification label in the label data carried by the labeled image sample; in the case where the image sample is an unlabeled image sample, the true classification label can be the classification pseudo label generated by the target detection teacher model for the unlabeled image sample.
[0180] In a batch of image samples, the ROI regression loss function corresponding to the i-th image sample is It can be generated based on the bounding box prediction result corresponding to the region of interest ROI and the true bounding box label. In the case where the image sample is a labeled image sample, the true bounding box label can be the bounding box label in the label data carried by the labeled image sample; in the case where the image sample is an unlabeled image sample, the true bounding box label can be the bounding box pseudo label generated by the target detection teacher model for the unlabeled image sample.
[0181] For example, the process of semi-supervised object detection on unlabeled image data is as follows: Strongly enhanced image Input into the target detection student module to obtain the classification prediction of unlabeled data and regression prediction The target detection student module consists of a feature representation ξ, a semi-supervised classifier h r And regressor r. Weakly enhanced image Input into the target detection teacher module to obtain the classification pseudo labels of the unlabeled data and regress pseudo labels The target detection teacher module consists of a feature representation ξ, a semi-supervised classifier h r and the regressor r.
[0182] Unlabeled images Weak enhancement and strong enhancement Weak enhancement Input into the classifier corresponding to the target detection teacher module to obtain the classification pseudo-label of the unlabeled data in the second stage ROI and regress pseudo labels
[0183] Strong Enhancement Input into the classifier corresponding to the target detection student module to obtain the classification prediction of the unlabeled data in the second stage ROI and regression prediction
[0184] Loss function for semi-supervised object detection without labeled images:
[0185]
[0186]
[0187] Wherein, B is used to represent the sample batch size set in model training, that is, the number of samples corresponding to a batch of image samples. i can be a natural number greater than 0 and less than or equal to B. B can be a natural number greater than 1. Represents the loss function of the prediction results between the RPN in the target detection teacher module and the RPN in the target detection student module for target detection, Represents the loss function of the prediction results between the ROI in the target detection teacher module and the ROI in the target detection student module in the second stage of target detection. A Represents the number of all anchors in the RPN of the first stage target detection teacher module and target detection student module. j can be greater than or equal to 0 and less than or equal to s A A natural number. and Represents the classification information of the RPN prediction class in the target detection teacher module and the results of bounding box regression corresponding to all classes. and Represents the classification information of the RPN prediction class in the target detection student module and the results of bounding box regression corresponding to all classes. KL KL divergence (Kullback-Leibler divergence, relative entropy), is a measure of the asymmetry of the difference between two probability distributions.
[0188] After the RPN of the target detection teacher module generates a series of region proposals, the NMS (non maximum suppression) algorithm is used to remove region proposals with small classification values. In this way, the target detection teacher module obtains the top-N region proposals, thereby generating pseudo labels for the top-N region proposals. N can be a natural number greater than 1. In practical applications, N can be an empirical value (such as a range of 600 to 700). P Represents the number of top-N region proposals obtained by the RPN of the target detection teacher module through the NMS algorithm.
[0189] Considering that the number of region proposals generated by the target detection teacher module is more accurate, in this implementation, only the target detection teacher module can be used to obtain the top-N region proposals, without using the number of region proposals in the target detection student module.
[0190]
[0191] in, and Represents the ROI classifier h of the teacher model r Predicted classification probability and class corresponding area, and Represents the ROI classifier h of the student model r The predicted classification probability and the corresponding area of the class. i can be a natural number greater than 0 and less than or equal to B. B can be a natural number greater than 1. B is used to represent the sample batch size set in model training, that is, the number of samples corresponding to a batch of image samples. j can be greater than or equal to 0 and less than or equal to s p A natural number. p Represents the number of all anchors in the ROI of the second-stage target detection teacher module and the target detection student module.
[0192] Exemplarily, the classification loss function L that characterizes the fusion c You can refer to the following formula:
[0193]
[0194] Where B is used to represent the batch size, and B can be a natural number greater than 1. CE () is used to represent the cross entropy loss function, h c () is used to represent the classification prediction processing of the classifier in the classification learning after characterization fusion. Used to represent the first sub-feature in the fusion feature. Used to represent the second sub-feature in the fused feature.
[0195] The object detection student module can also be used to update the parameters of the object detection teacher module according to the updated model parameters.
[0196] In specific implementation, the EMA (exponential moving average) method can be used to update the first encoding submodule in the target detection teacher module, that is, the feature encoder in the teacher model. The second encoding submodule in the target detection student module, that is, the feature encoder in the student model, is updated to the first encoding submodule in the target detection teacher module.
[0197] Exemplarily, the target detection student module updates the parameters of the target detection teacher module according to the updated model parameters, which can refer to the following formula:
[0198] ξ t+1 =mξ t +(1-m)g t (20)
[0199] Among them, g t It is used to represent the model parameters in the second encoding submodule in the target detection student module after parameter update. m is used to represent the momentum coefficient, which is a preset value. t It is used to represent the model parameters in the first encoding submodule in the target detection teacher module before parameter update, ξ t+1 Used to represent the model parameters in the first encoding submodule after parameter update.
[0200] It should be emphasized that the target detection teacher module can be used for reasoning, but cannot be used for independent model training. The parameter update of the first encoding submodule in the target detection teacher module depends on the drive of the second encoding submodule.
[0201] In addition, during specific implementation, the number of iterations of model training can be preset to a preset number of iterations T, each iteration corresponds to a batch of samples, and the batch size is B. B can be a natural number greater than 1. T can be a natural number greater than 1.
[0202] In the first round of iterations, the initial value of the number of iterations can be set to 0. When the number of iterations of the model training reaches T-1, it can be determined that the model training is completed, and the first target detection model after training is obtained.
[0203] Step S106, constructing a target detection model based on the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model.
[0204] According to the trained first target detection model, the target detection model is constructed, and the target detection student module and the feature fusion module are removed from the trained first target detection model, and only the target detection teacher module is retained to obtain the target detection model.
[0205] The target detection teacher module cannot be trained independently, and its parameter update depends on the joint work of the target detection student module and the feature fusion module. However, after the model training is completed, only the target detection teacher module is needed to achieve the purpose of target detection in the image.
[0206] The target detection model may include a target detection teacher module in a trained first target detection model, specifically, may include a first encoding submodule, a first classification submodule, and a first regression submodule.
[0207] The difference between the target detection teacher module included in the target detection model and the target detection teacher module in the first target detection model may include:
[0208] (1) In the target detection model, the first processing submodule is not included, and only the first encoding submodule, the first classification submodule and the first regression submodule are included.
[0209] (2) The input data of the target detection model is the image data that needs to be detected, and the input data of the first encoding submodule is the image data that needs to be detected. The input data of the target detection teacher module in the first target detection model is an image sample set, which includes annotated image data and unannotated image data, and the input data of the first encoding submodule is the output data of the first processing submodule, which can be the third image data obtained by sampling and weakly enhancing the image sample set.
[0210] In the target detection model, the first encoding submodule is used to perform encoding processing on the image data for target detection and generate a corresponding first encoding result; the first classification submodule is used to perform classification prediction processing on the first encoding result and generate a classification prediction result; the first regression submodule is used to perform regression prediction processing on the first encoding result and generate a bounding box prediction result. The classification prediction result and the bounding box prediction result together constitute the target detection result of the image data for which target detection is required.
[0211] This embodiment aims at the target detection problem with a small amount of labeled data, a large amount of labeled data, and category imbalance. It can better solve the semi-supervised target detection training with category imbalance, and the semi-supervised training can ensure the training efficiency while reducing the cost of manual labeling. In addition, this embodiment generates debiased pseudo-labels with category imbalance data without knowing the category distribution of unlabeled data, while ensuring the performance of various semi-supervised target detection algorithms.
[0212] In such Figure 1In the embodiment shown, first, an image sample set is obtained; the image sample set includes labeled image samples and unlabeled image samples; then, the image sample set is input into the first target detection model to be trained for training to obtain the trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module; the target detection student module is used to perform prediction processing based on the image sample set to obtain a target detection prediction result; the target detection teacher module is used to perform encoding processing based on the image sample set to generate a first encoding result; based on the first encoding result, a corresponding target detection pseudo-label is generated; the feature fusion module is used to generate a fusion feature based on the first encoding result, the labeled image samples and the unlabeled image samples; the model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo-label and the fusion feature; the target detection student module is also used to update the parameters of the target detection teacher module based on the updated model parameters; finally, based on the trained first target detection model, a target detection model is constructed; target The detection model includes a target detection teacher module in the trained first target detection model, so that the model can be trained in a semi-supervised target detection scenario in combination with labeled image samples and unlabeled image samples. During the training process, the target detection student module is used to perform prediction processing to obtain a target detection prediction result, and the target detection teacher module is used to perform encoding processing to obtain a first encoding result. According to the first encoding result, a target detection pseudo label is generated, and the labeled image sample and the unlabeled image sample are fused by the feature fusion module. Then, the target detection prediction result, the target detection pseudo label and the fusion feature can be used to drive the target detection student module to update the parameters, and the target detection student module after the parameter update is used to drive the target detection teacher module parameter update, so that the unlabeled image data is fully utilized in the model training process to reduce the workload of manual annotation, and the labeled image data is used to guide the model learning, so that the target detection model constructed based on the trained first target detection model outputs a prediction result closer to the real distribution when it is put into use, thereby improving the prediction accuracy of the target detection. For the same technical concept as the aforementioned method embodiment, the embodiment of the present application also provides an embodiment of another target detection method. Figure 2 A processing flow chart of another method for constructing a target detection model provided in an embodiment of the present application. Figure 2 ,The processing flow of the target detection model construction method is as follows:
[0213] The labeled image data 201 is subjected to class-balanced sampling and weak enhancement processing, and is input into the Teacher model 203 for encoding processing to obtain a first encoding result corresponding to the labeled image data 201; and the unlabeled image data 202 is randomly sampled and weakly enhanced, and is input into the Teacher model 203 for encoding processing to obtain a first encoding result corresponding to the unlabeled image data 202.
[0214] Teacher model203 consists of two parts: RPN and ROI head.
[0215] The unlabeled image data 202 is randomly sampled and strongly enhanced, and is input into the Student model 204 for encoding to obtain a second encoding result corresponding to the unlabeled image data 202. Also, the labeled image data 201 is randomly sampled and strongly enhanced, and is input into the Student model 204 for encoding to obtain a second encoding result corresponding to the labeled image data 201.
[0216] Student model204 consists of two parts: RPN and ROI head.
[0217] Teacher model 203 outputs the first encoding result to a fully connected layer, which is respectively connected to two different fully connected layers, one connected to classifier 206, and the other connected to bounding box regression submodule 207. Classifier 206 is used to perform classification prediction processing according to the first encoding result to generate corresponding linear pseudo labels. Classifier 206 can refer to the first classification submodule in the aforementioned method embodiment, and the linear pseudo label can refer to the classification pseudo label in the aforementioned method embodiment.
[0218] The bounding box regression submodule 207 is used to perform regression prediction processing according to the first encoding result to generate a corresponding bounding box pseudo label. The bounding box regression submodule 207 can refer to the first regression submodule in the above method embodiment.
[0219] Student model 204 outputs the second encoding result to a fully connected layer, which is respectively connected to two different fully connected layers, one connected to the classifier 208 and the other connected to the bounding box regression submodule 209.
[0220] The classifier 208 is used to perform classification prediction processing according to the second encoding result to generate a corresponding linear classification prediction. The classifier 208 can refer to the second classification submodule in the aforementioned method embodiment. The linear classification prediction can refer to the classification prediction result obtained by the second classification submodule in the aforementioned method embodiment performing classification prediction processing according to the second encoding result.
[0221] The bounding box regression submodule 209 is used to perform regression prediction processing according to the second encoding result to generate a corresponding bounding box prediction. The bounding box regression submodule 209 can refer to the second regression submodule in the aforementioned method embodiment. The bounding box prediction can refer to the bounding box prediction result obtained by the second regression submodule in the aforementioned method embodiment performing regression prediction processing according to the second encoding result.
[0222] The Teacher model 203 outputs the first encoding result, the annotated image data 201, and the unannotated image data 202 to the feature fusion module, which is used to perform feature fusion processing according to the first encoding result, the annotated image data 201, and the unannotated image data 202 to generate fusion features. The feature fusion module transmits the fusion features to the fully connected layer, which is connected to the feature fusion classifier 205. The feature fusion classifier 205 is used to perform category prediction processing according to the fusion features to obtain a category prediction result. The category prediction result can be used to generate a feature fusion classification loss in combination with the category label in the annotated image data 201, and the feature fusion classification loss can be used to drive the update of the parameters of the Student model 204.
[0223] The linear pseudo-label output by the classifier 206 and the linear classification prediction output by the classifier 208 can be used to generate an unsupervised classification loss, which can be used to drive the update of the parameters of the Student model 204.
[0224] The bounding box pseudo-label output by the bounding box regression submodule 207 and the bounding box prediction output by the bounding box regression submodule 209 can be used to generate an unsupervised regression loss, which can be used to drive the update of the parameters of the Student model 204.
[0225] The linear classification prediction output by the classifier 208 and the bounding box prediction output by the bounding box regression submodule 209 and the ground truth label can be used to generate supervised classification and regression loss, which can be used to drive the update of the parameters of the student model 204. Ground-truth refers to the accurate setting value of the training set for the classification result in supervised learning, which is generally used for error estimation and effect evaluation. The ground truth label can include the category label in the annotated image data 201.
[0226] The Student model 204 after parameter update can be used to drive the update of the Teacher model 203 parameters through EMA.
[0227] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts may refer to the corresponding description of the method embodiment provided above.
[0228] Based on the same technical concept as the aforementioned method embodiment, the embodiment of the present application also provides an embodiment of a target detection method.
[0229] Figure 3 A processing flow chart of a target detection method provided in an embodiment of the present application. Figure 3 The target detection method can be executed by an electronic device, which can be a terminal device, such as a mobile phone, a laptop computer, an intelligent interactive device, etc.; or, the electronic device can also be a server, such as an independent physical server, a server cluster, or a cloud server capable of cloud computing. Figure 3 The target detection method provided in this embodiment specifically includes steps S302 to S304.
[0230] Step S302, obtaining a target image to be detected.
[0231] Step S304, input the target image into the target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by the target detection model construction method.
[0232] The method for constructing the target detection model in this step may be the method for constructing the target detection model provided in the aforementioned method embodiment.
[0233] In such Figure 3 In the embodiment shown, first, a target image to be detected is obtained; then, the target image is input into a target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by a target detection model construction method. In this way, in a semi-supervised target detection scenario, model training can be performed in combination with labeled image samples and unlabeled image samples. During the training process, prediction processing is performed through a target detection student module to obtain a target detection prediction result, encoding processing is performed through a target detection teacher module to obtain a first encoding result, and a target detection pseudo label is generated according to the first encoding result. The labeled image sample and the unlabeled image sample are fused through a feature fusion module. Then, the target detection prediction result, the target detection pseudo label and the fused feature can be used to drive the update of the target detection teacher module parameters, so that the unlabeled image data is fully utilized in the model training process to reduce the workload of manual annotation, and the labeled image data is used to guide the model learning, so that the target detection model constructed based on the trained first target detection model outputs a prediction result closer to the real distribution when it is put into use.
[0234] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts may refer to the corresponding description of the method embodiment provided above.
[0235] The target detection method provided by this embodiment is further described below by taking the application of a target detection method provided by this embodiment in an object tracking scenario as an example.
[0236] First, the video data to be processed is obtained, which may include multiple frames of images arranged in sequence according to the image acquisition time sequence.
[0237] Next, each frame of the image is input into the target detection model for target detection processing to obtain the corresponding target detection result; the target detection model is constructed by the target detection model construction method.
[0238] The target detection result corresponding to each frame of image can be used to represent the category prediction result and bounding box prediction result of at least one object in the frame of image.
[0239] The bounding box prediction result can reflect the location information of the object in the image.
[0240] The method for constructing a target detection model may be the method for constructing a target detection model provided in the aforementioned method embodiment.
[0241] Then, according to the target detection result corresponding to each frame of image, the target object to be tracked in the frame of image is determined, and the bounding box prediction result of the target object in the frame of image is determined.
[0242] Take the first frame image as an example for explanation. For example, the first frame image includes category prediction results of 3 objects and bounding box prediction results. According to the category prediction results of the 3 objects, determine whether there is at least one object among the 3 objects whose category prediction result is the same as the category of the target object to be tracked. If so, determine the object as the target object, and determine the bounding box prediction result of the object as the bounding box prediction result of the target object.
[0243] Finally, according to the bounding box prediction result of the target object in each frame image, the object tracking information of the target object in the video data to be processed is determined.
[0244] Each frame of the video data to be processed is arranged in sequence according to the image acquisition time sequence, and the bounding box prediction result of the target object in each frame of the image can reflect the position information of the target object in the frame of the image. Therefore, the position information of the target object in multiple frames of images arranged in sequence according to the image acquisition time sequence can constitute the object tracking information corresponding to the target object.
[0245] Target detection is performed on each frame of the video data through the target detection model. When the prediction accuracy of the target detection model is high, the position information of the target object to be tracked in each frame of the video data obtained by the target detection model is relatively accurate, so that more accurate object tracking information can be determined.
[0246] In addition, target detection methods can also be applied to image segmentation scenarios, key point detection scenarios, and so on.
[0247] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts may refer to the corresponding description of the method embodiment provided above.
[0248] Based on the same technical concept as the aforementioned method embodiment, the embodiment of the present application also provides another embodiment of a target detection method.
[0249] Figure 4 A processing flow chart of a target detection method provided in an embodiment of the present application. Figure 4 ,The processing flow of the target detection method is as follows:
[0250] The inference image data 401 is the target image to be detected. The inference image data 401 is weakly enhanced and input into the Teacher model 402 for encoding to obtain the corresponding first encoding result. The first encoding result passes through two series-connected fully connected layers to reach the feature fusion classification 403. The feature fusion classification 403 is used to perform classification prediction processing on the first encoding result to obtain classification information of the inference image data 401. The first encoding result passes through two series-connected fully connected layers to reach the bounding box regression 404, and the bounding box regression 404 is used to perform regression prediction processing on the first encoding result to obtain the bounding box information of the inference image data 401.
[0251] Figure 4 In the embodiment, the Teacher model 402, three fully connected layers, feature fusion classification 403 and bounding box regression 404 can together constitute a target detection model, which can be constructed by the target detection model construction method provided in the aforementioned target detection model construction method embodiment. The data processing flow of the target detection model can refer to the aforementioned target detection method embodiment.
[0252] Exemplarily, Teacher model 402 may be a Faster RCNN (region proposals-CNN) model with FPN (Feature Pyramid Networks).
[0253] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above. In the above embodiment, a method for constructing a target detection model is provided. Correspondingly, based on the same technical concept, the embodiment of the present application also provides a device for constructing a target detection model, which is described below in conjunction with the accompanying drawings.
[0254] Figure 5 A schematic diagram of a device for constructing a target detection model provided in an embodiment of the present application.
[0255] This embodiment provides a device 500 for constructing a target detection model, including:
[0256] A first acquisition unit 502 is used to acquire an image sample set; the image sample set includes annotated image samples and unannotated image samples;
[0257] The training unit 504 is used to input the image sample set into the first target detection model to be trained for training, so as to obtain the trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module; the target detection student module is used to perform prediction processing according to the image sample set to obtain a target detection prediction result; the target detection teacher module is used to perform encoding processing according to the image sample set to generate a first encoding result; according to the first encoding result, a corresponding target detection pseudo label is generated; the feature fusion module is used to generate a fusion feature according to the first encoding result, the labeled image sample and the unlabeled image sample; the model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo label and the fusion feature; the target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters;
[0258] The construction unit 506 is used to construct a target detection model based on the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model.
[0259] Optionally, the target detection teacher module includes a first processing submodule, a first encoding submodule, a first classification submodule, and a first regression submodule: the target detection pseudo-label includes a classification pseudo-label and a bounding box pseudo-label;
[0260] The first processing submodule is used to generate a third image sample corresponding to the pattern sample set according to each image sample in the image sample set;
[0261] The first encoding submodule is used for performing encoding processing according to the third image sample to generate the first encoding result;
[0262] The first classification submodule is used to perform classification prediction processing according to the first encoding result to generate the classification pseudo label;
[0263] The first regression submodule is used to perform regression prediction processing according to the first encoding result to generate the bounding box pseudo label.
[0264] Optionally, the first processing submodule is specifically used to:
[0265] If the image sample is the labeled image sample, performing class-balanced sampling processing on the image sample to obtain a first image sample corresponding to the image sample;
[0266] If the image sample is the unlabeled image sample, performing random sampling processing on the image sample to obtain a second image sample corresponding to the image sample;
[0267] Weak enhancement processing is performed on the first image sample and the second image sample respectively to obtain the third image sample corresponding to the image sample set.
[0268] Optionally, the target detection student module includes a second processing submodule, a second encoding submodule, a second classification submodule and a second regression submodule: the target detection prediction result includes a classification prediction result and a bounding box prediction result;
[0269] The second processing submodule is used to generate a fourth image sample corresponding to the image sample set according to each image sample in the image sample set;
[0270] The second encoding submodule is used to perform encoding processing according to the fourth image sample to generate a second encoding result;
[0271] The second classification submodule is used to perform classification prediction processing according to the second encoding result to obtain the classification prediction result;
[0272] The second regression submodule is used to perform regression prediction processing according to the second encoding result to obtain the bounding box prediction result.
[0273] Optionally, the second processing submodule is specifically configured to:
[0274] If the image sample is the labeled image sample, performing random sampling processing on the image sample to obtain a fourth image sample corresponding to the image sample;
[0275] If the image sample is the unlabeled image sample, performing random sampling processing on the image sample to obtain a fifth image sample corresponding to the image sample;
[0276] Perform strong enhancement processing on the fifth image sample to obtain a fourth image sample corresponding to the image sample.
[0277] Optionally, the annotated image sample includes first image data and label data; the label data includes at least one of N preset categories; the unannotated image sample includes second image data; the feature fusion module is specifically used to:
[0278] Performing statistical processing on the label data to obtain statistical results of the number of samples corresponding to each of the preset categories;
[0279] Determine the feature fusion probability corresponding to each of the preset categories according to the statistical results;
[0280] Uniformly sample the preset value interval to obtain the target sampling value;
[0281] The fusion feature is generated according to a comparison result between the target sampling value and the feature fusion probability, the first encoding result, the annotated image sample and the unannotated image sample.
[0282] Optionally, the feature fusion module is further specifically used for:
[0283] According to the statistical results, the preset category with the largest number of samples is determined as the target preset category;
[0284] According to the number of samples corresponding to each of the preset categories and the target number of samples corresponding to the target preset category, the feature fusion probability corresponding to each of the preset categories is determined.
[0285] Optionally, the feature fusion module is further specifically used for:
[0286] If the size comparison result is used to represent that the target sampling value is less than the feature fusion probability, generating the fusion feature according to a preset fusion factor, a first encoding result corresponding to the first image data, a first encoding result corresponding to the second image data, and the label data;
[0287] If the size comparison result is used to characterize that the target sampling value is greater than or equal to the feature fusion probability, the fusion feature is generated according to the preset fusion factor, the first encoding result corresponding to the first image data, and the label data.
[0288] The target detection model construction device provided in the embodiment of the present application includes a first acquisition unit, a training unit and a construction unit, the first acquisition unit is used to acquire an image sample set; the image sample set includes labeled image samples and unlabeled image samples; the training unit is used to input the image sample set into the first target detection model to be trained for training to obtain the trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module; the target detection student module is used to perform prediction processing according to the image sample set to obtain a target detection prediction result; the target detection teacher module is used to perform encoding processing according to the image sample set to generate a first encoding result; according to the first encoding result, a corresponding target detection pseudo label is generated; the feature fusion module is used to generate a fusion feature according to the first encoding result, the labeled image samples and the unlabeled image samples; the model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo label and the fusion feature; the target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters; the construction unit is used to construct the target detection model according to the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model. In this way, in a semi-supervised target detection scenario, model training can be performed in combination with labeled image samples and unlabeled image samples. During the training process, prediction processing is performed through the target detection student module to obtain a target detection prediction result, and encoding processing is performed through the target detection teacher module to obtain a first encoding result. According to the first encoding result, a target detection pseudo label is generated, and the labeled image samples and the unlabeled image samples are fused through the feature fusion module. Then, the target detection prediction result, the target detection pseudo label and the fused feature can be used to drive the target detection student module to update the parameters, and the target detection student module after the parameter update can be used to drive the target detection teacher module parameter update, so that the model training process can fully utilize the unlabeled image data to reduce the workload of manual annotation, and the labeled image data can be used to guide model learning, so that the target detection model constructed based on the trained first target detection model outputs a prediction result closer to the real distribution when it is put into use, thereby improving the accuracy of target detection prediction.
[0289] In the above-mentioned embodiment, a target detection method is provided. Correspondingly, based on the same technical concept, an embodiment of the present application also provides a target detection device, which is described below in conjunction with the accompanying drawings.
[0290] Figure 6 A schematic diagram of a target detection device provided in an embodiment of the present application.
[0291] This embodiment provides a target detection device 600, including:
[0292] The second acquisition unit 602 is used to acquire the target image to be detected;
[0293] The detection unit 604 is used to input the target image into the target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by the target detection model construction method.
[0294] The target detection device provided in the embodiment of the present application includes a second acquisition unit and a detection unit. The second acquisition unit is used to acquire a target image to be detected; the detection unit is used to input the target image into a target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by a target detection model construction method. In this way, in a semi-supervised target detection scenario, model training can be performed in combination with labeled image samples and unlabeled image samples. During the training process, prediction processing is performed through the target detection student module to obtain a target detection prediction result, and encoding processing is performed through the target detection teacher module to obtain a first encoding result. According to the first encoding result, a target detection pseudo label is generated, and the labeled image samples and the unlabeled image samples are fused through the feature fusion module. Then, the target detection prediction result, the target detection pseudo label and the fused feature can be used to drive the target detection student module to update the parameters, and the target detection student module after the parameter update can be used to drive the target detection teacher module parameter update, so that the model training process can fully utilize the unlabeled image data to reduce the workload of manual annotation, and use the labeled image data to guide model learning, so that the target detection model constructed based on the trained first target detection model outputs a prediction result that is closer to the real distribution when it is put into use, thereby improving the prediction accuracy of target detection.
[0295] Corresponding to the method for constructing a target detection model described above, or, corresponding to the method for constructing a target detection model described above, based on the same technical concept, an embodiment of the present application further provides an electronic device, which is used to execute the method for constructing a target detection model provided above, or, the method for constructing a target detection model provided above, Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0296] like Figure 7As shown, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 701 and memory 702, and the memory 702 may store one or more storage applications or data. Among them, the memory 702 may be a temporary storage or a permanent storage. The application stored in the memory 702 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 701 may be configured to communicate with the memory 702 to execute a series of computer executable instructions in the memory 702 on the electronic device. The electronic device may also include one or more power supplies 703, one or more wired or wireless network interfaces 704, one or more input / output interfaces 705, one or more keyboards 706, etc.
[0297] 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:
[0298] Acquire an image sample set; the image sample set includes annotated image samples and unannotated image samples;
[0299] Inputting the image sample set into a first target detection model to be trained to obtain a trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module and a feature fusion module;
[0300] The target detection student module is used to perform prediction processing according to the image sample set to obtain a target detection prediction result;
[0301] The target detection teacher module is used to perform encoding processing according to the image sample set to generate a first encoding result; and generate a corresponding target detection pseudo label according to the first encoding result;
[0302] The feature fusion module is used to generate a fusion feature according to the first encoding result, the annotated image sample and the unannotated image sample;
[0303] The model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo label and the fusion feature;
[0304] The target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters; construct a target detection model according to the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model.
[0305] 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:
[0306] Acquire the target image to be detected;
[0307] The target image is input into a target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by a target detection model construction method.
[0308] An embodiment of a computer-readable storage medium provided in this specification is as follows:
[0309] Corresponding to the method for constructing a target detection model described above, based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium.
[0310] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented:
[0311] Acquire an image sample set; the image sample set includes annotated image samples and unannotated image samples;
[0312] Inputting the image sample set into a first target detection model to be trained to obtain a trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module and a feature fusion module;
[0313] The target detection student module is used to perform prediction processing according to the image sample set to obtain a target detection prediction result;
[0314] The target detection teacher module is used to perform encoding processing according to the image sample set to generate a first encoding result; and generate a corresponding target detection pseudo label according to the first encoding result;
[0315] The feature fusion module is used to generate a fusion feature according to the first encoding result, the annotated image sample and the unannotated image sample;
[0316] The model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo label and the fusion feature;
[0317] The target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters;
[0318] A target detection model is constructed based on the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model.
[0319] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the method for constructing a target detection model in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding method mentioned above, and the repeated parts will not be repeated.
[0320] Corresponding to the target detection method described above, based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium.
[0321] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented:
[0322] Acquire the target image to be detected;
[0323] The target image is input into a target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by a target detection model construction method.
[0324] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the target detection method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the aforementioned corresponding method, and the repeated parts will not be repeated.
[0325] The above is a description of a specific embodiment of the specification. 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 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.
[0326] 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 a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification 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 code.
[0327] This specification 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 this specification. 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 device to generate a machine, so that the instructions executed by the processor of the computer or other programmable 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.
[0328] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0329] These computer program instructions may also be loaded onto a computer or other programmable device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0330] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0331] The memory may include non-permanent storage 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. The memory is an example of a computer-readable medium.
[0332] 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, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact 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 that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0333] 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.
[0334] Embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, data, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0335] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the 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.
[0336] 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 method for constructing a target detection model, characterized in that: include: Get a sample set of images; The image sample set includes labeled image samples and unlabeled image samples; Inputting the image sample set into a first target detection model to be trained to obtain a trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module; The target detection student module is used to perform prediction processing according to the image sample set to obtain a target detection prediction result; The target detection teacher module is used to perform encoding processing according to the image sample set to generate a first encoding result; and generate a corresponding target detection pseudo label according to the first encoding result; The feature fusion module is used to generate a fusion feature according to the first encoding result, the annotated image sample and the unannotated image sample; The model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo label and the fusion feature; The target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters; A target detection model is constructed based on the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model.
2. The method according to claim 1, characterized in that: The target detection teacher module includes a first processing submodule, a first encoding submodule, a first classification submodule, and a first regression submodule: the target detection pseudo-label includes a classification pseudo-label and a bounding box pseudo-label; The first processing submodule is used to generate a third image sample corresponding to the pattern sample set according to each image sample in the image sample set; The first encoding submodule is used for performing encoding processing according to the third image sample to generate the first encoding result; The first classification submodule is used to perform classification prediction processing according to the first encoding result to generate the classification pseudo label; The first regression submodule is used to perform regression prediction processing according to the first encoding result to generate the bounding box pseudo label.
3. The method according to claim 2, characterized in that The step of generating a third image sample corresponding to the image sample set according to each image sample in the image sample set includes: If the image sample is the labeled image sample, performing class-balanced sampling processing on the image sample to obtain a first image sample corresponding to the image sample; If the image sample is the unlabeled image sample, performing random sampling processing on the image sample to obtain a second image sample corresponding to the image sample; Weak enhancement processing is performed on the first image sample and the second image sample respectively to obtain the third image sample corresponding to the image sample set.
4. The method according to claim 1, characterized in that: The target detection student module includes a second processing submodule, a second encoding submodule, a second classification submodule and a second regression submodule: the target detection prediction result includes a classification prediction result and a bounding box prediction result; The second processing submodule is used to generate a fourth image sample corresponding to the image sample set according to each image sample in the image sample set; The second encoding submodule is used to perform encoding processing according to the fourth image sample to generate a second encoding result; The second classification submodule is used to perform classification prediction processing according to the second encoding result to obtain the classification prediction result; The second regression submodule is used to perform regression prediction processing according to the second encoding result to obtain the bounding box prediction result.
5. The method according to claim 4, characterized in that The step of generating, according to each image sample in the image sample set, a fourth image sample corresponding to the image sample set, comprises: If the image sample is the labeled image sample, performing random sampling processing on the image sample to obtain a fourth image sample corresponding to the image sample; If the image sample is the unlabeled image sample, performing random sampling processing on the image sample to obtain a fifth image sample corresponding to the image sample; Perform strong enhancement processing on the fifth image sample to obtain a fourth image sample corresponding to the image sample.
6. The method according to claim 1, characterized in that The annotated image sample includes first image data and label data; the label data includes at least one of N preset categories; the unannotated image sample includes second image data; and generating a fusion feature according to the first encoding result, the annotated image sample and the unannotated image sample includes: Performing statistical processing on the label data to obtain statistical results of the number of samples corresponding to each of the preset categories; Determine the feature fusion probability corresponding to each of the preset categories according to the statistical results; Uniformly sample the preset value interval to obtain the target sampling value; The fusion feature is generated according to a comparison result between the target sampling value and the feature fusion probability, the first encoding result, the annotated image sample and the unannotated image sample.
7. The method according to claim 6, characterized in that Determining the feature fusion probability corresponding to each preset category according to the statistical result includes: According to the statistical results, the preset category with the largest number of samples is determined as the target preset category; According to the number of samples corresponding to each of the preset categories and the target number of samples corresponding to the target preset category, the feature fusion probability corresponding to each of the preset categories is determined.
8. The method according to claim 6, characterized in that The generating the fusion feature according to the comparison result between the target sampling value and the feature fusion probability, the first encoding result, the annotated image sample and the unannotated image sample comprises: If the size comparison result is used to represent that the target sampling value is less than the feature fusion probability, generating the fusion feature according to a preset fusion factor, a first encoding result corresponding to the first image data, a first encoding result corresponding to the second image data, and the label data; If the size comparison result is used to characterize that the target sampling value is greater than or equal to the feature fusion probability, the fusion feature is generated according to the preset fusion factor, the first encoding result corresponding to the first image data, and the label data.
9. A target detection method, characterized in that: include: Acquire the target image to be detected; Inputting the target image into a target detection model for target detection processing to obtain a corresponding target detection result; The target detection model is constructed by the target detection model construction method as described in any one of claims 1 to 8.
10. A device for constructing a target detection model, characterized in that: The device comprises: A first acquisition unit is used to acquire an image sample set; the image sample set includes annotated image samples and unannotated image samples; A training unit, used for inputting the image sample set into a first target detection model to be trained to obtain a trained first target detection model; the first target detection model to be trained includes a target detection student module, a target detection teacher module, and a feature fusion module; The target detection student module is used to perform prediction processing according to the image sample set to obtain a target detection prediction result; The target detection teacher module is used to perform encoding processing according to the image sample set to generate a first encoding result; and generate a corresponding target detection pseudo label according to the first encoding result; The feature fusion module is used to generate a fusion feature according to the first encoding result, the annotated image sample and the unannotated image sample; The model parameters of the target detection student module are updated based on the target detection prediction result, the target detection pseudo label and the fusion feature; The target detection student module is also used to update the parameters of the target detection teacher module according to the updated model parameters; A construction unit is used to construct a target detection model based on the trained first target detection model; the target detection model includes the target detection teacher module in the trained first target detection model.
11. A target detection device, characterized in that: The device comprises: A second acquisition unit, used to acquire a target image to be detected; A detection unit is used to input the target image into a target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed by the target detection model construction method as described in any one of claims 1 to 8.
12. An electronic device, characterized in that: The device comprises: A processor; and a memory configured to store computer executable instructions, which, when executed, cause the processor to execute the method for constructing a target detection model as described in any one of claims 1 to 8, or the target detection method as described in claim 9.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer-executable instructions, which, when executed by a processor, implement the method for constructing a target detection model as described in any one of claims 1 to 8, or the target detection method as described in claim 9.
Citation Information
Patent Citations
Semantic segmentation model training method and device, semantic segmentation method and device and medium
CN114708436A
Image semantic segmentation model construction method and device, image processing method and device, electronic equipment and medium
CN115393599A
RGB image semi-supervised target detection method based on double-pseudo-label optimization learning
CN115393687A
Training method and device of image recognition model and electronic equipment
CN115661615A
Methods and apparatuses for building image semantic segmentation model and image processing, electronic device, and medium
WO2022242352A1
