A small sample target detection method and device based on supporting sample feature enhancement
Through the supported sample feature enhancement method based on meta-learning, the MetaYOLO model and SmoothL1 loss function are used to solve the problem of low detection accuracy of rare categories of objects in small sample object detection, and efficient object detection performance under very small amounts of labels is achieved.
Patent Information
- Application Number
- CN202111303534.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-11-05
AI Technical Summary
Existing object detection models have low detection accuracy under small sample data conditions, especially for rare objects, which are difficult to effectively train and apply.
Using the supported sample feature enhancement method based on meta-learning, by constructing the MetaYOLO model, sampling the image to be detected and the supported samples in the base class data, calculating the mean of the class feature vector, and using the SmoothL1 loss function to promote feature approximation, and constructing a balanced data set for Training to improve the detection performance of new categories.
When a very small number of training samples are marked, good detection performance is achieved, which alleviates the problem of reducing the quality of class features caused by too little data, and improves the accuracy of small sample object detection.
Smart Images

Figure CN114078197B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer vision and image processing, and in particular to a small sample target detection method and device based on supporting sample feature enhancement. Background Art
[0002] The object detection task refers to the specific category and location of one or more predefined objects in the output image given an input image of any size. Object detection is one of the most basic and important problems in the field of computer vision: on the one hand, it is the basis of many downstream visual tasks, such as single / multi-target tracking, instance segmentation, key point detection, etc.; on the other hand, it also has a wide range of application scenarios, such as industrial quality inspection, security, autonomous driving, etc. Therefore, object detection has always been a key research issue in the field of computer vision.
[0003] The current mainstream object detection models mainly use a fully supervised training method, that is, training deep neural networks on a large amount of labeled data. The training data often contains tens of millions of labels, which helps the detection model to fully learn the characteristics of each category. If there is less training data for a certain category, the final model's detection ability for that category will also be significantly reduced. However, collecting and labeling enough training data requires a lot of time, manpower and financial resources. For some rare categories of objects, it is even impossible to collect sufficient training data. This limitation greatly restricts the application of object detection models in practical scenarios.
[0004] The background section of the present invention may contain background information about the problem or environment of the present invention, but does not necessarily describe the prior art. Therefore, the inclusion of content in the background section is not an admission by the applicant that the prior art is available. Summary of the invention
[0005] In order to improve the detection accuracy of existing small sample target detection, the present invention proposes a small sample target detection method and device based on supporting sample feature enhancement.
[0006] To this end, the small sample target detection method based on supporting sample feature enhancement proposed in the present invention specifically includes the following steps:
[0007] S1, model initialization phase: construct any meta-learning based object detection model;
[0008] S2, the first stage of meta-training: sampling the images to be detected and the supporting samples in the base class data, and training them according to the original meta-training method of the model selected in the model initialization;
[0009] S3, the second stage of meta-training: all base class data are input into the model as support samples, the mean of the class feature vectors of all support samples under each category is calculated and stored, and then the mean is used as the auxiliary supervision signal for class feature vector calculation, and the training of the first stage of meta-training is repeated;
[0010] S4, meta-testing stage: according to the number of new class labels, sampling is performed from the base class data to construct a balanced dataset with an equal number of labels for all classes. Then, the images to be tested and the supporting samples are sampled from the balanced dataset, and the training of the second stage of meta-training is repeated;
[0011] S5, new class target detection stage: use the new class label as the supporting sample, perform target detection on the input image, and obtain the position and specific category of the target belonging to the new class in the input image.
[0012] Furthermore, in step S1, MetaYOLO is selected as the target detection model, and the MetaYOLO consists of a feature extractor, a reweighting module and a prediction layer.
[0013] Furthermore, in step S2, in each training batch, the images to be detected and the supporting samples are sampled. The sampling method of the supporting samples is as follows: for each base category, a bounding box belonging to the category is sampled, and the image where the bounding box is located is obtained. Then, a 0-1 mask is added to the original RGB channel of the image to indicate the position of the bounding box, and the image to be detected is input into the feature extractor, and the supporting samples are input into the reweighting module.
[0014] Further, in step S2, let the batch size be B, let the number of base class categories be N, let the number of pictures in the training set be D, let the total number of bounding box labels contained in the D pictures be A, first randomly sample B pictures from the D pictures, and input them into the feature extractor as the images to be detected, then, for the N base classes, each category randomly samples a bounding box belonging to the class from the A bounding box labels, and obtains the picture where the bounding box is located, for the picture, on the basis of the RGB channel, add a mask channel, the mask channel value is 1 in the area covered by the bounding box, and 0 in other areas, the N four-channel pictures will be input into the reweighting module as supporting samples, the N outputs of the reweighting module will weight the features corresponding to each picture to be detected, and obtain N feature maps, and then the N feature maps are input into the prediction layer to determine whether the selected picture to be detected contains objects consistent with the corresponding supporting sample category.
[0015] Furthermore, in step S3, for each base class category, all its bounding box labels are traversed and input into the reweighting module as supporting samples to obtain the mean of the class feature vectors of all supporting samples of the category, and then the training of the first stage of meta-training is repeated, but a SmoothL1 loss function is added between the newly predicted class feature vector and the previously saved class feature vector to promote the class feature vector calculated by a single supporting sample to approach the mean of the class feature vectors calculated by multiple supporting samples.
[0016] Furthermore, in step S4, according to the number of bounding box labels contained in each new class category, an equal number of labels are sampled from each base class category to form a balanced data set, and then the second stage of meta-training is performed on the balanced data set.
[0017] Further, in step S4, assuming that the total number of new class categories is N', and the number of labels contained in each new class category is K, first, among the A base class bounding box labels, K bounding boxes are sampled for each base class to obtain (N+N')*K bounding boxes, where N is the total number of base class categories, and the pictures where these bounding boxes are located are collected to construct a balanced data set, and then the training of the second stage of meta-training is repeated on the balanced data set.
[0018] Furthermore, in step S5, the new class support samples are input into the re-weighting module, the class feature vector of each category of the new class is calculated, the image to be detected is input into the feature extractor, and the class feature vector of each category of the new class is used to re-weight the output feature map, and the weighted feature map is input into the subsequent detection layer for detecting the new class.
[0019] The small sample target detection device based on supporting sample feature enhancement proposed in the present invention specifically includes a central processing unit and a memory, in which a computer program that can be executed by the central processing unit is stored. The central processing unit can implement the above-mentioned small sample target detection method based on supporting sample feature enhancement by executing the computer program.
[0020] The computer-readable storage medium proposed in the present invention stores a computer program that can be executed by a central processing unit, and the central processing unit can implement the above-mentioned small sample target detection method based on supporting sample feature enhancement by executing the computer program.
[0021] Compared with the prior art, the present invention has the following beneficial effects:
[0022] Compared with other traditional fully supervised target detection models, the present application can achieve better detection performance when the object to be detected contains only a very small number of labeled training samples, and through supporting sample enhancement, the features of a very small number of supporting samples can be close to the features of sufficient supporting samples, thereby alleviating the problem of reduced class feature quality caused by too little data. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a flow chart of a small sample target detection method based on supporting sample feature enhancement according to an embodiment of the present invention;
[0024] Figure 2 It is a schematic diagram of the training process of a small sample target detection method when the MetaYOLO target detection model is used in an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described with reference to the accompanying drawings.
[0026] Small-sample object detection aims to train the detection model with a very small number of labels (e.g., each category contains only 1-10 labels). Mainstream small-sample object detection mainly relies on meta-learning methods, and its training goal is to let the model "learn to learn". On the existing labeled data sets, the small-sample object detection model based on meta-learning will construct a small-sample learning scenario during training: in each training batch, a sample (support sample) is sampled for each category to be detected, and the image to be detected is classified and located based on the information contained in the sample. Through this training paradigm, the object detection model can learn to mine the essential information of the corresponding category from a very small number of samples and use it for detection and classification. Therefore, when faced with a scenario where each category has only a very small amount of labeled data, the model can also quickly fine-tune and converge with a small amount of labeled information to adapt to the detection of new categories. Usually, for the convenience of description, people call the categories contained in the existing data set base classes, and the categories to be detected that actually contain only a small number of annotations are called new classes.
[0027] The embodiment of the present invention is improved based on the above-mentioned meta-learning method to solve the technical problem proposed by the present invention. Figure 1 As shown, an embodiment of the present invention provides a small sample target detection method based on supporting sample feature enhancement, comprising the following steps:
[0028] S1. Model initialization phase: Construct any meta-learning-based target detection model (such as MetaYOLO). MetaYOLO consists of a feature extractor, a reweighting module, and a prediction layer. The small-sample target detection model based on meta-learning is not limited to Meta YOLO, and can be a small-sample target detection model based on meta-learning of any structure, such as AttentionRPN, ONCE, FA, etc. As long as the model is based on meta-learning, there are branches for processing the images to be detected and branches for processing supporting samples, and for each image a in the training set, it is cut into multiple sub-images, and rearranged in space to generate a reconstructed image b of the same size as image a.
[0029] S2, the first stage of meta-training: sample the images to be tested and the supporting samples in the base class data, and train them according to the original meta-training method of the model selected in the model initialization. Specifically, Figure 2 As shown in the figure, when MetaYOLO is selected as the meta-learning based target detection model, in each training batch, the images to be detected and the supporting samples are sampled. The sampling method of the images to be detected is consistent with the sampling method of the general target detection model. The sampling method of the supporting samples is that for each base class category, a bounding box belonging to the category is sampled, and the image where the bounding box is located is obtained. Then, a 0-1 mask is added to the original RGB channel of the image to indicate the position of the bounding box. In this training batch, the images to be detected are input into the feature extractor, and the supporting samples are input into the reweighting module. For example, let the batch size be B, the number of base classes be N, the number of images in the training set be D, and the total number of bounding box labels contained in the D images is For A, first randomly sample B pictures from D pictures as the images to be detected and input them into the feature extractor. Then, for N base classes, each category randomly samples a bounding box belonging to the class from A bounding box labels, and gets the picture where the bounding box is located. For the picture, on the basis of RGB channels, add a mask channel. The value of the mask channel is 1 in the area covered by the bounding box and 0 in other areas. N four-channel pictures will be input into the reweighting module as support samples. The N outputs of the reweighting module will weight the features corresponding to each picture to be detected to obtain N feature maps. Then, the N feature maps are input into the prediction layer to determine whether the selected picture to be detected contains objects consistent with the corresponding support sample category.
[0030] S3, the second stage of meta-training: all base class data are input into the model as support samples, the mean of the class feature vectors of all support samples under each category is calculated and stored, and then the mean is used as the auxiliary supervision signal for class feature vector calculation, and the training of the first stage of meta-training is repeated. Specifically, Figure 2As shown in the figure, when MetaYOLO is selected as the meta-learning based target detection model, for each base class category, all its bounding box labels are traversed and input into the reweighting module as support samples to obtain the mean of the class feature vectors of all support samples of the category, and then the training of the first stage of meta-training is repeated, but an auxiliary supervision signal is added at the output of the reweighting module, that is, a SmoothL1 loss function is added between the newly predicted class feature vector and the previously saved class feature vector, so as to promote the class feature vector calculated by a single support sample to approach the mean of the class feature vector calculated by multiple support samples. For example, first, for A bounding box labels, A four-channel images are constructed in the manner described in the first stage. Subsequently, the A four-channel images are divided into N groups according to the category to which the bounding box belongs, and are input into the reweighting module as supporting samples, and the mean of the output of the reweighting module of all supporting samples in each category under N categories is recorded. Finally, the first stage of meta-training is repeated (but the number of training rounds is reduced as appropriate), and a supervisory signal is added to the output of the reweighting module, which is the previously recorded mean. Accordingly, a SmoothL1 loss function needs to be added to the loss function to narrow the difference between the output of the reweighting module and the previous output mean.
[0031] S4, meta-test phase: according to the number of new class labels, sampling is performed from the base class data to construct a balanced data set containing an equal number of labels for all classes, then the images to be tested and the supporting samples are sampled from the balanced data set, and the second stage of meta-training training is repeated. Specifically, according to the number of bounding box labels contained in each new class, an equal number of labels are sampled from each base class to form a balanced data set, and then the second stage of meta-training training is performed on the balanced data set, where the mean value of the supporting samples in the auxiliary supervisory signal is consistent with that in the third step, and the supervisory signal only acts on the base class training data. For example, let the total number of new class categories be N', and each new class The number of labels included is K. First, among the A base class bounding box labels, K bounding boxes are sampled for each base class to obtain (N+N')*K bounding boxes. The pictures where these bounding boxes are located are collected to construct a balanced data set. Then, the second stage of meta-training is repeated on the balanced data set (but the number of training rounds is reduced as appropriate). It should be noted that in the training pictures sampled at this time, all bounding boxes that do not belong to the bounding boxes in the balanced data set are regarded as background. The output mean of the reweighted module used in this round is consistent with that in the second stage of meta-training, so it does not include the output mean of the new class. Therefore, accordingly, the SmoothL1 loss function also only acts on the base class support samples.
[0032] S5, new class target detection stage: use the new class label as the support sample, perform target detection on the input image, and obtain the position and specific category of the target belonging to the new class in the input image. Specifically, when MetaYOLO is selected as the meta-learning-based target detection model, the new class support sample is input into the reweighting module, and the class feature vector of each category of the new class is calculated. The image to be detected is input into the feature extractor, and the class feature vector of each category of the new class is used to reweight the output feature map, and the weighted feature map is input into the subsequent detection layer for detecting the new class.
[0033] An embodiment of the present invention provides a small sample target detection device based on supporting sample feature enhancement, including a central processing unit and a memory, wherein the memory stores a computer program that can be executed by the central processing unit. The central processing unit can implement the above-mentioned small sample target detection method based on supporting sample feature enhancement by executing the computer program.
[0034] The above disclosure is only the preferred embodiment of the present invention, and certainly cannot be used to limit the scope of the present invention. It should be pointed out that for those skilled in the art, any equivalent changes made to the scheme of the present invention without departing from the design structure and principle of the present invention are considered to be within the protection scope of the present invention.
Claims
1. A small sample target detection method based on supporting sample feature enhancement, characterized in that , specifically including the following steps: S1, model initialization phase: construct any meta-learning based object detection model; S2, the first stage of meta-training: sampling the images to be detected and the supporting samples in the base class data, and training them according to the original meta-training method of the model selected in the model initialization; S3, the second stage of meta-training: all base class data are input into the model as support samples, the mean of the class feature vectors of all support samples under each category is calculated and stored, and then the mean is used as the auxiliary supervision signal for class feature vector calculation, and the training of the first stage of meta-training is repeated; S4, meta-testing stage: according to the number of new class labels, sampling is performed from the base class data to construct a balanced dataset with an equal number of labels for all classes. Then, the images to be tested and the supporting samples are sampled from the balanced dataset, and the training of the second stage of meta-training is repeated; S5, new class target detection stage: use the new class label as the support sample, perform target detection on the input image, and obtain the position and specific category of the target belonging to the new class in the input image; In step S1, Meta YOLO is selected as the target detection model, wherein Meta YOLO consists of a feature extractor, a reweighting module and a prediction layer; In step S2, in each training batch, the image to be detected and the supporting samples are sampled. The sampling method of the supporting samples is to sample a bounding box belonging to each base class category and obtain the image where the bounding box is located. Then, a 0-1 mask is added to the original RGB channel of the image to indicate the position of the bounding box. The image to be detected is input into the feature extractor, and the supporting samples are input into the reweighting module. In step S3, for each base class category, all its bounding box labels are traversed and input into the reweighting module as supporting samples to obtain the mean of the class feature vectors of all supporting samples of the category, and then the training of the first stage of meta-training is repeated, but a Smooth L1 loss function is added between the newly predicted class feature vector and the previously saved class feature vector to promote the class feature vector calculated by a single supporting sample to approach the mean of the class feature vectors calculated by multiple supporting samples.
2. The small sample target detection method according to claim 1, characterized in that: In step S2, let the batch size be B, let the number of base classes be N, let the number of pictures in the training set be D, let the total number of bounding box labels contained in the D pictures be A, first randomly sample B pictures from the D pictures, and input them into the feature extractor as the images to be detected. Then, for the N base classes, each category randomly samples a bounding box belonging to the class from the A bounding box labels, and obtains the picture where the bounding box is located. For the picture, on the basis of the RGB channel, a mask channel is added. The value of the mask channel is 1 in the area covered by the bounding box and 0 in other areas. The N four-channel pictures will be input into the reweighting module as supporting samples. The N outputs of the reweighting module will weight the features corresponding to each picture to be detected to obtain N feature maps. Then, the N feature maps are input into the prediction layer to determine whether the selected picture to be detected contains objects consistent with the corresponding supporting sample category.
3. The small sample target detection method according to claim 1, characterized in that: In step S4, according to the number of bounding box labels contained in each new class category, an equal number of labels are sampled from each base class category to form a balanced data set, and then the second stage of meta-training is performed on the balanced data set.
4. The small sample target detection method according to claim 3, characterized in that: In step S4, let the total number of new class categories be N', and the number of labels contained in each new class category be K. First, among the A base class bounding box labels, K bounding boxes are sampled for each base class to obtain (N+N')*K bounding boxes, where N is the total number of base class categories. The pictures containing these bounding boxes are collected to construct a balanced data set, and then the second stage of meta-training is repeated on the balanced data set.
5. The small sample target detection method according to claim 1, characterized in that: In step S5, the new class support samples are input into the reweighting module, the class feature vector of each category of the new class is calculated, the image to be detected is input into the feature extractor, and the class feature vector of each category of the new class is used to reweight the output feature map, and the weighted feature map is input into the subsequent detection layer for detecting the new class.
6. A small sample target detection device based on support sample feature enhancement, characterized in that , specifically includes a central processing unit and a memory, the memory stores a computer program that can be executed by the central processing unit, and the central processing unit can implement the small sample target detection method based on supporting sample feature enhancement as described in any one of claims 1-5 by executing the computer program.
7. A computer-readable storage medium storing a computer program executable by a central processing unit, characterized in that , the central processing unit can implement the small sample target detection method based on supporting sample feature enhancement as described in any one of claims 1-5 by executing the computer program.
Citation Information
Patent Citations
Small sample target detection method and system based on support and query samples
CN113191359A
Small sample target detection method and system based on category semantic feature reweighting
CN113420642A
Metalearning-based small sample scene classification and identification method and system
CN113435509A
Image classification model training method, apparatus, computer device, and storage medium
WO2021164306A1
