Target detection method and system for data long-tail distribution
By combining the data enhancement and generation methods of the decoupled training framework, the difficult problem of identifying tail categories in target detection under long-tail distribution of data is solved, the performance is improved, and the effective representation and identification of tail categories are achieved.
Patent Information
- Application Number
- CN202410910913.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-10-11
AI Technical Summary
Existing target detection methods are difficult to effectively identify tail categories when facing long-tail distribution of data, resulting in performance degradation. Existing methods such as resampling and information enhancement have problems of over-fitting, under-fitting, and lack of dynamic feedback mechanisms.
Three plug-and-play data enhancement and generation methods are proposed that combine the decoupled training framework: the rebalancing instance data enhancement method of static indicators, the detection box generator method and the dynamic rebalancing data generation method, by generating more tail categories Feature information to optimize target detection performance under long-tail distribution of data.
It effectively improves the target detection method's ability to represent tail categories, improves overall performance, avoids overfitting and underfitting, realizes the use of dynamic feedback mechanisms, and enhances the model's ability to identify tail categories.
Smart Images

Figure CN118762167A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and specifically, to a target detection method and system thereof for long-tail distribution of data. Background Art
[0002] The popularization of artificial intelligence plays a vital role in promoting the intelligentization of industries. The industry has fine-tuned the upstream tasks pre-trained by the academic community for specific industries and applied them to downstream tasks. However, the data in actual production is much more complex than the data sets in the academic community. Directly migrating the academic model to the downstream task cannot achieve the effect that meets the industry standards. As the most common upstream task of deep learning, object detection can be widely used in industrial tasks such as autonomous driving pedestrian detection and defect detection. Its potential and demand space for application in actual production are very huge. However, in large-scale data sets in nature and industry, data often have long-tail distribution characteristics. Long-tail distribution has a large number of categories, and the distribution of the number of categories shows an extremely unbalanced phenomenon that a few categories have a large number of data samples, while most categories have a small number of samples. For example, in the detection of metal surface defects in the industry, due to problems with production equipment or process methods, the collected data sets are often dominated by one or two defect categories, and the frequency of most other defect categories is low, and only one or two image data can be collected. And due to the strict standards for metal components in production, its surface defect categories are more finely classified and have more categories. In addition, in autonomous driving and some vending tasks, the collected data has many categories and the category division is relatively fine-grained, but the distribution of data in different categories is extremely unbalanced. Therefore, directly applying common target detection methods to data actually collected in industry and nature often results in poor fitting results and performance degradation. The long-tail distribution of data has become an urgent problem to be solved in realizing the application of deep learning target detection methods in actual production.
[0003] Decoupled-Training framework for representation learning and classifier learning: The decoupled-training framework is a classic two-stage training framework for long-tail data distribution. It believes that the rebalancing of any imbalanced classification dataset should essentially be just the rebalancing of the classifier, and the distribution of the categories should not be used to change the distribution of data features during feature learning, or the distribution of image features and the distribution of category labels are essentially uncoupled. Therefore, the decoupled training scheme is divided into two steps (1) In the first step, the model is trained under the original long-tail data distribution to make the object detection fit the representation knowledge of the dataset. (2) In the second step, the parameters of the feature extractor of the model are fixed, and then a classifier is connected separately. This classifier can be different from the classifier in the first step, and the classifier is trained for class balance (Class Balanced Learning), that is, the classifier is calibrated under a data distribution with a balanced number of categories. In the design of methods for long-tail data distribution, the decoupled-training framework is often used in combination with other commonly used solutions for long-tail data distribution, such as reweighting, resampling, and data augmentation methods. The reparameterization trick is a method for generating samples in many generative methods (VAE, GAN) and for generating action spaces in reinforcement learning. It decouples sample sampling and generation processes, making the step of sampling latent features differentiable. The differentiable connection between the generation module and the sampling module allows the generation module to optimize the parameters of the generation module through gradients without the need for additional approximations or manual adjustments to the sampling method, thereby achieving end-to-end sample generation. Finally, the differentiability of the sampling module makes model design more flexible. Researchers can try different sampling strategies without worrying about the problem of gradients not being able to propagate, allowing them to design generation methods more freely.
[0004] There are two main reasons why the performance of deep learning object recognition tasks is degraded due to the long-tail distribution of data: (1) Deep learning is a data-driven method. The lack of data makes the model unable to learn the knowledge of the tail categories well. (2) Multi-category recognition tasks are essentially mutually exclusive probability problems. Too little data causes the tail categories to be suppressed by the head categories in the game during training, and the model tends to identify samples as categories with more data. Therefore, the main ideas for optimizing the object recognition task with long-tail distribution of data can be divided into two aspects: (1) Increasing the amount of data of scarce categories or supplementing the knowledge of scarce categories to optimize the problem of the degradation of the model's tail category recognition ability caused by lack of data. Research solutions based on this idea mainly include resampling, information enhancement, semi-supervised, and unsupervised methods. However, semi-supervised and unsupervised methods involve complex framework rule designs such as complex domain alignment, and their application value is limited. The resampling method distorts the original data distribution and does not introduce new knowledge, which is prone to overfitting and underfitting problems. Information enhancement can effectively increase the amount of data and additional knowledge, and has a regularization effect. (2) Alleviate the disadvantage of tail categories in multi-category competition by balancing data distribution and correct the training strategy of deep learning to make it easier for tail categories to win in the game. Or, make a posteriori correction to the final game result under the prior condition of known long-tail distribution of data. The reweighting method is the most typical research scheme based on correcting the disadvantage of tail category game, but the current reweighting method is basically a heuristic experimental method, which lacks theoretical support and is difficult to effectively achieve the effective trade-off between the accuracy of head and tail categories. Data enhancement and generation methods are relatively simple and effective methods among information enhancement methods, but simple data enhancement methods have limited ability to expand data space, and regularized enhancement methods that can effectively generate new data are not category sensitive. In addition, the commonly used methods lack a dynamic feedback mechanism, and experimental posteriori verification of the effectiveness of the method is required.
[0005] Therefore, how to provide a target detection method to improve method performance has become an urgent problem to be solved in this field. Summary of the invention
[0006] This application proposes a target detection method for long-tail data distribution.
[0007] This application has the following beneficial effects:
[0008] This application proposes three plug-and-play data enhancement and generation methods based on the decoupled training framework: the rebalanced instance data enhancement method (Rebalanced Copy-Paste) for static indicators, the detection box generator method (Box generator), and the dynamic rebalanced data generation method (Rebalanced Feature Generator). The purpose is to design a simple method to effectively optimize the target detection method's ability to represent tail categories in the case of long-tail data distribution and improve the overall performance of the method. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0010] Figure 1 is a flow chart of a target detection method for long-tail distribution of data provided according to an embodiment of the present application;
[0011] Figure 2 It is an overall training framework provided according to the embodiment of the present application;
[0012] Figure 3 A data enhancement method is provided according to an embodiment of the present application;
[0013] Figure 4 A method for generating a dense detection frame based on a label according to an embodiment of the present application;
[0014] Figure 5 It is a schematic diagram of the internal structure of a target detection system for long-tail data distribution provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0015] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0016] This application proposes a target detection method for long-tail data distribution. The main idea of this method is to introduce more feature information for tail categories through data enhancement and generation methods. This application designs three plug-and-play data enhancement and generation methods: First, this application proposes an instance data enhancement method based on static indicators, which aims to synthesize more new samples containing tail category instances through original samples. Secondly, this application proposes a detection box generator module, which generates more proposed detection boxes by offsetting the original detection box in the two-stage detection method to alleviate the problem that the proposed detection box of the tail category is filtered out in the first stage due to the low classification score. Finally, this application designs a dynamically rebalanced data generation method, and uses the effective number of categories, the classification score of the category, and the classification boundary distance of the category as indicators to design the generation probability, aiming to generate more new samples for the tail category. In addition, this application uses the heavy parameter technique method to achieve end-to-end feature sampling and data generation. These three methods are used in conjunction with the coupling and decoupling training framework to achieve the purpose of improving the performance of the method.
[0017] The method of the present application is implemented based on the general open source target detection tool framework MMDetection. This embodiment uses Mask-RCNN as the benchmark model for training. And this embodiment adopts a two-stage decoupled training method for training. In the characterization learning stage, this embodiment uses a random sampler to sample the original distribution of the data set, and uses SGD as a gradient descent update method. In the first stage, this embodiment sets the momentum coefficient of SGD to 0.9 and the weight decay coefficient to 0.00005. When verifying the instance data enhancement method based on static indicators designed in this embodiment, this embodiment does not use standard scale jittering, but applies the instance data enhancement method based on static indicators to an image of size 1280×1280. And in the classifier learning stage, this embodiment sets the weight decay coefficient to 0.0001. This embodiment applies random horizontal flipping and scale jittering, and makes the shorter edge of the image between {640, 672, 704, 736, 768, 800} pixels while the longer edge is less than 1333 pixels under the condition of ensuring the aspect ratio of the picture. In addition, according to the benchmark practice, this embodiment reduces the threshold of the positive example score during prediction from 0.05 to 0.0001, and after applying non-maximum suppression with an IoU threshold of 0.5, increases the maximum number of predictions for each image from 100 to 300 to increase the number of instances of the tail category involved in the calculation. And this application sets a training cycle as 12 training rounds (Epoch). When this embodiment adopts a decoupled training framework, one training cycle is trained in the representation learning stage, and then the model trained in the representation learning stage is fine-tuned (Finetune) for one training cycle in the classifier learning stage. When performing end-to-end training, this embodiment uses two training cycles for training. And when conducting experiments on the rebalanced data generation method, this embodiment sets the hyperparameter β of the effective number of instances based on sampling to 0.9999, and the hyperparameter τ in the detection box generation method is set to 6.
[0018] (2) Training environment settings
[0019] All methods in this experiment are implemented in Python, and are trained and tested on Ubuntu 20.04 system with CUDA version 11.4. The compilation platform used is Pycharm, the deep learning library version used is Pytorch 1.10.1, and the GPU used for training is four RTX 4090s. Four images are calculated on each graphics card, and the number of images in each batch is 16.
[0020] (3) Evaluation index setting
[0021] During the test, this example follows the general provisions of Lvis v1.0
[33] and divides the categories in the dataset into three groups according to the number of training images of each category: rare (1-10 images), common (11-100 images) and frequent (frequent): more than 100 images. Then, the overall AP index of the detector model and the performance AP index on the three groups of rare, common and frequent classes are reported separately. In addition, this example will also report the performance index AP of Mask R-CNN in image segmentation. r , A.P. c , A.P. f .
[0022] Embodiment 1
[0023] After completing the above settings, this embodiment provides a target detection method for long-tail data distribution, such as Figure 1 As shown, the specific steps include:
[0024] Step S110: Determine a baseline model and a decoupled training framework.
[0025] in Figure 2 As the overall training framework of this embodiment, first, this embodiment adopts the classic two-stage target detection method Mask-RCNN as the benchmark model, and adopts the decoupled training framework as the basic training architecture of this embodiment.
[0026] Step S120: Determine static indicators according to the decoupled training framework, and perform rebalanced explicit data enhancement according to the static indicators.
[0027] In the representation learning stage, a simple instance-level data enhancement method is designed, such as Figure 3 In the training phase, this data enhancement method first generates static indicators based on the number distribution of each category in the training set. Considering that in a long-tail distribution data set, some data is obtained by image transformation of other data, and the actual number of images cannot objectively represent the true size of the sample space of each category, this embodiment uses the number of category images N c Mapping as in formula 1-1 is the effective number of class samples Theoretical research shows that the sample features of each category can be classified into two parts: general features and unique features. General features are the common features of the head category and the tail category. Based on this theory, this embodiment adopts a time-progressive sampling frequency design, as shown in formula 1-2, W c It represents the sampling frequency of the data. Indicates that the sampling probability of each category is the same, It means taking the inverse of the static index as the sampling frequency of each category. ρ is a hyperparameter in the interval [0,1] that plays a passivation role. The probability of sampling a category with less data is higher. The value of β is set to 0.9999. The proportion of these two sampling methods changes gradually according to the training rounds: in the early stage of training, balanced sampling is used to facilitate the model to learn the common features of the category through the head category. As the number of training rounds increases, the sampling probability of the tail category is increased to improve the model's ability to model and learn the unique features of the tail category.
[0028]
[0029] In addition, in order to prevent the data enhancement method designed in this embodiment from significantly increasing the training cost, this embodiment does not perform data enhancement before training, but designs an image cache memory queue that can dynamically update and save the number of category images sampled in the last few rounds as source images for data enhancement. The image cache memory queue can effectively collect data information of the tail category and reuse it to generate more new samples. In terms of the selection of data enhancement methods, this embodiment selects the instance-level data enhancement method Copy-paste to generate new samples. Copy-paste can flexibly select the category of the source image, thereby avoiding the introduction of noise from the head category instance.
[0030] Step S130: After completing the rebalanced data enhancement based on static indicators, a detection box generator is designed in the decoupled framework, and explicit data enhancement is performed based on the detection box generator.
[0031] If the training set has a long-tail distribution of data, the RPN module of the common two-stage object detection method may miss the tail category proposal detection box because it cannot well identify the tail category features, resulting in too few samples for the subsequent detection head to learn. In this case, even if data enhancement and resampling schemes are designed before RPN, only a small number of tail category samples can participate in the optimization training of the classification head.
[0032] Based on this, this embodiment starts from the perspective of removing the detection proposal box from relying only on the proposed detection box generated by RPN, and designs and inserts a detection box generator between the backbone network (Backbone) and the proposed detection box alignment module (RoI Align).
[0033] The detection box generator can generate dense detection boxes based on labels online, improving the detection head’s ability to capture tail category features. Figure 4 As shown, during training, the data label label is input into the detection box generator, and the upper left coordinate (x1, y1) and lower right coordinate (x2, y2) of the annotated box are output. The generation method is shown in formula 1-3:
[0034]
[0035] In formula 1-3, η 1, η2, η3, η4 represent the offsets of the original label detection frame in four directions, which obey the normal distribution. In order to prevent the offset from producing low-quality samples due to excessive offset, this embodiment uses a scaling factor τ to scale the offset interval of the offset to a reasonable range. W represents the vertical length of the image label annotation frame, and b represents the generated detection frame vector.
[0036] Step S140: Determine a dynamic rebalancing data generation method to perform data enhancement on the hidden layer of the decoupled training framework.
[0037] Based on the idea of re-parameterization, a dynamic re-balanced data generation method is designed. Hidden layer data enhancement is performed within the method training framework. The model's ability to acquire category features is used to generate new data for training, which has a regularization effect on the method. In addition, this embodiment also designs a dynamic feedback mechanism to monitor and adjust the gain effect of the generation method on the entire method to prevent the generation method from having a negative effect on the method.
[0038] Specifically, the design of the dynamic rebalancing data generation method mainly includes:
[0039] Step S1401: Design an adaptive category feature distribution sampling method.
[0040] The adaptive category feature distribution sampling method includes the design of rebalanced feature distribution sampling method and the design of dynamic feedback adjustment mechanism.
[0041] In the design of the rebalanced feature distribution sampling method, this embodiment selects dynamic and static indicators as the basic sampling probabilities, as shown in Table 6-1. In Table 6-1, this embodiment selects the effective number of static indicator category instances. , and the dynamic index classification score p that can reflect the degree of fit of the classifier to different categories of data c , which can reflect the dynamic indicator classification boundary state of the classifier classification boundary distance γ c As a reference indicator of basic sampling frequency I c These indicators can reflect the model's fitting of different categories of data to a certain extent, and this embodiment controls the characteristic distribution sampling probability of the sample according to the difficulty or situation of fitting models of different categories.
[0042] Table 1-1 Basic sampling probability index I c Select a plan
[0043]
[0044]
[0045] The entire p c represents the classification score calculation formula of category c in softmax form, where f c represents the deep semantic vector output by the target detection algorithm, It is part of the softmax calculation formula. c and y represent the ordinal numbers of this category and other categories respectively.
[0046] For the dynamic index p c For example, since the classification score of the model's classifier cannot be obtained a priori, this embodiment uses the exponential moving average (EMA) method to calculate the classification score of each category in each round of training, as shown in Formula 1-4.
[0047]
[0048] in represents the classification score of the cth category in the tth round, α is the smoothing hyperparameter in the exponential moving average method, and ξ represents the standard hyperparameter of the exponential moving average formula.
[0049] Determine the basis index of category sampling distribution I c After that, this embodiment is carried out by c Perform inverse mapping as in Equation 1-4 and transform it into sampling probability The purpose is to give a larger sampling distribution probability to categories with poor fitting effect or difficult to fit during target detection method training, so that the end-to-end generation method can generate more and richer hidden layer data to input into the final detection head for loss function and gradient calculation, thereby improving the model's sampling modeling ability for tail category sample features and improving the extreme imbalance of gradients during training, so as to achieve the purpose of rebalancing sampling.
[0050]
[0051] Where c represents the category, and C represents the number of foreground categories. If a static indicator is used, such as the effective number of categories, The value of the training epoch is constant, but if the dynamic indicator is selected based on The value of will change dynamically with the iteration of training rounds.
[0052] During the training process, the method of this embodiment will extract a certain number of categories based on the sampling probability, update the feature distribution of these categories according to the sampling of the data generation method designed in the next section, and then generate new data to be sent to the classifier for training, so as to achieve the purpose of supplementing the training samples with poor classifier fitting effect.
[0053] In the design of the dynamic feedback adjustment mechanism, after designing the basic rebalanced feature distribution sampling method architecture, this embodiment also adds a dynamic feedback mechanism. The specific process of the feedback mechanism design is as follows: First, in order to prevent the rebalanced sampling strategy from having a negative impact on the model, during training, the cross entropy loss of the classifier can dynamically reflect the impact of the rebalanced sampling strategy on model training, so this embodiment selects this as a standard and designs a simple feedback adjustment scheme for the rebalanced sampling strategy, as shown in Formula 1-6.
[0054]
[0055] In formula 1-6, It represents the sampling probability after feedback adjustment in each round of training. When the classification loss decreases, it proves that the feature enhancement method designed in this embodiment has a positive effect on the model classifier fitting category features. At this time, the category sampling probability can continue to be increased. On the contrary, if the classification loss increases, it proves that the feature enhancement method designed in this embodiment has a reverse effect, which may cause overfitting of the model. At this time, it is necessary to gradually reduce the sampling probability of the category features.
[0056] In addition, in common data sets with long-tail distributions, many tail categories do not exist in the validation set due to their scarcity. For example, in the typical large long-tail distribution data set Lvis, the training set has a total of 1203 categories, and the validation set has only 871 categories. In order to ensure training stability and to supplement the feedback criteria for the remaining 332 categories, this embodiment designs a category division scheme that divides categories with similar features into the same group, and takes the mean of the classification loss within the group as the sampling probability update criterion for the entire group. The basis for category division is shown in Formula 1-7. This embodiment uses the Fisher ratio d cy As the basis for dividing different categories, the Fisher ratio is equal to the mean difference within the class divided by the means between classes. The larger the Fisher ratio is, the greater the difference between the means of different categories is. At the same time, the smaller the variance within the class is, the more significant the difference in characteristics between classes is.
[0057]
[0058] where μ c represents the mean of the features of category c sampled in each round of training, μ y represents the mean of features of categories other than c sampled in each round of training, σ c and σ yRepresent the standard deviation of category c and other categories respectively.
[0059] Based on the Fisher ratio, this embodiment uses the classic density clustering (Density-Based Spatial Clustering of Applications with Noise, DBSCAN) method to cluster different categories. After clustering is completed, the sampling probability of each group is updated by the mean of the classification loss of all categories in the group during each round of training. Since the update criterion is based on the average loss calculated for multiple categories. This method is less affected by noise, more robust, and helps to better adapt to unbalanced data distribution and improve model performance. The rebalanced sampling strategy plus the dynamic feedback mechanism constitutes the design of the self-use category feature distribution sampling method.
[0060] Step S1402: Design a hidden layer data generation method.
[0061] After building the basic framework of adaptive category feature sampling, this embodiment uses the continuous Gaussian distribution method in the heavy parameter technique to generate hidden layer data. The specific generation method is as follows:
[0062] This embodiment first assumes that the feature distribution of each category is independent and identically distributed (IID), and the confusion matrix of the feature distribution of each category is a diagonal matrix. Under this assumption, the sample diversity can be obtained from C 2 The dimension is reduced to C dimension. Under this premise, the following virtual feature method is designed:
[0063] First, in each round of training, the sampling probability is generated according to the method designed in the previous section. The model samples a certain number of categories based on the sampling probability to update the feature distribution. The sampled features are used to generate the hidden high-level semantic feature vector output by the ROI Align layer of the model. The information of the sampling distribution is the mean and variance of each category feature. Since the process of sampling the hidden feature vector distribution is not differentiable, the feature distribution is not updated through gradient parameters, but through exponential sliding average, as shown in Formula 1-8.
[0064]
[0065] In formula 1-8, m c represents the feature mean of each category stored during the training of the target detection model, v c Represents the variance of each category stored during target detection model training, μ c represents the mean of the category features sampled in each round of training, σ cRepresents the variance of the sampled category features during each round of training. In this embodiment, an additional queue is maintained in the laboratory to store the feature distribution of each category. After sampling the feature distribution of each category, the method inputs a normally distributed Gaussian noise ε, and uses the sampled category feature mean and variance to perform a secondary transformation on the Gaussian noise to generate a new data that conforms to the distribution characteristics of a certain category. The generation method is shown in Formula 1-9, and the virtual data vector generated by this method is expressed as.
[0066] ψ c =m c +ε⊙v c ε∈Ν(0,1),c∈1…C (1-9)
[0067] In formula 1-9, each category distribution is obtained by sampling, and the certainty of the category distribution of the generated data is determined by the mean of the sampled category features. In addition, the richness and uncertainty of the feature distribution of the data are determined by the variance of the feature distribution and the randomness of the normal Gaussian noise. By introducing the heavy parameter technique, richer tail category samples can be generated, and the model's ability to model and extract features of each category sample is improved.
[0068] Embodiment 2
[0069] like Figure 5 As shown, this embodiment provides a target detection system for long-tail distribution of data, which is applied to target detection for long-tail distribution of data, and is used to perform the target detection for long-tail distribution of data of embodiment one, and specifically includes: a framework determination unit 510, a data enhancement unit 520 based on static indicators, a data enhancement unit 530 based on detection frame, and a hidden layer data enhancement unit 540.
[0070] The framework determination unit 510 is used to determine the baseline model and the decoupled training framework.
[0071] in Figure 2 As the overall training framework of this embodiment, first, this embodiment adopts the classic two-stage target detection method Mask-RCNN as the benchmark model, and adopts the decoupled training framework as the basic training architecture of this embodiment.
[0072] The static indicator-based data enhancement unit 520 is used to determine the static indicator according to the decoupled training framework, and perform rebalanced explicit data enhancement according to the static indicator.
[0073] In the representation learning stage, a simple instance-level data enhancement method is designed, such as Figure 3In the training phase, this data enhancement method first generates static indicators based on the number distribution of each category in the training set. Considering that in a long-tail distribution data set, some data is obtained by image transformation of other data, and the actual number of images cannot objectively represent the true size of the sample space of each category, this embodiment uses the number of category images N c Mapping as in formula 1-1 is the effective number of class samples Theoretical research shows that the sample features of each category can be classified into two parts: general features and unique features. General features are the common features of the head category and the tail category. Based on this theory, this embodiment adopts a time-progressive sampling frequency design, as shown in formula 1-2, Indicates that the sampling probability of each category is the same, It means taking the inverse of the static index as the sampling frequency of each category. ρ is a hyperparameter in the interval [0,1] that plays a passivation role. The probability of sampling a category with less data is higher. The weight of these two sampling methods changes gradually according to the training rounds: in the early stage of training, balanced sampling is used to facilitate the model to learn the common features of the category through the head category. As the training rounds increase, the sampling probability of the tail category is increased to improve the model's ability to model and learn the unique features of the tail category.
[0074]
[0075] The value of β is set to 0.9999.
[0076] In addition, in order to prevent the data enhancement method designed in this embodiment from significantly increasing the training cost, this embodiment does not perform data enhancement before training, but designs an image cache memory queue that can dynamically update and save the number of category images sampled in the last few rounds as source images for data enhancement. The image cache memory queue can effectively collect data information of the tail category and reuse it to generate more new samples. In terms of the selection of data enhancement methods, this embodiment selects the instance-level data enhancement method Copy-paste to generate new samples. Copy-paste can flexibly select the category of the source image, thereby avoiding the introduction of noise from the head category instance.
[0077] The detection frame based data enhancement unit 530 is used to design a detection frame generator in a decoupled framework and enhance explicit data according to the detection frame generator.
[0078] If the training set has a long-tail distribution of data, the RPN module of the common two-stage object detection method may miss the tail category proposal detection box because it cannot well identify the tail category features, resulting in too few samples for the subsequent detection head to learn. In this case, even if data enhancement and resampling schemes are designed before RPN, only a small number of tail category samples can participate in the optimization training of the classification head.
[0079] Based on this, this embodiment starts from the perspective of removing the detection proposal box from relying only on the proposed detection box generated by RPN, and designs and inserts a detection box generator between the backbone network (Backbone) and the proposed detection box alignment module (RoI Align).
[0080] The detection box generator can generate dense detection boxes based on labels online, improving the detection head’s ability to capture tail category features. Figure 4 As shown, during training, the upper left coordinates (x1, y1) and lower right coordinates (x2, y2) of the label annotation box are input into the detection box generator, and 16 dense detection boxes can be output. The generation method is shown in formula 2-3:
[0081]
[0082] In formula 1-3, η1, η2, η3, η4 represent the offsets of the original label detection frame in four directions, which obey the normal distribution. In order to prevent the offset from producing low-quality samples due to excessive offset, this embodiment uses a scaling factor τ to scale the offset interval of the offset to a reasonable range. W represents the vertical length of the image label annotation frame, and b represents the generated detection frame vector.
[0083] The hidden layer data enhancement unit 540 is used to determine a dynamic rebalancing data generation method to perform data enhancement on the hidden layer of the decoupled training framework.
[0084] Based on the idea of re-parameterization, a dynamic re-balanced data generation method is designed. Hidden layer data enhancement is performed within the method training framework. The model's ability to acquire category features is used to generate new data for training, which has a regularization effect on the method. In addition, this embodiment also designs a dynamic feedback mechanism to monitor and adjust the gain effect of the generation method on the entire method to prevent the generation method from having a negative effect on the method.
[0085] Specifically, the design of the dynamic rebalancing data generation method mainly includes:
[0086] Step T1: Design an adaptive category feature distribution sampling method.
[0087] The adaptive category feature distribution sampling method includes the design of rebalanced feature distribution sampling method and the design of dynamic feedback adjustment mechanism.
[0088] In the design of the rebalanced feature distribution sampling method, this embodiment selects dynamic and static indicators as the basic sampling probabilities, as shown in Table 2-1. In Table 2-1, this embodiment selects the effective number of static indicator category instances. And the dynamic indicator classification score p that can reflect the degree of fit of the classifier to different categories of data c , which can reflect the dynamic indicator classification boundary state of the classifier classification boundary distance γ c As a reference indicator of basic sampling frequency I c These indicators can reflect the model's fitting of different categories of data to a certain extent, and this embodiment controls the characteristic distribution sampling probability of the sample according to the difficulty or situation of fitting models of different categories.
[0089] Table 2-1 Basic sampling probability index I c Select a plan
[0090]
[0091] For the dynamic index p c For example, since the classification score of the model's classifier cannot be obtained a priori, this embodiment uses the exponential moving average (EMA) method to calculate the classification score of each category in each round of training, as shown in Formula 2-4.
[0092]
[0093] in represents the classification score of the cth category in the tth epoch, α is the smoothing hyperparameter in the exponential moving average method, and ξ represents the standard hyperparameter of the exponential moving average formula.
[0094] Determine the basis index of category sampling distribution I c After that, this embodiment is carried out by c Perform inverse mapping as in Equation 1-4 and transform it into sampling probability The purpose is to give a larger sampling distribution probability to categories with poor fitting effect or difficult to fit during target detection method training, so that the end-to-end generation method can generate more and richer hidden layer data to input into the final detection head for loss function and gradient calculation, thereby improving the model's sampling modeling ability for tail category sample features and improving the extreme imbalance of gradients during training, so as to achieve the purpose of rebalancing sampling.
[0095]
[0096] And in formula 2-5, if a static indicator is used, such as the effective number of categories, The value of the training epoch is constant, but if the dynamic indicator is selected based on The value of will change dynamically with the iteration of training rounds.
[0097] During the training process, the method of this embodiment will extract a certain number of categories based on the sampling probability, update the feature distribution of these categories according to the sampling of the data generation method designed in the next section, and then generate new data to be sent to the classifier for training, so as to achieve the purpose of supplementing the training samples with poor classifier fitting effect.
[0098] In the design of the dynamic feedback adjustment mechanism, after designing the basic rebalanced feature distribution sampling method architecture, this embodiment also adds a dynamic feedback mechanism. The specific process of the feedback mechanism design is as follows: First, in order to prevent the rebalanced sampling strategy from having a negative impact on the model, during training, the cross entropy loss of the classifier can dynamically reflect the impact of the rebalanced sampling strategy on model training, so this embodiment selects this as a standard and designs a simple feedback adjustment scheme for the rebalanced sampling strategy, as shown in Formula 1-6.
[0099]
[0100] In formula 1-6, It represents the sampling probability after feedback adjustment in each round of training. When the classification loss decreases, it proves that the feature enhancement method designed in this embodiment has a positive effect on the model classifier fitting category features. At this time, the category sampling probability can continue to be increased. On the contrary, if the classification loss increases, it proves that the feature enhancement method designed in this embodiment has a reverse effect, which may cause overfitting of the model. At this time, it is necessary to gradually reduce the sampling probability of the category features.
[0101] In addition, in common data sets with long-tail distributions, many tail categories do not exist in the validation set due to their scarcity. For example, in the typical large long-tail distribution data set Lvis, the training set has a total of 1203 categories, and the validation set has only 871 categories. In order to ensure training stability and to supplement the feedback criteria for the remaining 332 categories, this embodiment designs a category division scheme that divides categories with similar features into the same group, and takes the mean of the classification loss within the group as the sampling probability update criterion for the entire group. The basis for category division is shown in Formula 2-7. This embodiment uses the Fisher ratio d cy As the basis for dividing different categories, the Fisher ratio is equal to the mean difference within the class divided by the means between classes. The larger the Fisher ratio is, the greater the difference between the means of different categories is. At the same time, the smaller the variance within the class is, the more significant the difference in characteristics between classes is.
[0102]
[0103] Based on the Fisher ratio, this embodiment uses the classic density clustering (Density-Based Spatial Clustering of Applications with Noise, DBSCAN) method to cluster different categories. After clustering is completed, the sampling probability of each group is updated by the mean of the classification loss of all categories in the group during each round of training. Since the update criterion is based on the average loss calculated for multiple categories. This method is less affected by noise, more robust, and helps to better adapt to unbalanced data distribution and improve model performance. The rebalanced sampling strategy plus the dynamic feedback mechanism constitutes the design of the self-use category feature distribution sampling method.
[0104] Step T2: Design the hidden layer data generation method.
[0105] After building the basic framework of adaptive category feature sampling, this embodiment uses the continuous Gaussian distribution method in the heavy parameter technique to generate hidden layer data. The specific generation method is as follows:
[0106] This embodiment first assumes that the feature distribution of each category is independent and identically distributed (IID), and the confusion matrix of the feature distribution of each category is a diagonal matrix. Under this assumption, the sample diversity can be obtained from C 2 The dimension is reduced to C dimension. Under this premise, the following virtual feature method is designed:
[0107] First, in each round of training, the sampling probability is generated according to the method designed in the previous section. The model samples a certain number of categories based on the sampling probability to update the feature distribution. The sampled features are used to generate the hidden high-level semantic feature vector output by the ROI Align layer of the model. The information of the sampling distribution is the mean and variance of each category feature. Since the process of sampling the hidden feature vector distribution is not differentiable, the feature distribution is not updated through gradient parameters, but through exponential sliding average, as shown in Formula 2-8.
[0108]
[0109] In formula 2-8, m c , v c represents the feature mean and variance of each category stored during target detection model training, μ i , σ iRepresents the mean and variance of the sampled category features in each round of training. In this embodiment, an additional queue is maintained in the laboratory to store the feature distribution of each category. After sampling the feature distribution of each category, the method inputs a normally distributed Gaussian noise ε, and uses the sampled category feature mean and variance to perform a secondary transformation on the Gaussian noise to generate a new data that conforms to the distribution characteristics of a certain category. The generation method is shown in Formula 2-9.
[0110] ψ c =m c +ε⊙v c ε∈Ν(0,1),c∈1…C (2-9)
[0111] In formula 2-9, each category distribution is obtained by sampling, and the certainty of the category distribution of the generated data is determined by the mean of the sampled category features. Moreover, the richness and uncertainty of the feature distribution of the data are determined by the variance of the feature distribution and the randomness of the normal Gaussian noise. By introducing the heavy parameterization technique, richer tail category samples can be generated, and the model's ability to model and extract features of each category sample is improved.
[0112] This application has the following beneficial effects:
[0113] This application proposes three plug-and-play data enhancement and generation methods based on the decoupled training framework: the rebalanced instance data enhancement method (Rebalanced Copy-Paste) for static indicators, the detection box generator method (Box generator), and the dynamic rebalanced data generation method (Rebalanced Feature Generator). The purpose is to design a simple method to effectively optimize the target detection method's ability to represent tail categories in the case of long-tail data distribution and improve the overall performance of the method.
[0114] Although the present application is described with reference to examples, this is for illustrative purposes only and is not intended to limit the present application, and changes, additions and / or deletions to the embodiments may be made without departing from the scope of the present application.
[0115] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A target detection method for long-tail data distribution, characterized in that: The following steps are involved: Determine the baseline model and decoupled training framework; Determine static indicators based on the decoupled training framework and perform rebalanced explicit data augmentation based on the static indicators; After completing the rebalanced data enhancement based on static indicators, a detection box generator is designed in the decoupled framework, and explicit data enhancement is performed based on the detection box generator; After completing the display data enhancement, determine the dynamic rebalancing data generation method to perform data enhancement on the hidden layer of the decoupled training framework.
2. The target detection method for long-tail data distribution according to claim 1, characterized in that: Determine static indicators based on the decoupled training framework, and rebalance explicit data enhancement based on static indicators, including the number of category images N in the training set. c Mapped to the effective number of category samples The value of β is set to 0.9999.
3. The target detection method for long-tail data distribution according to claim 2, characterized in that: It also includes designing an image cache memory queue to save a specified number of category samples that are dynamically updated as source images for data enhancement.
4. The target detection method for long-tail data distribution according to claim 1, characterized in that: Explicit data augmentation based on a detection box generator includes the detection box generator generating a specified number of detection boxes based on a label.
5. The target detection method for long-tail data distribution according to claim 4, characterized in that: In the detection box generator, input the upper left coordinates (x1, y1) and lower right coordinates (x2, y2) of the data label annotation box to generate a specified number of detection boxes, which are specifically expressed as: eta1,eta2,eta3,eta4∈N[0,1]andτ>1 Where η1, η2, η3, η4 represent the offsets of the original label detection box in four directions, which obey the normal distribution, W represents the vertical length of the image label annotation box, b represents the generated detection box vector, and τ represents the scaling factor.
6. A target detection system for long-tail data distribution, characterized in that: Specifically include: A frame determination unit, a data enhancement unit based on static indicators, a data enhancement unit based on detection frames, and a hidden layer data enhancement unit; A framework determination unit, used to determine a baseline model and a decoupled training framework; A data augmentation unit based on static indicators, which is used to determine static indicators according to the decoupled training framework and perform rebalanced explicit data augmentation according to the static indicators; A detection box-based data enhancement unit is used to design a detection box generator in a decoupled framework and enhance explicit data based on the detection box generator; The hidden layer data enhancement unit is used to determine the dynamic rebalancing data generation method and perform data enhancement of the hidden layer of the decoupled training framework.
7. The target detection system for long-tail data distribution according to claim 6, characterized in that: Determine static indicators based on the decoupled training framework, and rebalance explicit data enhancement based on static indicators, including the number of category images N in the training set. c Mapped to the effective number of category samples The value of β is set to 0.9999.
8. The target detection system for long-tail data distribution according to claim 7, characterized in that: The data enhancement unit based on static indicators also includes designing an image cache memory queue to save a specified number of category samples after dynamic update as source images for data enhancement.
9. The target detection method for long-tail data distribution according to claim 6, characterized in that: The detection frame-based data enhancement unit enhances the explicit data according to the detection frame generator, including that the detection frame generator generates a specified number of detection frames based on the label.
10. The target detection system for long-tail data distribution according to claim 9, characterized in that: In the detection box generator, input the upper left coordinates (x1, y1) and lower right coordinates (x2, y2) of the data label annotation box to generate a specified number of detection boxes, which are specifically expressed as: or 1, or 2, or 3, η4∈N[0,1]andτ>1 Where η1, η2, η3, η4 represent the offsets of the original label detection box in four directions, which obey the normal distribution, W represents the vertical length of the image label annotation box, b represents the generated detection box vector, and τ represents the scaling factor.
Citation Information
Patent Citations
Target detection method, computer equipment and storage medium
CN115131552A
Multi-modal post-fusion long-tail category detection method and multi-modal post-fusion long-tail category detection system
CN116977810A
Adaptive threshold NMS multi-target detection method based on long-tail data
CN117636002A
Unmanned aerial vehicle long-tail target detection method
CN118172532A
Network training method and apparatus, target detection method and apparatus, and electronic device
WO2022011892A1
Cited By
Decoupling training-based long-tail radar radiation source signal modulation type identification method and system
CN119474695A
An infrared scene recognition difficulty level label forming method based on tracking performance clustering
CN122906406A
