Object detection model construction method, apparatus, electronic device and storage medium
By combining the feature fusion of labeled and unlabeled data in the target detection model, the problem of category imbalance in semi-supervised target detection is solved, the detection accuracy and training efficiency are improved, and the output results are closer to the real distribution.
Patent Information
- Application Number
- PCT/CN2023/142050
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-10
- Filing Date
- 2023-12-26
- Publication Date
- 2024-09-19
AI Technical Summary
In the field of deep learning, especially in semi-supervised target detection scenarios, the problem of class imbalance causes the target detection model to have better detection results for categories with a larger number of samples, and poorer detection results for categories with a smaller number of samples, which in turn affects Object detection accuracy.
A method of constructing a target detection model is proposed. By obtaining an image sample set, including labeled image samples and unlabeled image samples, the target detection student module and teacher module are used for prediction and coding processing, generating pseudo labels and fusion features, and updating the model. parameters, combine labeled and unlabeled data for feature fusion, and achieve end-to-end class-imbalanced semi-supervised target detection training.
It improves the accuracy of target detection, reduces the workload of manual annotation, uses unlabeled data to enhance model training, and the output prediction results are closer to the real distribution, solving the detection deviation under the problem of category imbalance.
Smart Images

Figure CN2023142050_19092024_PF_FP_ABST
Abstract
Description
Method, device, electronic device and storage medium for constructing target detection model
[0001] Cross-references
[0002] The present invention claims priority to Chinese patent application No. 2023102343819 filed with the Patent Office of China on March 10, 2023, entitled “Method, device, electronic device and storage medium for constructing target detection model”. The entire contents of the application are incorporated herein by reference. Technical Field
[0003] 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
[0004] With the development of electronic technology, the application of deep learning is becoming increasingly widespread. Unbalanced data distribution is very common and poses a significant challenge to object classification in the field of deep learning. In practical applications, the number of samples directly affects the training performance of object detection models. This is especially true when the number of samples in different categories varies significantly, i.e., when there is class imbalance. This can result in the object detection model performing better for categories with a larger number of samples and worse for categories with a smaller number of samples. In semi-supervised object detection scenarios, class imbalance is likely to increase prediction bias, and therefore, the accuracy of object detection needs to be improved.
[0005] Summary of the Invention
[0006] 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.
[0007] On the one hand, an embodiment of the present application provides a method for constructing a target detection model, including: obtaining an image sample set; 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 for training 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 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; based on the trained first target detection model, a target detection model is constructed; the target detection model includes the target detection teacher module in the trained first target detection model.
[0008] On the one hand, an embodiment of the present application provides a target detection method, including: obtaining a 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 above.
[0009] On the one hand, an embodiment of the present application provides a device for constructing a target detection model, comprising: a first acquisition unit for acquiring an image sample set; the image sample set comprises labeled image samples and unlabeled image samples; a training unit 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 comprises 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. encoding result; generating 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 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; a construction unit is used to 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.
[0010] On the one hand, an embodiment of the present application provides a target detection device, including: a second acquisition unit, used to acquire a target image to be detected; a detection unit, 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 above.
[0011] On the one hand, an embodiment of the present application provides an electronic device comprising: a processor; and a memory configured to store computer-executable instructions, which, when executed, cause the processor to execute a method for constructing a target detection model as described above, or a target detection method as described above.
[0012] On the one hand, 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 above, or the target detection method as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments described in this specification. Those skilled in the art can also derive other drawings based on these drawings without inventive work.
[0014] FIG1 is a process flow chart of a method for constructing a target detection model provided in an embodiment of the present application;
[0015] FIG2 is a process flow chart of another method for constructing an object detection model provided in an embodiment of the present application;
[0016] FIG3 is a processing flow chart of a target detection method provided in an embodiment of the present application;
[0017] FIG4 is a processing flow chart of another target detection method provided in an embodiment of the present application;
[0018] FIG5 is a schematic diagram of a device for constructing a target detection model provided in an embodiment of the present application;
[0019] FIG6 is a schematic diagram of a target detection device provided in an embodiment of the present application;
[0020] FIG7 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] 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 making creative efforts should fall within the scope of protection of this application.
[0022] 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 and makes the accuracy of target detection need to be improved. In order to solve the above problems, the embodiment of the present application provides a method for constructing a target detection model.
[0023] FIG1 is a process flow chart of a method for constructing a target detection model provided in an embodiment of the present application. The method for constructing a target detection model in FIG1 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. Alternatively, 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. Referring to FIG1 , the method for constructing a target detection model provided in this embodiment specifically includes steps S102 to S106.
[0024] Step S102: Acquire an image sample set; the image sample set includes labeled image samples and unlabeled image samples.
[0025] Computer vision is the study of how machines can "see." Specifically, it refers to the use of cameras and computers to replace the human eye in identifying, tracking, and measuring objects. Further image processing is performed to transform the computer into images more suitable for human observation or transmission to instrumentation. As a scientific discipline, computer vision studies related theories and technologies, aiming to build artificial intelligence systems capable of extracting "information" from images or multidimensional data. This information refers to information that can be used to assist in making a decision, as defined by Shannon. Because perception can be viewed as extracting information from sensory signals, computer vision can also be viewed as the study of how artificial systems can "perceive" from images or multidimensional data.
[0026] Object detection is a fundamental task in computer vision. It involves identifying the location and category of objects in an image. The image used for object detection can contain one or more objects, referred to as the target to be detected.
[0027] Target detection requires predicting both the category and location of the target. The location of the target can be represented by a bounding box.
[0028] For example, the bounding box can be a rectangular box that just contains the object to be detected, and can be determined by the x- and y-axis coordinates of the upper left corner and the x- and y-axis coordinates of the lower right corner of the rectangle. The origin of the image coordinates can be set at the upper left corner, with the x-axis pointing rightward and the y-axis pointing downward.
[0029] The image sample set may include one or more labeled image samples and may also include one or more unlabeled image samples.
[0030] The labeled image sample may be an image sample carrying label data. The label data may include the category label of the target to be detected and the bounding box label of the target to be detected.
[0031] The category label can be an expression representing the true category of the object to be detected. The true category can be one of a variety of preset object categories. For example, the preset object categories can be "cat," "dog," "person," "streetlight," and so on. The bounding box label can be a true bounding box label that reflects the outer contour of the object to be detected, or it can be a bounding box label of another preset shape that reflects the location and size information of the object to be detected.
[0032] For example, the targets to be detected include dogs and cats, and the image sample can be a photo containing a cat and two dogs. The label data can 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.
[0033] Unlabeled image samples are image samples that do not carry any label data. In unlabeled image samples, 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.
[0034] In the image sample set, the ratio of the number of labeled image samples to the number of unlabeled image samples can be pre-configured.
[0035] 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.
[0036] The labeled image samples can be used with D s Specifically, the following formula can be referred to.
[0037] 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 can be 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 label data Determine. i can be a natural number greater than or equal to 1 and less than or equal to N. Each bounding box encloses a corresponding object to be detected.
[0038] The i-th image sample Carried label data It can be used as the ground-truth (benchmark true value) 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 label 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.
[0039] 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
[0040] 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
[0041] 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 containing a cat and two dogs. Carried label data This could include: Category labels for cats in photos = "Cat" category; bounding box label reflecting the outer contours of the cat in the photo = bounding box label s1; the category label corresponding to the first dog in the photo = "dog" category; bounding box label reflecting the outline of the first dog in the photo = bounding box label s2; the class label for the second dog in the photo =“dog” category; and, a bounding box label reflecting the outline of the second dog in the photo =Bounding box label s3.
[0042] Unlabeled image samples can be used with D u Specifically, the following formula can be referred to.
[0043] 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 objects to be detected, but since the image sample does not carry any label data, the position information and size information of the bounding box used to enclose the objects to be detected, as well as the category information of the objects to be detected in the image sample are unknown.
[0044] 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 with the kth category label corresponding to the unlabeled image samples. k can be a natural number greater than 1. Considering that each image sample in the unlabeled image samples does not carry any label data, the category label corresponding to the image sample in the unlabeled image samples 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.
[0045] For example, let's say the total number of class labels K = 3, representing the first, second, and third class labels. Let's assume k = 2, meaning k corresponds to the second class label. Let's assume the total number of annotated image samples N = 10, where N2 represents the number of image samples with the second class label. Let's assume N2 = 4, meaning there are 10 annotated image samples, 4 of which have the second class label.
[0046] For another example, let's assume the total number of category labels K = 2, one for the first category label and one for the second category label. Let k = 1, meaning k corresponds to the first category label. Let's assume the total number of unlabeled image samples M = 5, where M1 can be used to represent the number of image samples in the unlabeled image samples that correspond to the first category label. Let's assume M1 = 3, meaning there are 5 unlabeled image samples, 3 of which correspond to the first category label.
[0047] In the case where each image sample corresponds to only one category label, N k and M k Satisfies the following formula.
[0048] N is used to represent the total number of labeled image samples and can be a natural number greater than 1. K is used to represent the total number of class labels and can be a natural number greater than 1. M is used to represent the total number of unlabeled image samples and 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.
[0049] For example, the total number of category labels K = 3, representing the first, second, and third category labels. When k = 1, k corresponds to the first category label; when k = 2, k corresponds to the second category label; and when k = 3, k corresponds to the third category label. The total number of annotated image samples N = 10, where N1 represents the number of image samples with the first category label, N2 represents the number of image samples with the second category label, and N3 represents the number of image samples with the third category label. Assuming that each image sample carries only one category label, assuming N1 = 5, N2 = 4, and N3 = 1, there are 10 annotated image samples, of which 5 carry the first category label, 4 carry the second category label, and 1 carries the third category label. Furthermore, N1 + N2 + N3 = 5 + 4 + 1 = 10 = N.
[0050] 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 and 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.
[0051] In step S104, 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 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 based on the updated model parameters.
[0052] The first object detection model to be trained can be a target detection model whose model parameters are to be trained. This can achieve end-to-end class-imbalanced semi-supervised object detection training by learning two-stage object detection from labeled and unlabeled image samples while simultaneously performing feature fusion. The two-stage object 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.
[0053] 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 based on 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.
[0054] 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.
[0055] In a specific implementation method, based on each image sample in the image sample set, a third image sample corresponding to the image sample set is generated, 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.
[0056] Generating a third image sample corresponding to the image sample set based on each image sample in the image sample set may involve first performing sampling processing on the image sample set and then performing weak enhancement processing to obtain the third image sample corresponding to the image sample set. In the specific implementation of first performing sampling processing on the image sample set, if the image samples are labeled image samples, performing sampling processing on the image sample set may include performing class-balanced sampling processing on the image samples; if the image samples are unlabeled image samples, performing sampling processing on the image sample set may include performing random sampling processing on the image samples.
[0057] Each image sample in the image sample set may be either a labeled image sample or an unlabeled image sample.
[0058] For example, the image sample set includes 20 image samples in total. Specifically, the image sample set may include labeled 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.
[0059] The number of image samples included in the image sample set can be represented by S1, which 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.
[0060] The image sample set is first sampled and then weakly enhanced to obtain a third image sample corresponding to the image sample set. This can be done by: first, sampling S1 image samples is performed to obtain S2 image samples; then, weakly enhancing each of the S2 image samples is performed to obtain S2 weakly enhanced image samples; and 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 third image samples corresponding to the image sample set can be S2. S2 can be a natural number greater than 1. The value of S1 is greater than the value of S2.
[0061] 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 can be a first image sample corresponding to the labeled image sample. Perform class-balanced sampling to obtain first image samples corresponding to the labeled image samples. N represents 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.
[0062] 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, where N'=4.
[0063] In specific implementation, the i-th labeled image sample in the labeled image sample can be used 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, a part of the labeled image samples is removed, and the other part of the labeled image samples is retained. The i-th labeled image sample is retained and can be determined as the first image sample, using express.
[0064] 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.
[0065] Taking into account 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 class label of the labeled image sample D s Perform class-balanced sampling processing.
[0066] In specific implementation, a class-balanced sampler can be used to label the image sample D s Perform class-balanced sampling processing.
[0067] 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. Perform random sampling to obtain a second image sample corresponding to the unlabeled image sample. M represents 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.
[0068] The number of third image samples corresponding to the image sample set is S2=N′+M′.
[0069] 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 Random sampling is performed. After sampling, some unlabeled image samples are removed, and the other part of unlabeled image samples are retained. The i-th unlabeled image sample is retained and can be determined as the second image sample, using express.
[0070] Random sampling means that when taking sub-samples, no human will is imposed on the sampling location and time, so that materials from any part have the opportunity to be sampled.
[0071] In specific implementation, the random sampler can be used to collect the unlabeled image samples D u Perform random sampling.
[0072] The first image sample and the second image sample are weakly enhanced to obtain the third image sample corresponding to the image sample set. This can be achieved by weakly enhancing the N' first image samples and the M' second image samples, and determining the image sample after the weak enhancement as the third image sample.
[0073] In a specific implementation, first, sampling processing 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 processing on a total of N labeled image samples, and also include M' second image samples obtained by random sampling processing on a total of M unlabeled image samples; then, weak enhancement processing 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.
[0074] α() can be used to indicate weak image enhancement.
[0075] Specifically, the weak enhancement method can be standard flipping and translation.
[0076] In another implementation, generating a third image sample corresponding to the image sample set based on each image sample in the image sample set may involve performing sampling processing on the image sample set to obtain the third image sample corresponding to the image sample set. In the specific implementation of sampling processing on the image sample set, if the image samples are labeled image samples, sampling processing on the image sample set may include performing class-balanced sampling processing on the image samples; if the image samples are unlabeled image samples, sampling processing on the image sample set may include performing random sampling processing on the image samples. That is, the first processing submodule may be used only for sampling processing of image samples and not for weak enhancement processing of image samples.
[0077] The first encoding submodule is configured to perform encoding processing based on the third image sample to generate a first encoding result. In a specific implementation, the first encoding submodule can be a feature representor ξ in a teacher model for semi-supervised object detection, a momentum encoder, or other modules with encoding functionality.
[0078] 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.
[0079] The first classification submodule is used to perform classification prediction processing based on 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. For example, the classification pseudo label corresponding to the i-th image sample in the image sample set can be used express.
[0080] The pseudo-label method is a supervised paradigm that learns from both unlabeled 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, which is used for parameter training of the image classification model.
[0081] The first regression submodule is used to perform regression prediction processing based on 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. For example, the bounding box pseudo label corresponding to the i-th image sample in the image sample set can be express.
[0082] 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 based on 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.
[0083] 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.
[0084] In a specific implementation method, based on each image sample in the image sample set, a fourth image sample corresponding to the image sample set is generated, 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.
[0085] Each image sample in the image sample set may be either a labeled image sample or an unlabeled image sample.
[0086] For example, the image sample set includes 20 image samples in total. Specifically, the image sample set may include labeled image samples D s and unlabeled image samples D u , where the labeled image sample Ds 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, which 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] 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. Random sampling is performed to obtain a fourth image sample corresponding to the labeled image sample. N represents 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 fourth image samples corresponding to the labeled image sample can be represented by n. n can be a natural number greater than 1 and less than N.
[0089] For example, the labeled image sample D s The total number N=10, and random sampling is performed on the 10 image samples to obtain n fourth image samples, where n=5.
[0090] In specific implementation, the i-th labeled image sample in the labeled image sample can be used 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 Random sampling is performed. After sampling, a part of the labeled image samples is eliminated, and the other part of the labeled image samples is retained. The i-th labeled image sample is retained and can be determined as the fourth image sample.
[0091] In specific implementation, the random sampler can be used to label the image sample D s Perform random sampling.
[0092] When 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; and strong enhancement is performed on the fifth image sample to obtain a fourth image sample corresponding to the image sample.
[0093] 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 can be the unlabeled image sample. Random sampling 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 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 the fifth image sample corresponding to the unlabeled image sample can be represented by m. m can be a natural number greater than 1 and less than M.
[0094] 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 Random sampling is performed. After sampling, some unlabeled image samples are removed, and the other part of unlabeled image samples are retained. The i-th unlabeled image sample is retained and can be determined as the fifth image sample.
[0095] By performing strong enhancement processing on the fifth image sample, a fourth image sample corresponding to the unlabeled image sample can be obtained.
[0096] 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 of N labeled image samples, and also include m fifth image samples obtained by randomly sampling a total of M unlabeled image samples; a strong enhancement process is performed on the m fifth image samples x′ 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.
[0097] For example, the strong enhancement method adopted by the strong enhancement processing may be cutout enhancement (CutOut), control theory augmentation (Control Theory Augment, CTAugment), random augmentation (RandAugment), and the like.
[0098] The second encoding submodule is configured to perform encoding processing based on the fourth image sample to generate a second encoding result. In a specific implementation, the second encoding submodule can be a feature representative ξ in a student model of semi-supervised object detection, a momentum encoder, or other modules with encoding functions.
[0099] 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.
[0100] The second classification submodule is used to perform classification prediction processing based on 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. For example, the classification prediction result corresponding to the i-th image sample in the image sample set can be used express.
[0101] The second regression submodule is used to perform regression prediction processing based on 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. For example, the bounding box prediction result corresponding to the i-th image sample in the image sample set can be express.
[0102] In a specific implementation, the labeled 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 labeled 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 the 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 labeled image sample and the unlabeled image sample.
[0103] Annotated image sample D s May include first image data and Carried label data The tag data At least one category label is included, and each category label corresponds to one of N preset categories.
[0104] Unlabeled image sample Du May include second image data
[0105] 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 done by labeling the 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.
[0106] The preset numerical interval is uniformly sampled to obtain the target sampling value.
[0107] Exemplarily, the preset numerical interval may be [0, 1], and uniform sampling of [0, 1] to obtain the target sampling value may be to generate a random number greater than or equal to 0 and less than or equal to 1, and the generation probability of the random number obeys a uniform distribution.
[0108] In a specific implementation method, the feature fusion probability corresponding to each preset category is determined based on the statistical results, including: based on the statistical results, determining the preset category with the largest number of samples as the target preset category; based on the number of samples corresponding to each preset category and the target number of samples corresponding to the target preset category, determining the feature fusion probability corresponding to each preset category.
[0109] In specific implementation, based on the statistical results, the preset category with the largest number of samples is determined as the target preset category. The number of samples corresponding to each preset category can be sorted by size; based on the sorting results, the target category with the largest number of samples and the target number of samples corresponding to the target category are determined.
[0110] In the labeled image sample D s In the example, the categories can be sorted in descending order according to the number of training data, that is, N1≥N2≥...≥N k , then the target category with the largest number of samples corresponds to the number of target samples N1.
[0111] N1, N2...N k They can all be natural numbers greater than or equal to 0.
[0112] Exemplarily, the feature fusion probability corresponding to each preset category can be determined by referring to the following formula.
[0113] Among them, P k It is used to represent the feature fusion probability corresponding to the k-th preset category. k can be any natural number in the numerical interval [1, N]. k It 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.
[0114] For example, the K preset categories include a first preset category, a second preset category, and a 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.
[0115] To achieve descending sorting of categories according to the number of training data, the following method can be used.
[0116] Use N1 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 3 preset categories. The feature fusion probability P1 corresponding to this first preset category is 0.
[0117] Use N2 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 3 preset categories. The feature fusion probability
[0118] Use N3 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 3 preset categories. The feature fusion probability
[0119] The above feature fusion probability, as a mixing probability dependent on the category, can encourage more data augmentation of feature mixing from long-tailed classes, thus improving the data diversity of long-tailed classes.
[0120] The feature fusion probability can also be generated by other category-dependent mixing probability calculation methods.
[0121] In a specific implementation, according to the comparison result of the target sampling value and the feature fusion probability, the first coding result, the labeled image sample, and the unlabeled image sample, a fusion feature is generated, including: if the comparison result is used to represent that the target sampling value is less than the feature fusion probability, then according to a preset fusion factor, the first coding result corresponding to the first image data, the first coding result corresponding to the second image data, and the label data, a fusion feature is generated; if the comparison result is used to represent that the target sampling value is greater than or equal to the feature fusion probability, then according to a preset fusion factor, the first coding result corresponding to the first image data, and the label data, a fusion feature is generated.
[0122] It should be emphasized that the first processing submodule performs sampling processing on the labeled image samples and the unlabeled image samples using different sampling methods, and then performs weak enhancement processing after sampling to obtain third image samples. Therefore, a portion of the third image samples is derived from the labeled image samples, and another portion of the third image samples is derived from the unlabeled image samples. The first encoding submodule encodes the third image samples to obtain a first encoding result. Therefore, a portion of the first encoding result is derived from the labeled image samples, and another portion of the first encoding result is derived from the unlabeled image samples. Furthermore, the labeled image samples include the first image data, and the unlabeled image samples include the second image data. Therefore, a portion of the first encoding result corresponds to the first image data, and another portion of the first encoding result corresponds to the second image data.
[0123] The preset fusion factor λ obeys the uniform distribution (μ, 1), where μ is a pre-set hyperparameter, that is, λ is obtained by uniform sampling from the numerical interval [μ, 1].
[0124] 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.
[0125] If the target sampling value is less than the feature fusion probability, a fusion feature is generated based on 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. For example, the fusion feature can be determined according to the following formula.
[0126] in, Used to represent the first sub-feature in the i-th fusion feature, 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 label data OK. i can be a natural number greater than 0.
[0127] 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.
[0128] 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 the first encoding result.
[0129] If the target sampling value is greater than or equal to the feature fusion probability, a fusion feature is generated based on a preset fusion factor, the 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.
[0130] in, Used to represent the first sub-feature in the i-th fusion feature, 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 label data OK. i can be a natural number greater than 0.
[0131] 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.
[0132] 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.
[0133] 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.
[0134] In a specific implementation, the model parameters of the target detection student module can be updated based on the target detection prediction results, target detection pseudo labels, and fused features. For example, during the i-th training run, the loss function value for the i-th training run is generated based on the target detection prediction results, target detection pseudo labels, and fused features; and the model parameters of the target detection student module are updated based on the loss function value for the i-th training run. i can be a natural number greater than 0.
[0135] The loss function value of the i-th training can include the loss function L for supervised training of target detection on labeled image data s , the loss function L for semi-supervised target detection on unlabeled image data u , characterizes the classification loss function L of the fusion c One or more of .
[0136] For example, the loss function value L of the i-th training total You can refer to the following formula. total =L s +λ u L u +λ c L c (10)
[0137] Among them, λ u It is used to represent the fusion factor corresponding to semi-supervised target detection on unlabeled image data, λ u It can be a fixed value set by a custom setting. c Used to represent the fusion factor corresponding to feature fusion, λ c Can be a fixed value set by a custom setting.
[0138] 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
[0139] The target detection student module may include an RPN submodule and an 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 RPN; 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.
[0140] The data processing flow of the RPN 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".
[0141] 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 RPN, and the classification prediction results and bounding box prediction results corresponding to the region of interest ROI.
[0142] L s The generation method can refer to the following formula.
[0143] B represents the sample batch size used in model training, that is, the number of samples in 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.
[0144] 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 results and true classification labels corresponding to the region candidate box PRN. In the case that 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 that 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 is 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 that 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 that 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 results corresponding to the region of interest (ROI) and the true classification label. In the case that 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 that the image sample is an unlabeled image sample, the true classification label can be the classification pseudo label generated by the object detection teacher model for the unlabeled image sample.
[0145] 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 that 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 that the image sample is an unlabeled image sample, the true bounding box label can be the bounding box pseudo label generated by the object detection teacher model for the unlabeled image sample.
[0146] For example, the process of semi-supervised object detection on unlabeled image data is as follows: Strongly enhance the image Input into the target detection student module to obtain classification predictions for 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 unlabeled data and regress pseudo labels The target detection teacher module consists of a feature representation ξ, a semi-supervised classifier h r and regressor r.
[0147] 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
[0148] 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
[0149] The loss function for semi-supervised object detection on unlabeled images can refer to the following formula.
[0150] B represents the sample batch size used in model training, that is, the number of samples in 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 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 between the differences between two probability distributions.
[0151] 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 and generates 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 (e.g., a value range of 600-700). P Indicates the number of top-N region proposals obtained by the RPN of the target detection teacher module through the NMS algorithm.
[0152] Considering that the number of region proposals generated by the target detection teacher module is more accurate, in this embodiment, only the target detection teacher module can be used to obtain the top-N region proposals, and the number of region proposals in the target detection student module is not used.
[0153] 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 sp 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.
[0154] For example, the classification loss function L that characterizes the fusion c You can refer to the following formula.
[0155] Among them, B is used to represent the batch size, and B can be a natural number greater than 1. Used to represent the cross entropy loss function, h c () is used to represent the classification prediction processing by 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.
[0156] The target detection student module can also be used to update the parameters of the target detection teacher module based on the updated model parameters.
[0157] 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 used to update the first encoding submodule in the target detection teacher module.
[0158] For example, the target detection student module updates the parameters of the target detection teacher module according to the updated model parameters by referring to the following formula. t+1 =mξ t +(1-m)g t (20)
[0159] Among them, g t It is used to represent the model parameters in the second encoding submodule of the target detection student module after parameter update, m is used to represent the momentum coefficient, which is a preset value, t 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.
[0160] It should be emphasized that the target detection teacher module can be used for inference, 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.
[0161] 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.
[0162] In the first round of iteration, 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 object detection model after training is obtained.
[0163] Step S106: 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.
[0164] According to the trained first target detection model, a target detection model is constructed. 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.
[0165] 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.
[0166] 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.
[0167] The differences 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:
[0168] (1) In this 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.
[0169] (2) The input data of the target detection model is the image data on which target detection is to be performed, and the input data of the first encoding submodule is the image data on which target detection is to be performed. 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 may be third image data obtained by performing sampling processing and weak enhancement processing on the image sample set.
[0170] In the object detection model, the first encoding submodule is used to encode the image data required for object detection and generate a corresponding first encoding result. The first classification submodule is used to perform classification prediction based on the first encoding result and generate a classification prediction result. The first regression submodule is used to perform regression prediction based 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 object detection result for the image data requiring object detection.
[0171] This embodiment aims at the problem of target detection with a small amount of labeled data, a large amount of tagged data, and category imbalance. It can better solve the problem of semi-supervised target detection training with category imbalance, and semi-supervised training can ensure training efficiency while reducing the cost of manual labeling. In addition, this embodiment generates debiased pseudo-labels with category imbalanced data without knowing the category distribution of unlabeled data, while ensuring the performance of various semi-supervised target detection algorithms.
[0172] In the embodiment shown in Figure 1, 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, a target detection model is constructed based on the trained first target detection model; The target detection model includes a target detection teacher module in the trained first target detection model, so that the model training can be carried out in combination with labeled image samples and unlabeled image samples in the semi-supervised target detection scenario. During the training process, the target detection student module is used for prediction processing to obtain the target detection prediction result, and the target detection teacher module is used for encoding processing to obtain the first encoding result. According to the first encoding result, the target detection pseudo label is generated, and the labeled image sample and the unlabeled image sample are fused through 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 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 labeling, 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 closer to the real distribution when it is put into use, thereby improving the prediction accuracy of target detection.
[0173] Based on 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 is a processing flow chart of another target detection model construction method provided by the embodiment of the present application. Referring to Figure 2, the processing flow of the target detection model construction method is as follows: class-balanced sampling is performed on the labeled image data 201, and weak enhancement processing is performed, and the data is input into the Teacher model 203 for encoding processing to obtain a first encoding result corresponding to the labeled image data 201, and random sampling is performed on the unlabeled image data 202, and weak enhancement processing is performed, and the data is input into the Teacher model 203 for encoding processing to obtain a first encoding result corresponding to the unlabeled image data 202.
[0174] The Student model 204 includes two parts: an RPN and an ROI head. The RPN part of the Student model 204 can refer to the RPN submodule included in the target detection student module in the embodiment of FIG1 ; the ROI head part of the Student model 204 can refer to the ROI submodule included in the target detection student module in the embodiment of FIG1 .
[0175] Based on a similar concept, the Teacher model 203 includes two parts: RPN and ROI head.
[0176] The unlabeled image data 202 is randomly sampled and strongly enhanced, and then input into the Student model 204 for encoding to obtain a second encoding result corresponding to the unlabeled image data 202. In addition, the labeled image data 201 is randomly sampled and input into the Student model 204 for encoding to obtain a second encoding result corresponding to the labeled image data 201.
[0177] Teacher model 203 outputs the first encoding result to a fully connected layer, which is 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 based on the first encoding result and generate corresponding linear pseudo labels. Classifier 206 can refer to the first classification submodule in the aforementioned method embodiment, and the linear pseudo labels can refer to the classification pseudo labels in the aforementioned method embodiment.
[0178] The bounding box regression submodule 207 is used to perform regression prediction processing based on 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.
[0179] Student model 204 outputs the second encoding result to a fully connected layer, which is connected to two different fully connected layers, one connected to the classifier 208 and the other connected to the bounding box regression submodule 209.
[0180] Classifier 208 is configured to perform classification prediction processing based on the second encoding result to generate a corresponding linear classification prediction. Classifier 208 may refer to the second classification submodule in the aforementioned method embodiment. The linear classification prediction may refer to the classification prediction result obtained by the second classification submodule in the aforementioned method embodiment performing classification prediction processing based on the second encoding result.
[0181] Bounding box regression submodule 209 is configured to perform regression prediction processing based on the second encoding result to generate a corresponding bounding box prediction. Bounding box regression submodule 209 may refer to the second regression submodule in the aforementioned method embodiment. Bounding box prediction may refer to the bounding box prediction result obtained by the second regression submodule in the aforementioned method embodiment performing regression prediction processing based on the second encoding result.
[0182] Teacher model 203 outputs the first encoding result, annotated image data 201, and unannotated image data 202 to a feature fusion module. The feature fusion module is configured to perform feature fusion processing based on the first encoding result, annotated image data 201, and unannotated image data 202 to generate fused features. The feature fusion module transmits the fused features to a fully connected layer, which is connected to a feature fusion classifier 205. The feature fusion classifier 205 is configured to perform category prediction processing based on the fused features to obtain a category prediction result. This 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. This feature fusion classification loss can be used to drive parameter updates for the Student model 204.
[0183] 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 parameter update of the Student model 204.
[0184] 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 parameter update of the Student model 204.
[0185] The linear classification predictions output by classifier 208, the bounding box predictions output by bounding box regression submodule 209, and the ground truth labels can be used to generate supervised classification and regression losses, which can be used to drive parameter updates in student model 204. In supervised learning, ground truth refers to the accurate set of values for classification results in the training set and is generally used for error estimation and effect evaluation. Ground truth labels can include category labels in the annotated image data 201.
[0186] The Student model 204 after parameter update can be used to drive the parameter update of the Teacher model 203 through EMA.
[0187] 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.
[0188] 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.
[0189] Figure 3 is a processing flow chart of a target detection method provided in an embodiment of the present application. The target detection method in Figure 3 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. Referring to Figure 3, the target detection method provided in this embodiment specifically includes steps S302 to S304.
[0190] Step S302: Acquire the target image to be detected.
[0191] In step S304, the target image is input into the target detection model for target detection processing to obtain a corresponding target detection result; the target detection model is constructed using the target detection model construction method.
[0192] 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.
[0193] In the embodiment shown in FIG3 , 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 by combining labeled image samples and unlabeled image samples. During the training process, prediction processing is performed by the target detection student module to obtain a target detection prediction result, encoding processing is performed by the target detection teacher module to obtain a first encoding result, and according to the first encoding result, a target detection pseudo label is generated. 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 fused feature can be used to drive the update of the target detection teacher module parameters, so that the model training process can fully utilize the unlabeled image data to reduce the workload of manual labeling, 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 closer to the real distribution when it is put into use.
[0194] 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.
[0195] The target detection method provided by this embodiment is further described below by taking the application of the target detection method provided by this embodiment in an object tracking scenario as an example.
[0196] 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.
[0197] Next, each frame of 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.
[0198] The target detection result corresponding to each frame image can be used to represent the category prediction result and bounding box prediction result of at least one object in the frame image.
[0199] The bounding box prediction result can reflect the location information of the object in the image.
[0200] The method for constructing the target detection model can be the method for constructing the target detection model provided in the aforementioned method embodiment.
[0201] Then, based on 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.
[0202] Take the first frame image as an example. 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, it is determined whether the category prediction result of at least one object among the 3 objects is the same as the category of the target object to be tracked. If so, the object is determined as the target object, and the bounding box prediction result of the object is determined as the bounding box prediction result of the target object.
[0203] Finally, the object tracking information of the target object in the video data to be processed is determined based on the bounding box prediction results of the target object in each frame image.
[0204] Each frame of the video data to be processed is arranged in sequence according to the image acquisition time. Since 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, the position information of the target object in the multiple frames of the image arranged in sequence according to the image acquisition time can constitute the object tracking information corresponding to the target object.
[0205] 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, thereby determining relatively accurate object tracking information.
[0206] In addition, target detection methods can also be applied to image segmentation scenarios, key point detection scenarios, and so on.
[0207] 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.
[0208] 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.
[0209] FIG4 is a processing flow chart of another target detection method provided in an embodiment of the present application. Referring to FIG4 , the processing flow of the target detection method is as follows:
[0210] 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, resulting in a corresponding first encoding result. The first encoding result passes through two serially connected fully connected layers to 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 serially connected fully connected layers to the bounding box regression 404, which is used to perform regression prediction processing on the first encoding result to obtain bounding box information of the inference image data 401.
[0211] In the embodiment of FIG4 , the teacher model 402, three fully connected layers, feature fusion classification 403, and bounding box regression 404 can together constitute a target detection model. This target detection model can be constructed using the target detection model construction method provided in the aforementioned target detection model construction method embodiment. The data processing flow of this target detection model can refer to the aforementioned target detection method embodiment.
[0212] Exemplarily, the Teacher model 402 may be a Faster RCNN (region proposals-CNN) model with FPN (Feature Pyramid Networks).
[0213] Since the technical concept is the same, the description in this embodiment is relatively simple. For the relevant parts, please 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 this application also provides a device for constructing a target detection model, which is described below in conjunction with the accompanying drawings.
[0214] FIG5 is a schematic diagram of a device for constructing a target detection model provided in an embodiment of the present application.
[0215] This embodiment provides a device 500 for constructing a target detection model, comprising: a first acquisition unit 502, for acquiring an image sample set; the image sample set comprises labeled image samples and unlabeled image samples; a training unit 504, for inputting the image sample set into a first target detection model to be trained for training, thereby obtaining a trained first target detection model; the first target detection model to be trained comprises 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; generating 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 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; a construction unit 506 is used to 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.
[0216] 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; the first processing submodule is used to generate a third image sample corresponding to the pattern sample set based on 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 the first encoding result; the first classification submodule is used to perform classification prediction processing based on the first encoding result to generate the classification pseudo-label; the first regression submodule is used to perform regression prediction processing based on the first encoding result to generate the bounding box pseudo-label.
[0217] Optionally, the first processing submodule is specifically used to: if the image sample is the labeled image sample, perform 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, perform random sampling processing on the image sample to obtain a second image sample corresponding to the image sample; perform weak enhancement processing on the first image sample and the second image sample respectively to obtain the third image sample corresponding to the image sample set.
[0218] 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; the second processing submodule is used to generate a fourth image sample corresponding to the image sample set based on 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 the classification prediction result; the second regression submodule is used to perform regression prediction processing based on the second encoding result to obtain the bounding box prediction result.
[0219] Optionally, the second processing submodule is specifically used to: if the image sample is the labeled image sample, perform 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, perform 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.
[0220] Optionally, 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; the feature fusion module is specifically used to: perform 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 based on the statistical results; uniformly sample a preset numerical interval to obtain a target sampling value; generate the fusion feature based on a comparison result between the target sampling value and the feature fusion probability, the first encoding result, the annotated image sample and the unlabeled image sample.
[0221] Optionally, the feature fusion module is further specifically used to: determine the preset category with the largest number of samples as the target preset category based on the statistical results; and determine the feature fusion probability corresponding to each preset category based on the number of samples corresponding to each preset category and the target number of samples corresponding to the target preset category.
[0222] Optionally, the feature fusion module is further specifically used to: if the size comparison result is used to characterize that the target sampling value is less than the feature fusion probability, then generate the fusion feature 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; 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 generate the fusion feature according to the preset fusion factor, the first encoding result corresponding to the first image data, and the label data.
[0223] The target detection model construction device provided by 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 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; the 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. In this way, in the semi-supervised target detection scenario, the model training can be carried out by combining labeled image samples and unlabeled image samples. During the training process, the target detection student module is used to perform prediction processing to obtain the target detection prediction result, and the target detection teacher module is used to perform encoding processing to obtain the first encoding result. According to the first encoding result, the target detection pseudo label is generated, and the labeled image sample and the unlabeled image sample are fused through 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 can be used to drive the target detection teacher module to update the parameters, so that the model training process can fully utilize the unlabeled image data to reduce the workload of manual labeling, and use the labeled image data to guide the model to learn, 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 target detection prediction accuracy.
[0224] 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 with reference to the accompanying drawings.
[0225] FIG6 is a schematic diagram of a target detection device provided in an embodiment of the present application.
[0226] This embodiment provides a target detection device 600, including: a second acquisition unit 602, used to acquire a target image to be detected; a detection unit 604, 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.
[0227] 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 the target image to be detected; the detection unit is used to input the target image 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. In this way, in the semi-supervised target detection scenario, the model training can be carried out by combining labeled image samples and unlabeled image samples. During the training process, the target detection student module is used to perform prediction processing to obtain the target detection prediction result, and the target detection teacher module is used to perform encoding processing to obtain the first encoding result. According to the first encoding result, the 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 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 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 labeling, 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 closer to the real distribution when it is put into use, thereby improving the prediction accuracy of target detection.
[0228] Corresponding to the method for constructing a target detection model described above, or corresponding to the target detection method described above, based on the same technical concept, an embodiment of the present application also provides an electronic device, which is used to execute at least one of the method for constructing a target detection model provided above and the target detection method provided above. Figure 7 is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0229] As shown in Figure 7, electronic devices 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 can be a temporary storage or a persistent storage. The application stored in the memory 702 may include one or more modules (not shown in the figure), each module may include a series of computer-executable instructions in the electronic device. Furthermore, the processor 701 can 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.
[0230] 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 are configured to be executed by one or more processors, including instructions for performing the following computer-executable instructions: obtaining an image sample set; 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 for training 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 the following computer-executable instructions according to The image sample set is predicted and processed 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 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; based on the trained first target detection model, a target detection model is constructed; the target detection model includes the target detection teacher module in the trained first target detection model.
[0231] In another specific embodiment, an electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions in the electronic device, and is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following: obtaining a 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 a target detection model construction method.
[0232] An embodiment of a computer-readable storage medium provided in this specification is as follows:
[0233] 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.
[0234] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, which implement the following process when executed by a processor: obtaining an image sample set; 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 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 processing, generating a first encoding result; generating 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 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; constructing 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.
[0235] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the method for constructing the 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.
[0236] 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.
[0237] 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: obtaining a 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; and the target detection model is constructed by a target detection model construction method.
[0238] 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. 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.
[0239] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0240] 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 take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0241] 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 produce a machine, so that the instructions executed by the processor of the computer or other programmable device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0242] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0243] 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, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0244] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0245] 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. Memory is an example of a computer-readable medium.
[0246] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology to store information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0247] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0248] The 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 communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0249] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0250] The foregoing description is merely an example of the present invention and is not intended to limit the present invention. Persons skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims herein.
Claims
1. A method for constructing a target detection model, comprising: Obtain image sample set; 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 for training 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 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, generate a corresponding target detection pseudo label; 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 further 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, wherein 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 labels include classification pseudo labels and bounding box pseudo labels; The first processing submodule is configured to generate a third image sample corresponding to the pattern sample set based on each image sample in the image sample set; The first encoding submodule is configured to perform 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, wherein: Generating, according to each image sample in the image sample set, a third image sample corresponding to 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, wherein 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 configured to generate a fourth image sample corresponding to the image sample set based on 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, wherein Generating, according to each image sample in the image sample set, a fourth image sample corresponding to the image sample set, includes: 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; Performing 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, wherein 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 based on 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; Determining 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 labeled image sample, and the unlabeled image sample.
7. The method according to claim 6, wherein: Determining the feature fusion probability corresponding to each of the preset categories according to the statistical results includes: According to the statistical results, the preset category with the largest number of samples is determined as the target preset category; The feature fusion probability corresponding to each preset category is determined according to the number of samples corresponding to each preset category and the target number of samples corresponding to the target preset category.
8. The method according to claim 6, wherein: 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 labeled image sample, and the unlabeled image sample includes: 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 represent 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. The method according to claim 2, wherein: Generating, according to each image sample in the image sample set, a third image sample corresponding to the image sample set, includes: If the image sample is a labeled image sample, performing class-balanced sampling processing on the image sample to obtain a third image sample corresponding to the image sample; If the image sample is an unlabeled image sample, random sampling is performed on the image sample to obtain a third image sample corresponding to the image sample.
10. A target detection method, comprising: Acquire the target image to be detected; Inputting 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 according to any one of claims 1 to 9.
11. The method according to claim 10, wherein: The step of acquiring a target image to be detected includes: The video data to be processed is obtained; the video data includes a plurality of frames of target images arranged in sequence according to the image acquisition time sequence.
12. The method according to claim 11, wherein After inputting the target image into the target detection model for target detection processing and obtaining the corresponding target detection result, the target detection method further includes: determining a target object to be tracked in the target image according to a target detection result corresponding to the target image, and determining a bounding box prediction result of the target object in the target image; Object tracking information of the target object in the video data is determined according to the bounding box prediction result.
13. A device for constructing a target detection model, the device comprising: A first acquisition unit, configured to acquire an image sample set; The image sample set includes labeled image samples and unlabeled image samples; a training unit, configured to input 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 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, generate a corresponding target detection pseudo label; 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 results, the target detection pseudo labels and the fusion features; The target detection student module is further 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.
14. A target detection device comprising: A second acquisition unit is used to acquire a target image to be detected; A detection unit, configured 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 according to any one of claims 1 to 9.
15. An electronic device, comprising: 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 9, or the target detection method as described in any one of claims 10 to 12.
16. A computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and when the computer-executable instructions are executed by a processor, the method for constructing a target detection model as described in any one of claims 1 to 9, or the target detection method as described in any one of claims 10 to 12, is implemented.
Citation Information
Patent Citations
Target detection method and device and electronic equipment
CN112418268A
Target category detection model training method, target detection method and electronic equipment
CN114663726A
Abdominal lymph node detection method and device based on semi-supervised learning
CN115018852A
Semi-supervised target detection model training method and device, equipment and storage medium
CN115240035A
Training method and device of image recognition model and electronic equipment
CN115661615A
Cited By
Semi-supervision-based astronomical time-frequency image target detection method and system
CN120764617A
Interactive target detection frame labeling method realized based on SAM large model
CN121305509A
