Analysis on the Sensitivity of Object Detection Models to Bounding Box Areas and Solution
Symptom
In an object detection task, different bounding boxes in an image have different sizes. Some datasets contain a large number of small objects, whereas some other datasets contain a large number of large objects, which can be reflected by the sensitivity to bounding box areas. An area ratio indicates the ratio of the area of a bounding box to the area of the image. A larger area ratio indicates a larger ratio of the object to the image. The following figure shows the large area ratio of small objects to an image.
Object detection models have different detection effects for datasets with different area ratios. You are advised to refer to the following algorithms and technical description to understand how to reduce the sensitivity of object detection models to bounding box areas.
Solution
Object detection involves multi-task training. In addition to accurate class identification, class instances need to be accurately located. The model training loss includes the class loss and bounding box loss. The most common bounding box loss is the Smooth L1 loss. The calculation formula is as follows:
The balanced loss was first proposed in Libra R-CNN. Compared with the traditional Smooth L1 loss, the balanced loss has a more smooth curve and better convergence. The specific calculation formula and derivation formula are as follows:

Compared with the Smooth L1 loss, the balanced loss has a slightly larger gradient at the boundary of inliers. A smaller Alpha value means more obvious increase. In this way, the balanced loss can increase the probability of identifying positive samples during the update of the model reverse gradient.
Graph (a) shows the reciprocal relationship, and graph (b) shows the loss relationship (from Libra R-CNN).
Verification
The open source dataset Canine Coccidiosis Parasite is used for verification. The dataset has only one class. Before the balanced loss is used, Table 1 describes the sensitivity of a model to the bounding box area after the model is trained and evaluated.
|
Feature Distribution |
coccidia |
|---|---|
|
0% - 20% |
0.5806 |
|
20% - 40% |
0.871 |
|
40% - 60% |
0.9677 |
|
60% - 80% |
0.9677 |
|
80% - 100% |
1 |
|
Standard deviation |
0.1546 |
After the balanced loss is used, Table 2 describes the sensitivity of a model to the bounding box area after the model is trained and evaluated.
The balanced loss reduces the area sensitivity from 0.1546 to 0.0912.
Suggestions
In the model inference result, if the detected classes are very sensitive to the areas of bounding boxes, you are advised to use the balanced loss for model optimization and enhancement during training.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.