T HE KFI O U L OSS FOR R OTATED O BJECT D ETECTION
A BSTRACT
Differing from the well-developed horizontal object detection area whereby the computing-friendly IoU based loss is readily adopted and well fits with the detection metrics.
In contrast, rotation detectors often involve a more complicated loss based on SkewIoU which is unfriendly to gradient-based training.
In this paper, we propose an effective approximate SkewIoU loss based on Gaussian modeling and Gaussian product, which mainly consists of two items.
The first term is a scale-insensitive center point loss, which is used to quickly narrow the distance between the center points of the two bounding boxes.
In the distance-independent second term, the product of the Gaussian distributions is adopted to inherently mimic the mechanism of SkewIoU by its definition, and show its alignment with the SkewIoU loss at trend-level within a certain distance (i.e. within 9 pixels).
This is in contrast to recent Gaussian modeling based rotation detectors e.g. GWD loss and KLD loss that involve a human-specified distribution distance metric which require additional hyperparameter tuning that vary across datasets and detectors.
The resulting new loss called KFIoU loss is easier to implement and works better compared with exact SkewIoU loss, thanks to its full differentiability and ability to handle the non-overlapping cases.
We further extend our technique to the 3-D case which also suffers from the same issues as 2-D. Extensive results on various datasets with different base detectors show the effectiveness of our approach.
I NTRODUCTION
i.e. mAP (largely depending on SkewIoU) and regression-based loss e.g. the popular Smooth L1.
See Fig. 3(a) and
Fig. 3(b) for more specific comparison.
Rotated object detection is a relatively emerging but challenging area, due to the difficulties of locating the arbitrary-oriented objects and separating them effectively from the background, such as aerial images (Yang et al., 2018a;
Ding et al., 2019; Yang et al., 2018b; Yang & Yan, 2022), scene text (Jiang et al., 2017; Zhou et al., 2017; Ma et al., 2018).
Though considerable progresses have been recently made, for practical settings, there still exist challenges for rotating objects with large aspect ratio, dense distribution.
The Skew Intersection over Union (SkewIoU) between large aspect ratio objects is sensitive to the deviations of the object positions.
This causes the negative impact of the inconsistency between metric (dominated by SkewIoU) and regression loss (e.g. l n -norms), which is common in horizontal detection, and is further amplified in rotation detection.
The red and orange arrows in Fig.
1 show the inconsistency between SkewIoU and Smooth L1 Loss.
Specifically, when the angle deviation is fixed (red arrow), SkewIoU will decrease sharply as the aspect ratio increases, while the Smooth L1 loss is unchanged (mainly from the angle difference).
Similarly, when SkewIoU does not change (orange arrow), Smooth L1 loss increases as the angle deviation increases.
Solution for inconsistency between the metric and regression loss has been extensively discussed in horizontal detection by using IoU loss and related variants, such as GIoU loss (Rezatofighi et al., 2019) and DIoU loss (Zheng et al., 2020b).
However, the applications of these solutions to rotation detection are blocked because the analytical solution of the SkewIoU calculation process 1 is not easy to be provided due to the complexity of intersection between two rotated boxes (Zhou et al., 2019).
Especially, there exist some custom operations (intersection of two edges and sorting the vertexes etc.)
whose derivative functions have not been implemented in the existing deep learning frameworks (Abadi et al., 2016;
Paszke et al., 2017).
Besides, the calculation of SkewIoU is not differentiable when there are more than eight intersection points between two bounding boxes, i.e. two boundary boxes are completely coincident, or one edge is coincident, which will lead to the failure to obtain very accurate prediction results.
Thus, developing an easyto-implement and fully differentiable approximate SkewIoU loss is meaningful and several works (Chen et al., 2020; Zheng et al., 2020a; Yang et al., 2021c;d) have been proposed.
This paper aims to find an easy-to-implement and better-performing alternative.
We design a novel and effective alternative to SkewIoU loss based on Gaussian product, named KFIoU loss 2 , which can be easily implemented by the existing operations of the deep learning framework without the need for additional acceleration (e.g. C++/CUDA).
Specifically, we convert the rotated bounding box into a Gaussian distribution, which can avoid the well-known boundary discontinuity and squarelike problems (Yang et al., 2021c) in rotation detection.
Then we use a center point loss to narrow the distance between the center of the two Gaussian distributions, follow by calculating the overlap area under the new position through the product of the Gaussian distributions.
By calculating the error variance and comparing the final performance of different methods, we find trend-level alignment with the SkewIoU loss is critical for solving the inconsistency between metric and loss, and further improving the performance.
Furthermore, compared to best-tuned Gaussian distance metric based methods, our proposed method achieves more competitive performance without hyperparameter tuning.
The highlights are as follows:
1) For rotation detection, instead of exactly computing the SkewIoU loss which is tedious and unfriendly to differentiable learning, we propose our easy-to-implement approximate loss, named KFIoU loss, which works better since it is fully differentiable and able to handle the non-overlapping cases.
It follows the protocol of Gaussian modeling for objects, yet innovatively uses Gaussian product to mimic SkewIoU’s computing mechanism within a looser distance.
Compared to Gaussian-based losses (GWD loss, KLD loss) that try to approximate SkewIoU loss by specifying a distance which need extra hyperparameters tuning and metric selection that vary across datasets and detectors, our mechanism level simulation to SkewIoU is more interpretable and natural, and free from hyperparameter tuning.
We also show that KFIoU loss achieves the better trend-level alignment with SkewIoU loss within a certain distance than GWD loss and KLD loss, where the trend deviation is measured by our devised error variance.
The effectiveness of such a trend-level alignment strategy is verified by comparing KFIoU loss with ideal SkewIoU loss.
On extensive benchmarks (aerial images, scene texts, face), our approach also outperforms other best-tuned SOTA alternatives.
We further extend the Gaussian modeling and KFIoU loss from 2-D to 3-D rotation detection, with notable improvement compared with baselines.
To our best knowledge, this is the first 3-D rotation detector
based
on Gaussian modeling which also verifies its effectiveness, which is in contrast to (Yang et al., 2021c d) focusing on 2-D rotation detection. The source code is available at AlphaRotate: https://github.com/yangxue0827/RotationDetection, MMRotate
R ELATED W ORK
Rotated Object Detection.
Rotated object detection is an emerging direction, which attempts to extend classical horizontal detectors (Girshick, 2015; Ren et al., 2015; Lin et al., 2017a;b) to the rotation case by adopting the rotated bounding boxes.
Aerial images and scene text are popular application scenarios of rotation detector.
For aerial images, objects are often arbitrary-oriented and dense-distributed with large aspect ratios.
To this end, ICN (Azimi et al., 2018), ROI-Transformer (Ding et al., 2019), SCRDet (Yang et al., 2019), Mask OBB (Wang et al., 2019), Gliding Vertex (Xu et al., 2020), ReDet (Han et al., 2021b) are two-stage mainstreamed approaches whose pipeline is inherited from Faster RCNN (Ren et al., 2015), while DRN (Pan et al., 2020), DAL (Ming et al., 2021b), R 3 Det
(Yang et al., 2021b), RSDet ( et al., 2021a b) and S [-
-]2 A-Net (Han et al., 2021a) are based on single-stage methods for faster detection speed.
For scene text detection, RRPN (Ma et al., 2018) employs rotated RPN to generate rotated proposals and further perform rotated bounding box regression.
TextBoxes++ (Liao et al., 2018a) adopts vertex regression on SSD (Liu et al., 2016).
RRD (Liao et al., 2018b) improves TextBoxes++ by decoupling classification and bounding box regression on rotation-invariant and rotation sensitive features, respectively.
The regression loss of the above algorithms is rarely SkewIoU loss due to the complexity of implementing SkewIoU.
Variants of IoU-based Loss.
The inconsistency between metric and regression loss is a common issue for both horizontal detection and rotation detection.
Solution for this inconsistency has been extensively discussed in horizontal detection by using IoU related loss.
For instance, Unitbox (Yu et al., 2016) proposes an IoU loss which regresses the four bounds of a predicted box as a whole unit.
More works (Rezatofighi et al., 2019; Zheng et al., 2020b) extend the idea of Unitbox by introducing GIoU (Rezatofighi et al., 2019) and DIoU (Zheng et al., 2020b) for bounding box regression.
However, their applications to rotation detection are blocked due to the hard-to-implement SkewIoU. Recently, some approximate methods for SkewIoU loss have been proposed.
Box/Polygon based:
SCRDet (Yang et al., 2019) propose IoU-Smooth L1, which partly circumvents the need for SkewIoU loss with gradient backpropagation by combining IoU and Smooth L1 loss.
To tackle the uncertainty of convex caused by rotation, the work (Zheng et al., 2020a) proposes a projection operation to estimate the intersection area for both 2-D/3-D object detection.
PolarMask (Xie et al., 2020) proposes Polar
IoU loss that can largely ease the optimization and considerably improve the accuracy.
CFA (Guo et al., 2021) proposes convex hull based CIoU loss for optimization of point based detectors.
Pixel based: PIoU (Chen et al., 2020) calculates the SkewIoU directly by accumulating the contribution of interior overlapping pixels.
Gaussian based:
GWD (Yang et al., 2021c) and KLD
(Yang et al., 2021d) simulate SkewIoU by Gaussian distance measurement.
B ACKGROUND ON G AUSSIAN M ODELING
This section presents the preliminary according to (Yang et al., 2021c), for how to convert an arbitrary-oriented 2-D/3-D bounding box to a Gaussian distribution G ( µ, Σ ) .
[Equation]
1) where R represents the rotation matrix, and Λ represents the diagonal matrix of eigenvalues.
[Table]
[Figure]
[Equation]
  w 2   h 2   l 2  (2)
It is worth noting that the recent works GWD loss (Yang et al., 2021c) and KLD loss
(Yang et al., 2021d) also belong to the Gaussian modeling based.
Compared with our work, their difference is that they use the nonlinear transformation of distribution distance to approximate SkewIoU loss.
In this process, additional hyperparameters are introduced.
Since Gaussian modeling has the natural advantages of being immune to boundary discontinuity and square-like problems, in this paper, we will take another perspective to approximate the SkewIoU loss to better train the detector without any extra hyperparameter, which can be more in line with SkewIoU calculation.
Tab. 1 shows the comparison of properties between different losses.
It should be noted that the results presented in our experiments of GWD loss and KLD loss are obtained by best-tuned hyperparameters in DOTA, but not optimal in others.
P ROPOSED M ETHOD
In this section, we present our main approach.
Fig.
2 shows the approximate process of SkewIoU loss in two-dimensional space based on Gaussian product.
Briefly, we first convert the bounding box to a Gaussian distribution as discussed in Sec. 3, and move the center points of the two Gaussian distributions to make them close.
Then, the distribution function of the overlapping area is obtained by Gaussian product.
Finally, the obtained distribution function is inverted into a rotated bounding box to calculate the overlapping area and the SkewIoU and loss.
4. S KEW I O U BASED ON G AUSSIAN P RODUCT
First of all, we can easily calculate the volume of the corresponding rotating box based on its covariance ( V B ( Σ ) ), when we obtain a new Gaussian distribution:
[Equation]
where n denotes the number of dimensions.
To obtain the final SkewIoU, calculating the area of overlap is critical.
For two Gaussian distributions, N x ( µ 1 , Σ 1 ) and N x ( µ 2 , Σ 2 ) , we use the product of the Gaussian distributions to get the distribution function of the overlapping area:
[Equation]
Note here α is written by:
[Equation]
where µ = µ 1 + K ( µ 2 − µ 1 ) , Σ = Σ 1 − KΣ 1 , and K is the Kalman gain, K = Σ 1 ( Σ 1 + Σ 2 ) − 1 .
We observe that Σ is only related to the covariance ( Σ 1 and Σ 2 ) of the given two Gaussian distributions, which means that no matter how the two Gaussian distributions move, as long as the covariance is fixed, the area calculated by Eq.
3 will not change (distance-independent).
This is obviously not in line with intuition: the overlapping area should be reduced when the two Gaussian distributions are far away.
The main reason is α N x ( µ, Σ ) is not a standard Gaussian distribution (probability sum is not 1), we cannot directly use Σ to calculate the area of the current overlap by
Eq.
without considering α .
Eq.
5 shows that α is related to the distance between the center points ( µ 1 − µ 2 ) of the two Gaussian distributions.
Based on the above findings, we can first use a center point loss L c to narrow the distance between the center of the two Gaussian distributions.
In this way, α can be approximated as a constant, and the introduction of the L c also allows the entire loss to continue to optimize the detector in non-overlapping cases.
Then, calculate the overlap area under the new position by Eq. 3.
According to Fig. 2, overlap area is calculated as follows:
[Equation]
where B 1 , B 2 and B 3 refer to the three different bounding boxes shown in the right part of Fig.
In the appendix, we prove that the upper bounds of KFIoU in n-dimensional space is
[Equation]
For 2-D/3-D detection, the upper bounds are 13 and 1 √ 32 − 1 respectively when n = 2 and n = 3 .
We can easily stretch the range of KFIoU to [0 , 1] by linear transformation according to the upper bound, and then compare it with IoU for consistency.
Fig. 3(a)-3(b) show the curves of five loss forms for two bounding boxes with the same center in different cases.
Note that we have expanded KFIoU by 3 times so that its value range is [0 , 1] like
SkewIoU. Fig. 3(a) depicts the relation between angle difference and loss functions.
Though they all bear monotonicity, obviously the Smooth L1 loss curve is more distinctive.
Fig. 3(b) shows the changes of the five loss under different aspect ratio conditions.
It can be seen that the Smooth L loss of the two bounding boxes are constant (mainly from the angle difference), but other losses will change drastically as the aspect ratio varies.
Regardless of the case in Fig. 3(c), KFIoU loss can maintain the best trend-level alignment with the SkewIoU loss within 5 pixels devariation.
This conclusion still holds at 9 pixels, which is already quite a distance, especially for aerial image.
To further explore the behavior of different approximate SkewIoU losses, we design the metrics of error mean (EMean) and error variance (EVar) as follows:
[Equation]
where EVar measures the trend-level consistency between the designed loss and the SkewIoU loss.
Tab. 1 calculates the EVar of different losses in Fig. 3(c).
In general, EVar L kfiou + L c < EVar L kld <
EVar L gwd < EVar L 1 .
In our analysis, this is probably due to the fundamental inconsistency between the distribution distance as used in GWD/KLD and the definition of similarity in SkewIoU. Moreover, for GWD such inconsistency is more pronouced, because it has no scale invariance under the same IoU, and a case with a larger scale will get a larger loss value, it can greatly magnify its trend inconsistency with SkewIoU loss.
The results in Tab. 1 also verifies our analysis.
In contrast, the calculation process of KFIoU loss is essentially the calculation of the overlap rate, so it does not require hyperparameters and can maintain a high trend-level consistency with SkewIoU loss.
Combined with the corresponding performance on three datasets, smaller EVars tend to have better performance in a general level.
When EVar is small enough, which implies sufficient consistency, the performance difference of different methods (e.g. KLD loss and KFIoU loss) is close.
Therefore, we come to the conclusion that the key to maintaining the consistency between metric and regression loss lies in the trend-level consistency between approximate and exact SkewIoU loss rather than value-level consistency.
The reason why the Gaussian-based losses (e.g. KFIoU loss, KLD loss, GWD loss) outperform the plain SkewIoU loss is due to the advanced parameter optimization mechanism, effective measurement for non-overlapping cases, and complete derivation.
However, the introduction of hyperparameters makes KLD loss and GWD loss less stable than KFIoU loss in terms of Evar and performance.
Compared with GWD and KLD, which use the distribution distance to approximate SkewIoU, KFIoU is physically more reasonable (in line with the calculation process of SkewIoU) and simpler, as well as empirically more effective than best-tuned GWD and
KLD.
In addition, KFIoU implementation is much simpler than plain SkewIoU and can be easily implemented by the existing operations of the deep learning framework.
4. T HE P ROPOSED KFI O U L OSS
We take 2-D object detection as the main example for notation brevity, though our experiments further cover the 3-D case.
We use the one-stage detector RetinaNet (Lin et al., 2017b) as the baseline.
Rotated rectangle is represented by five parameters ( x, y, w, h, θ ).
First, we shall clarify that the network has not changed the output of the original regression branch, that is, it is not directly predicting the parameters of the Gaussian distribution.
The whole training process of detector is summarized as follows: i) predict offset ( t ∗ x , t ∗ y , t ∗ w , t ∗ h , t ∗ θ ); ii) decode prediction box; iii) convert prediction box and target ground-truth into Gaussian distribution; iv) calculate L c and L kf of two
Gaussian distributions.
Therefore, the inference time remains unchanged.
The regression equation of ( x, y, w, h ) is as follows:
[Equation]
where x, y, w, h denote the box’s center coordinates, width and height, respectively.
x, x a , x ∗ are for ground-truth box, anchor box, and predicted box (likewise for y, w, h ).
For the regression of θ , we use two forms as the baselines:
i) Direct regression, marked as Reg.
( ∆ θ ) .
The model directly predicts the angle offset t ∗ θ
[Equation]
ii) Indirect regression, marked as Reg.
∗ ( sin θ , cos θ ) .
The model predicts two vectors ( t ∗ sin θ and t ∗ cos θ ) to match the two targets from the ground truth ( t sin θ and t cos θ ):
[Equation]
To ensure that t ∗ 2sin θ + t ∗ 2cos θ = 1 is satisfied, we will perform the following normalization processing:
[Equation]
The multi-task loss is:
[Equation]
where N and N pos indicates the number of all anchors and that of positive anchors.
b n denotes the n -th predicted bounding box, gt n is the n -th target ground-truth.
G ( · ) is Gaussian transfer function.
t n represents the label of the n -th object, p n is the n -th probability distribution of classes calculated by sigmoid function.
λ 1 , λ 2 control the trade-off and are set to { 0 . 01 , 1 } .
The classification loss
L cls is set as the focal loss (Lin et al., 2017b).
The regression loss is set by L reg =
L c + L kf , where
[Equation]
See more ablation experiments on the functional form of L kf ( Σ 1 , Σ 2 ) in the Appendix.
For center point loss L c , this paper provides two different forms:
The loss adopted in Faster RCNN (Lin et al., 2017a) (default): L c ( t, t ∗ ) =
(cid:80) i ∈ ( x,y ) l n ( t i , t ∗ i ) .
The first term of KLD (Yang et al., 2021d) (advanced), which has an advanced center point optimization mechanism: L c ( µ 1 , µ 2 , Σ 1 ) =
ln (cid:0) ( µ 2 − µ 1 ) ⊤ Σ − 1 1 ( µ 2 − µ 1 ) + 1 (cid:1) .
[Table]
E XPERIMENTS 5. D ATASETS AND I MPLEMENTATION D ETAILS
Aerial image dataset: DOTA (Xia et al., 2018) is one of the largest datasets for oriented object detection in aerial images with three released versions: DOTA-v1.0, DOTA-v1.5 and DOTA-v2.0.
DOTA-v1.0 contains 15 common categories, 2,806 images and 188,282 instances.
DOTA-v1.5 uses the same images as DOTA-v1.0, but extremely small instances (less than 10 pixels) are also annotated.
Moreover, a new category, containing 402,089 instances in total is added in this version.
While DOTA-v2.0 contains 18 common categories, 11,268 images and 1,793,658 instances.
We divide the images into 600 × 600 subimages with an overlap of 150 pixels and scale it to 800 × 800.
HRSC2016 (Liu et al., 2017) contains images from two scenarios with ships on sea and close inshore.
The training, validation and test set include 436, 181 and 444 images.
Scene text dataset: ICDAR2015 (Karatzas et al., 2015) includes 1,000 training images andtesting images.
MSRA-TD500 (Yao et al., 2012) has 300 training images and 200 testing images.
They are popular for oriented scene text detection and spotting.
Face dataset: FDDB (Jain & Learned-Miller, 2010) is a dataset designed for unconstrained face detection, in which faces have a wide variability of face scales, poses, and appearance.
This dataset contains annotations for 5,171 faces in a set of 2,845 images.
We manually use 70%
We use AlphaRotate (Yang et al., 2021e) for main implementation, where many advanced rotation detectors are integrated.
Experiments are performed on a server with GeForce RTX 3090 Ti and 24G memory.
Experiments are initialized by ResNet50 (He et al., 2016) by default unless otherwise specified.
We perform experiments on two aerial benchmarks, two scene text benchmarks and one face benchmark to verify the generality of our techniques.
Weight decay and momentum are set 0.0001 and 0.9, respectively.
We employ MomentumOptimizer over 4 GPUs with a total of 4 images per mini-batch (1 image per GPU).
All the used datasets are trained by 20 epochs, and learning rate is reduced tenfold at 12 epochs and 16 epochs, respectively.
The initial learning rate is 1e-3.
The number of image iterations per epoch for DOTA-v1.0, DOTA-v1.5, DOTA-v2.0, HRSC2016,
ICDAR2015, MSRA-TD500 and FDDB are 54k, 64k, 80k, 10k, 10k, 5k and 4k respectively, and doubled if data augmentation (e.g. random graying and rotation) or multi-scale training are enabled.
KITTI (Geiger et al., 2012) contains 7,481 training and 7,518 testing samples for 3-D object detection.
The training samples are generally divided into the train split (3,712 samples) and the val split (3,769 samples).
The evaluation is classified into Easy, Moderate or Hard according to the object size, occlusion and truncation.
All results are evaluated by the mean average precision with a rotated
IoU threshold 0.7 for cars and 0.5 for pedestrian and cyclists.
To evaluate the model’s performance on KITTI val split, we train our model on the train set and report the results on the val set.
We use PointPillar (Lang et al., 2019) implemented in MMDetection3D (Chen et al., 2019) as the baseline, and the training schedule inherited from SECOND
(Yan et al., 2018): ADAM optimizer with a cosine-shaped cyclic learning rate scheduler that spans 160 epochs.
The learning rate starts from 1e-4 and reaches 1e-3 at the 60th epoch, and then goes down gradually to 1e-7 finally.
In the development phase, the experiments are conducted with a single model for 3-class joint detection.
[Table]
5. A BLATION S TUDY AND F URTHER C OMPARISON
Ablation study on different center point losses.
Tab. 1 compares the two different center point losses proposed in Sec.
4.2 on three versions of DOTA datasets.
Even with the most commonly used L c ( t, t ∗ ) , KFIoU loss achieves competitive performance, significantly better than GWD loss and comparable to KLD loss.
For a fairer comparison, after adopting the same center point loss term as KLD loss L c ( µ 1 , µ 2 , Σ 1 ) , the performance of KFIoU loss is further improved, which is better than KLD loss thanks to a better center point optimization mechanism.
[Table]
Ablation study on various 2-D datasets with different detectors.
Tab. 2 compares Smooth L1 loss and
KFIoU loss by indicators with different
IoU thresholds.
For HRSC2016 containing a large number of ships with large aspect ratios, KFIoU loss has a 9.90% improvement over Smooth L on AP 75 .
For the scene text datasets
MSRA-TD and
ICDAR2015,
KFIoU achieves 7.07% and 3.44% improvements on Hmean 50:95 , reaching 44.96% and 41.17% respectively.
The same conclusion can be reached on FDDB and DOTA-v1.0 datasets.
Ablation study of KFIoU loss on 3D detection.
We generalize the KFIoU loss from 2-D to 3-D, with results in
Tab. 3.
It involves 3-D detection and
BEV detection on KITTI val split, and significant performance improvements are also achieved.
On the moderate level of 3-D detection and BEV detection, KFIoU loss improves PointPillars by 2.43% and 1.98% , respectively.
Comparison with peer methods.
Methods in Tab. 4 are based on the same baseline RetinaNet, and initialized by ResNet50 (He et al., 2016) without using data augmentation and multi-scale training/testing.
They are trained/tested under the same environment and hyperparameters.
These methods are all published solutions to the boundary discontinuity in rotation detection.
First, we conduct ablation experiments on anchor form, rotated bounding box definition form, and angle regression form based on RetinaNet.
Rotating anchors provides accurate prior, which makes the model show strong performance in large aspect ratio objects (e.g. SV, LV, SH).
However, the large number of anchors makes it time-consuming.
Therefore, we use horizontal anchors by default to balance accuracy and speed.
In terms of definition, experiments show that OpenCV definition ( D oc )
(Yang et al., 2019) is slightly better than Long Edge definition ( D le ) (Ma et al., 2018) on the three versions of DOTA.
Angle direct regression (Reg.) always suffers from the boundary discontinuity problem as widely studied recently (Yang & Yan, 2020).
In contrast, angle indirect regression (Reg ∗ .) is a simpler way to avoid above issues and brings performance boost according to Tab. 4. [Table]
PIoU calculates the SkewIoU by accumulating the contribution of interior overlapping pixels but the effect is not significant.
IoU-Smooth L1 partly circumvents the need for SkewIoU loss with gradient backpropagation by combining IoU and Smooth L1 loss.
Although IoU-Smooth L1 has achieved an improvement of 1.26%/0.29%/2.15% on DOTA-v1.0/v1.5/v2.0, the gradient is still dominated by
Smooth L1 but still worse than plain SkewIoU loss.
Modulated Loss and RIL implement ordered and disordered quadrilateral detection respectively, and the more accurate representation makes them both have a considerable performance improvement.
In particular, Modulated Loss achieves the third highest performance on DOTA-v1.5/v2.0.
CSL and DCL convert the angle prediction from regression to classification, cleverly eliminating the boundary discontinuity problem caused by the angle periodicity.
GWD loss, KLD loss and KFIoU loss are three different regression losses based on Gaussian distribution.
The results presented in our experiments of GWD loss and KLD loss are obtained by best-tuned hyperparameters.
In contrast, KFIoU loss is free from hyperparameter tuning and has a more stable performance increase due to a more consistent calculation process with
SkewIoU loss as the center point gets closer.
5. C OMPARISON WITH THE S TATE - OF - THE -A RT
Tab. 5 compares recent detectors on DOTA-v1.0, as categorized by single-, refine-, and two-stage based methods.
Since different methods use different image resolution, network structure, training strategies and various tricks, we cannot make absolutely fair comparisons.
In terms of overall performance, our method has achieved the best performance so far, at around 77.35% / 81.03% / 80.93% .
D ISCUSSION
Limitation.
Note that the Gaussian modeling has a limitation that it cannot be directly applied to quadrilateral/polygon detection (Ming et al., 2021a; Xu et al., 2020) which is also an important task in aerial images, scene text, etc.
In addition, the Gaussian distribution of the square like object is close to the isotropic circle, which is not suitable for the object heading detection.
Conclusion.
We have presented a trend-level consistent approximate to the ideal but gradienttraining unfriendly SkewIoU loss for rotation detection, and we call it KFIoU loss as the product of the Gaussian distributions is adopted to directly mimic the computing mechanism of SkewIoU loss by definition.
This design differs from the distribution distance based losses including GWD loss and KLD loss which in our analysis have fundamental difficulty in achieving trend-level alignment with SkewIoU loss without tuning hyperparameters.
Moreover, KFIoU is easier to implement and works better than plain SkewIoU due to the effective measurement for non-overlapping cases and complete derivation.
Experimental results on both 2D and 3D cases, on various datasets, show the effectiveness of our approach.
Acknowledgments.
The work was in part supported by National Key Research and Development
Program of China (2020AAA0107600), National Natural Science Foundation of China (62222607), and Shanghai Municipal Science and Technology Major Project (2021SHZDZX0102).
A P ROOF OF KFI O U U PPER B OUND
For an n-dimensional Gaussian distribution its volume is:
[Equation]
For Σ kf we have
[Equation]
According to Minkowski’s inequality:
[Equation]
Simultaneous mean inequalities:
[Equation]
[Table]
Thus:
[Equation]
and
[Equation]
Combine the mean inequalities again:
[Equation]
According to Eq.
[Equation]
we have
[Equation]
Therefore, the upper bound of KFIoU is
[Equation]
When n = 2 and n = 3 , the upper bounds are 13 and 1 √ 32 − 1 respectively.
B S UPPLEMENTARY E XPERIMENT
Ablation study of three forms of KFIoU loss on two detectors.
We use two different detectors and three different KFIoU based loss functions to verify its effectiveness, as shown in Tab. 6.
RetinaNetbased detector will have a large number of low-SkewIoU prediction bounding box in the early stage of training, and will produce very large loss after the log function, which weakens the improvement of the model.
Compared with the linear function, the derivative of the exp -based function will pay more attention to the training of difficult samples, so it has a higher performance, at 70.64% .
In contrast, R 3 Det-based detector can generate high-quality prediction box at the beginning of training by adding refinement stages, so it will not suffer the same troubles as RetinaNet.
Due to the same mechanism of focusing on difficult samples, log and exp -based functions are both better than linear functions, and the best performance is achieved on the log -based function, about 72.28% .
We also expand KFIoU by 3 times to make its range truly consistent with the IoU loss, at [0 , 1] .
However, this consistency do not bring any additional gains, so the following experiments are all use the KFIoU before non-expansion.
Ablation study of training strategies and tricks.
We reimplement KFIoU based on the more powerful benchmark, MMRotate (Zhou et al., 2022).
We use a single GeForce RTX 3090 Ti with a total batch size of 2 for training.
For ResNet (He et al., 2016), SGD optimizer is adopted with an initial learning rate of 0.0025.
The momentum and weight decay are 0.9 and 0.0001, respectively.
For Swin Transformer (Liu et al., 2021), AdamW (Kingma & Ba, 2014; Loshchilov & Hutter, 2018) optimizer is adopted with an initial learning rate of 0.0001.
The weight decay is 0.05.
In addition, we adopt learning rate warmup for 500 iterations, and the learning rate is divided by 10 at each decay step.
Tab.
7 performs ablation experiments on four detectors: RetinaNet (Lin et al., 2017b),
S 2 A-Net
(Han et al., 2021a), R 3 Det
(Yang et al., 2021b), and RoI Transformer (Ding et al., 2019).
[Table]
[Figure]
The experimental results prove that KFIoU can stably enhance the performance of the detector.
In order to further improve the performance of the model on DOTA, we verified many commonly used training strategies and tricks, including backbone, training schedule, data augmentation and multiscale training and testing, as shown in Tab. 7.
C V ISUALIZATION
Fig.
4 ad Fig.
5 show the visual comparison of three different loss functions on the different kinds of datasets.
Compared with Smooth L1 Loss, KFIoU loss is significantly better.
D T REND C ONSISTENCY S IMULATION
Fig. 6(a) and Fig.
6(b) show the impact of center deviation and object scale on the trend consistency of each loss function.
Note that each data in the figure is calculated from the average of 1, random aspect ratio and rotation angle examples.
Two conclusions can be drawn: i) the smaller the center deviation, the better trend consistency of the KFIoU loss; ii) KLD loss and KFIoU loss are insensitive to scale changes.
[Figure]