Long-tail target detection system and method based on double-balanced category reweighting

Through double-balanced category reweighting and feature balancing loss function, the problem of sample imbalance and difficulty neglect in long-tail target detection is solved, effective attention to rare categories and difficult samples is achieved, and detection performance and robustness are improved. .

CN118298466BActive Publication Date: 2024-10-11YUNNAN HIGHWAY SCI & TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410591141.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-13
Publication Date
2024-10-11
Estimated Expiration
2044-05-13

AI Technical Summary

Technical Problem

When existing long-tail target detection methods solve the problem of data sample imbalance, they focus more on the tail categories and ignore the difficulty of the samples, resulting in the model overfitting the simple samples in the tail and underfitting the difficult samples in the head, and data enhancement. The method fails to effectively consider sample validity, which increases computational resources and time costs.

Method used

The method of double-balanced category re-weighting is used to increase attention to rare categories and difficult samples through data balance enhancement and feature balance loss functions, achieve double-balanced control of the number and difficulty of training samples, and create a model for training target detection images, and dynamically adjust the loss weight during model training, combining the number of samples and difficulty.

Benefits of technology

It improves the model's feature learning ability for rare categories, reduces redundant samples and invalid samples, improves detection performance and robustness, and improves the sample imbalance problem of the data set.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118298466B_ABST
    Figure CN118298466B_ABST
Patent Text Reader

Abstract

The present invention discloses a long-tail target detection system and method based on dual-balanced category reweighting, the method comprising the following steps: creating an image for training a target detection model, specifically including: obtaining a main image and an auxiliary image; obtaining an initial label and an initial bounding box image in the auxiliary image; screening the initial label and the initial bounding box image to obtain an application label and an application bounding box diagram; pasting the application bounding box image into the main image, adding the application label to the main image, and obtaining an image for training the target detection model. The long-tail target detection method based on dual-balanced category reweighting provided by the present invention makes up for the gap between long-tail data by increasing samples of the tail category. This method can provide more effective training samples for the model, thereby helping the model to better learn the characteristics of rare categories.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer vision, and in particular relates to a long-tail target detection system and method based on double-balanced category reweighting. Background Art

[0002] Long-tail object detection is an important task in the field of computer vision, mainly used to solve the problem of unbalanced distribution of target categories in real scenes. In many practical applications, a few categories often contain most of the sample labels, while most categories only contain a few sample labels, resulting in a long-tail distribution of data.

[0003] Among the existing long-tail object detection methods, the main method to solve the problem of data sample imbalance in object detection is through resampling and reweighting. Resampling is to randomly delete some samples in the head data (categories with a large number), copy or generate some samples in the tail data (categories with a small number), and design a special sample sampling strategy to undersample the head category and oversample the tail category to make the number of samples of different categories more balanced. However, this may cause the loss of head data information and too much redundant invalid data in the tail data. Reweighting gives different weights to different categories, so that the categories with a small number have a larger weight in the loss function, thereby emphasizing the learning of tail data. However, according to our observations. The amount of data is a necessary but insufficient condition for solving the problem of long-tail object detection. These methods are based on the same design concept: pay more attention to the tail category and less attention to the head category, ignoring that the difficulty of the sample is also a key factor affecting long-tail object detection. This causes the model to overfit the simple samples at the tail and underfit the difficult samples at the head.

[0004] In addition, the root problem of long-tail object detection is the lack of data. In real-world scenarios, data augmentation is mainly used to make up for the lack of data samples. Although existing data augmentation methods can increase the number of samples and the diversity of scenarios, these methods enhance all samples equally, not only without considering whether the samples themselves need data augmentation, but also without considering the effectiveness of the enhanced samples, resulting in a large number of redundant and invalid samples in the training samples. This not only consumes a lot of computing resources and time costs, but also makes it more difficult for the model to learn consistent target features. Summary of the invention

[0005] The present invention provides a long-tail target detection system and method based on double balanced category reweighting, which increases the model's attention to rare categories and difficult samples through data balance enhancement and feature balance loss, realizes the model's double balanced regulation of the quantity balance and difficulty balance of training samples, and greatly improves the performance of existing long-tail target detection.

[0006] The present invention is achieved through the following technical solutions:

[0007] On the one hand, the present invention provides a long-tail target detection method based on double balanced category reweighting, comprising the following steps: creating an image for training a target detection model, specifically including: obtaining a main image and an auxiliary image; obtaining an initial label and an initial bounding box image in the auxiliary image; filtering the initial label and the initial bounding box image to obtain an application label and an application bounding box image; pasting the application bounding box image into the main image, adding the application label to the main image, and obtaining an image for training the target detection model.

[0008] In some of the embodiments, screening the initial label and the initial bounding box image to obtain the applied label and the applied bounding box image includes a primary screening, and the primary screening includes at least one of the following steps: performing a scale transformation on the initial label and the initial bounding box image; performing a head constraint processing on the initial label and the initial bounding box image.

[0009] In some of the embodiments, in the step of screening the initial label and the initial bounding box image to obtain the application label and the application bounding box image, after the initial screening, the step further includes: calculating the occlusion rate between the label position after the initial screening and the label position of the main image; and screening again according to the size of the occlusion rate to obtain the application label and the application bounding box image.

[0010] In some of the embodiments, after screening the initial label and the initial bounding box image to obtain the applied label and the applied bounding box image, pasting the applied bounding box image into the main image, adding the applied label to the main image, and before obtaining the image for training the target detection model, the method also includes: deleting the content of the main image at the location where the applied bounding box image is to be pasted.

[0011] In some of the embodiments, in the process of acquiring the main image and the auxiliary image, two training images are randomly selected, and the two training images are respectively used as the main image and the auxiliary image.

[0012] In some embodiments, after creating the image for training the object detection model, the process further includes:

[0013] The target detection model is trained, and the feature balance loss function during the training process is:

[0014]

[0015]

[0016]

[0017] Among them, N c Indicates the number of samples in the cth class, N minIndicates the value with the least number of samples among all categories, N max is the value with the largest number of samples in all categories, N mean is the average value of all sample numbers, and the sample mean is used as the critical value to determine the loss weight of each category; σ represents the scale mapping function; p t Represents the confidence score of the prediction box; s γ represents the balance factor; w α Represents the weight coefficient, w α ∈[0,1].

[0018] On the other hand, an embodiment of the present application provides a long-tail target detection system based on dual balanced category reweighting, including a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the computer program to implement any of the long-tail target detection methods based on dual balanced category reweighting of the above embodiments.

[0019] An embodiment of the present application also provides a computer storage medium on which a computer program is stored. The computer program is loaded by a processing module to implement the long-tail target detection method based on double balanced category reweighting of any one of the above embodiments.

[0020] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0021] The long-tail object detection method based on double-balanced category reweighting provided by the present invention makes up for the gap between long-tail data by increasing the samples of the tail category. This method can provide more effective training samples for the model, thereby helping the model to better learn the characteristics of rare categories. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 A schematic flow chart of a long-tail target detection method based on double-balanced category reweighting provided in some embodiments of the present invention;

[0024] Figure 2 A schematic diagram of the effect of a long-tail target detection method based on double-balanced category reweighting provided in some embodiments of the present invention. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0026] In the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc. used to indicate the orientation or position relationship are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship commonly placed when the product of the invention is used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0027] In addition, if the terms "horizontal" or "vertical" appear in the description of the present invention, it does not mean that the components are required to be absolutely horizontal or suspended, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", and does not mean that the structure must be completely horizontal, but can be slightly tilted.

[0028] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0029] The terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other steps or modules that are inherent to these processes, methods, products, or devices.

[0030] On the one hand, this embodiment provides a long-tail target detection method based on dual-balanced category reweighting, which mainly includes the following steps:

[0031] Create images for training the target detection model. In the data preprocessing stage, a data balancing enhancement method is established to create new images for training the target detection model to make up for the lack of effective samples at the tail. Figure 1 , this step may specifically include:

[0032] Obtaining the main image and auxiliary image. In this step, two training images are selected, one of which is used as the main image and the other as the auxiliary image.

[0033] Get the initial label and initial bounding box images in the auxiliary image.

[0034] The initial label and the initial bounding box image are filtered to obtain the applied label and the applied bounding box image. In this step, the bounding box image filtered out in the auxiliary image is copied to a suitable position in the main image through filtering.

[0035] Paste the application bounding box image into the main image and add the application label to the main image to obtain the image used to train the object detection model.

[0036] In some embodiments, screening the initial label and the initial bounding box image to obtain the applied label and the applied bounding box image includes a primary screening, and the primary screening includes at least one of the following steps:

[0037] Scale the initial label and initial bounding box images;

[0038] Perform head constraints on the initial label and initial bounding box images.

[0039] In the above embodiment, when only one of the steps is adopted, the adopted step can also be considered as the initial screening step. On the other hand, the label and bounding box image obtained after the initial screening can also be considered as the applied label and the applied bounding box image.

[0040] In some embodiments, in the step of screening the initial label and the initial bounding box image to obtain the application label and the application bounding box image, after the initial screening, the step further includes:

[0041] Calculate the occlusion rate between the label position after the initial screening and the label position of the main image;

[0042] According to the size of the occlusion rate, the application label and application bounding box images are filtered again.

[0043] In some embodiments, after screening the initial label and the initial bounding box image to obtain the applied label and the applied bounding box image, pasting the applied bounding box image into the main image, adding the applied label to the main image, and obtaining the image for training the target detection model, the method further includes:

[0044] Delete the contents of the main image where you will paste the bounding box image you applied.

[0045] In the above embodiment, the corresponding content in the main image is deleted so that the content in the auxiliary image is pasted to the location.

[0046] In some of the embodiments, in the process of acquiring the main image and the auxiliary image, two training images are randomly selected, and the two training images are respectively used as the main image and the auxiliary image.

[0047] In the above embodiment, by randomly acquiring two training images as the main image and the auxiliary image, the acquisition process can be made simpler. In other embodiments, the two acquired training images can be two designated training images, or two training images with other screening conditions.

[0048] For example, after all the image instances and corresponding labels in the auxiliary image are scaled, occlusion rate calculated, and head constrained, the best image and label that meet the enhancement requirements are obtained. Then these image instances are pasted into the main image, and the corresponding label data is also added to the label of the main image. The pasted main image is used as new training data.

[0049] In the data preprocessing stage, in order to effectively increase the tail sample data and balance the sample distribution, a data balance enhancement method is proposed. The method specifically includes: and y represent the training images and labels respectively. The purpose of BalanceCopy is to use two training samples (x A ,y A ) and (x B ,y B ) Generate a new training sample A is the main image and B is the auxiliary image. The main function of Balance Copy is to copy the bounding box image selected from the auxiliary image to the appropriate position in the main image after data constraints. The enhancement formula is defined as:

[0050]

[0051]

[0052]

[0053] in, It is a data constraint function, which mainly performs scale transformation (St) and head constraint (Hc) on the bounding box image and label in the auxiliary image to filter out the label and bounding box image suitable for copying to the main image. The function of the head constraint is to suppress the head category with a large number of samples and only copy the tail category with a small number of samples to narrow the gap between the tail data volume and the head data volume. The Φ function calculates the occlusion ratio (Or) between the filtered label position and the main image label position, and filters out the appropriate label and bounding box image according to the size of the occlusion ratio. (x λ ,y λ ) represents the labels and ground-truth box images in the auxiliary image that can be copied in the main image. M∈{0,1} W×H is a binary mask that indicates the locations in the main image to be deleted (the deleted locations are the locations where the bounding box image needs to be pasted). ⊙ represents element-wise multiplication. It is a new image generated after Balance Copy, which contains the main image and the bounding box image after pasting. It is the label of the new image generated by Balance Copy, including the original label of the main image and the pasted label.

[0054] In each iteration of training, two training samples are randomly selected and combined into a Balance Copy sample using formula (1). like Figure 2 As shown in the figure, through a series of processing steps such as scale transformation, head constraint, and occlusion rate calculation, the bounding box image and label to be copied are obtained. Scale transformation and head constraint are designed to increase the diversity of samples and reduce the long-tail gap between samples. The calculation of occlusion rate is to prevent the label from being completely covered, and moderate occlusion can increase the complexity of the training scene. After data balancing enhancement, not only the number of effective samples at the tail is compensated, but also the imbalance problem of data set samples is improved.

[0055] In some embodiments, after creating the image for training the object detection model, the process further includes:

[0056] The target detection model is trained, and the feature balance loss function during the training process is:

[0057]

[0058]

[0059]

[0060] Among them, Nc Indicates the number of samples in the cth class, N min Indicates the value with the least number of samples among all categories, N max is the value with the largest number of samples in all categories, N mean is the average value of all sample numbers, and the sample mean is used as the critical value to determine the loss weight of each category; σ represents the scale mapping function; p t Represents the confidence score of the prediction box; s γ represents the balance factor; w α Represents the weight coefficient, w α ∈[0,1].

[0061] Through the settings in the above embodiments, in the model training stage, the loss weight is dynamically adjusted according to the number of samples and the difficulty of the samples, and appropriate importance is given to samples of different difficulty levels. This can not only improve the detection performance of the model for the tail category, but also increase the attention to difficult samples and improve its discrimination ability. By designing a new feature balance loss function, the association between the number of samples and the difficulty of the samples is established, and a balance factor proportional to the number of effective samples is introduced. The weight relationship between the samples is adaptively regulated by the balance factor, so that each sample has its own loss contribution. Through such a design, the model can better handle sample data with long-tail distribution, which improves the robustness and generalization performance of the model.

[0062] During the model training phase, it was found that in the long-tail object detection task, the detection effect does not only depend on the number of samples, but is also closely related to the detection difficulty of the samples. In order to combine the number of samples and the difficulty of the samples, a feature balance loss function is proposed. The specific calculation formula is as follows:

[0063]

[0064]

[0065]

[0066] Where N c Indicates the number of samples in the cth class, N min Indicates the value with the least number of samples among all categories, N max is the value with the largest number of samples in all categories, N mean is the average value of all sample numbers, and the sample mean is used as the critical value to determine the loss weight of each category. σ is the scale mapping function, which is positively correlated with the number of samples. The parameter p t Represents the confidence score of the predicted box. Balance factor s γ It is obtained by weighting the effective samples of each category, and the exponential weight of the difficulty of each sample is reflected by the proportion of each category.γ is determined by the sample size and will increase as the sample size increases. γ The increase of , the faster the loss gradient of the corresponding category decreases, which means that more attention will be paid to difficult samples when training the model. α ∈[0,1] is obtained by inversely weighting the valid samples of the category and then normalizing them with sigmoid to obtain the loss weight corresponding to each category. The weight coefficient plays a key role in regulating the balance between categories. It assigns a larger weight factor to rare categories to increase their contribution in the loss function.

[0067] The weight coefficient and the balance factor together constitute the adjustment factor for the correlation between the number of samples and the difficulty of samples in the double balanced loss. It enables the classifier to dynamically adjust the loss contribution of samples according to the number of samples and the difficulty of samples. Especially for data sets with an unbalanced distribution of sample numbers, the balance factor can be used to suppress the over-optimization of easy samples at the tail and make up for the under-optimization of difficult samples at the head.

[0068] In specific application scenarios, the long-tail target detection method based on double-balanced category reweighting can be used in smart transportation, medical imaging, autonomous driving and other fields. It is also suitable for target detection in various practical applications with imbalanced data.

[0069] On the other hand, an embodiment of the present application provides a long-tail target detection system based on dual balanced category reweighting, including a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the computer program to implement any of the long-tail target detection methods based on dual balanced category reweighting of the above embodiments.

[0070] An embodiment of the present application also provides a computer storage medium on which a computer program is stored. The computer program is loaded by a processing module to implement the long-tail target detection method based on double balanced category reweighting of any one of the above embodiments.

[0071] The above description is only a preferred embodiment of the present invention and does not constitute any limitation to the present invention. Any simple modification or equivalent changes made to the above embodiments based on the technical essence of the present invention shall fall within the protection scope of the present invention.

Claims

1. A long-tail object detection method based on double-balanced category reweighting, It is characterized in that The following steps are involved: Create images for training object detection models, including: Obtaining primary and secondary images; Get the initial label and initial bounding box image in the auxiliary image; Filter the initial label and the initial bounding box image to obtain the application label and the application bounding box image; Paste the application bounding box image into the main image, add the application label to the main image, and obtain the image for training the object detection model; After creating the images for training the object detection model, it also includes: The target detection model is trained, and the feature balance loss function during the training process is: in, represents the number of samples in the cth class, Indicates the value with the least number of samples among all categories. is the value with the largest number of samples in all categories, It is the average value of all sample numbers, and the sample mean is used as the critical value to determine the loss weight of each category; represents the scale mapping function; Represents the confidence score of the prediction box; represents the balance factor; represents the weight coefficient, .

2. The long-tail target detection method based on double-balanced category reweighting according to claim 1, It is characterized in that Screening the initial label and the initial bounding box image to obtain the applied label and the applied bounding box image includes a primary screening, and the primary screening includes at least one of the following steps: Scale the initial label and initial bounding box images; Perform head constraints on the initial label and initial bounding box images.

3. The long-tail target detection method based on double-balanced category reweighting according to claim 2, It is characterized in that In the step of filtering the initial label and the initial bounding box image to obtain the applied label and the applied bounding box image, after the initial filtering, the following steps are further included: Calculate the occlusion rate between the label position after the initial screening and the label position of the main image; According to the size of the occlusion rate, the application label and application bounding box images are filtered again.

4. The long-tail target detection method based on double-balanced category reweighting according to claim 1, It is characterized in that After filtering the initial label and the initial bounding box image to obtain the applied label and the applied bounding box image, the applied bounding box image is pasted into the main image, and the applied label is added to the main image. Before obtaining the image for training the target detection model, the following steps are also included: Delete the contents of the main image where you will paste the bounding box image you applied.

5. The long-tail target detection method based on double-balanced category reweighting according to claim 1, It is characterized in that In the process of obtaining the main image and the auxiliary image, two training images are randomly selected, and the two training images are used as the main image and the auxiliary image respectively.

6. A long-tail object detection system based on double-balanced category reweighting, It is characterized in that It comprises a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the long-tail target detection method based on double-balanced category reweighting as described in any one of claims 1 to 5.