P OLAR N ET : L EARNING TO O PTIMIZE P OLAR K EYPOINTS FOR K EYPOINT B ASED O BJECT D ETECTION
Anonymous authors
Paper under double-blind review
A BSTRACT
A variety of anchor-free object detectors have been actively proposed as possible alternatives to the mainstream anchor-based detectors that often rely on complicated design of anchor boxes.
Despite achieving promising performance at par with anchor-based detectors, the existing anchor-free detectors such as FCOS or CenterNet predict objects based on standard Cartesian coordinates, which often yield poor quality keypoints.
Further, the bounding box regression is also scale-sensitive.
In this paper, we propose a new anchor-free keypoint based detector “PolarNet”, where keypoints are represented as a set of Polar coordinates instead of Cartesian coordinates.
The “PolarNet” detector learns offsets pointing to the corners of objects in order to learn high quality keypoints.
Additionally, PolarNet uses corner points to localize objects, making the localization scale-insensitive.
Finally in our experiments, we show that PolarNet, an anchor-free detector, outperforms the existing anchor-free detectors, and is able to achieve highly competitive result on
COCO test-dev benchmark ( 48 . 0% AP under the single-model single-scale testing) which is at par with the state-of-the-art two-stage anchor-based object detectors.
I NTRODUCTION
Deep learning based object detection techniques have achieved remarkable success in many real-world applications (Krizhevsky et al., 2012;
He et al., 2016; Goodfellow et al., 2016).
The mainstream state-of-the-art detectors are often based on the anchor-based detection methods (Ren et al., 2015;
Redmon & Farhadi, 2016; Girshick, 2015; Lin et al., 2017b), which heavily rely on the design and selection of appropriate anchor boxes , namely a set of predeﬁned bounding boxes of a certain height and width, to capture various scales and aspect ratios of different object classes for detection.
Unlike the anchor-based detectors, the anchor-free detectors have emerged recently as a promising direction for object detection that eliminates the need of manually designing anchor boxes (Zhu et al., 2019;
Tian et al., 2019; Law & Deng, 2018; Duan et al., 2019).
In literature, a variety of anchor-free object detectors have been proposed based on different object modeling strategies.
Figure 1 (a)-(e) gives examples comparing ﬁve popular anchor-free detectors from the perspective of object modeling.
For example, CornerNet (Law & Deng, 2018) was proposed for detecting objects using a pair of corner points.
Instead of using two corners, CenterNet (Zhou et al., 2019a) proposed modeling an object as one center point of its bounding box.
Besides these, there are also a number of other anchor-free detectors that extend these ideas of Corner-based or
Centerness-based or various other keypoint design strategies to improve the detection performance.
FSAF (Zhu et al., 2019) and FCOS (Tian et al., 2019) predict objects by learning the offsets to the boundary from sampled keypoints.
FCOS (Tian et al., 2019) uses many keypoints by treating every pixel as a keypoint, while FSAF (Zhu et al., 2019) samples a set of multiple keypoints from the center region to eliminate points near the boundary.
Among keypoint based object detection, two different strategies are commonly adopted.
One is keypoint position based (determining the bounding box by the position of the keypoints) such
CornerNet (Law & Deng, 2018) and CenterNet (Duan et al., 2019).
The other is keypoint offsets based(determining the bounding box by learning offsets from keypoints) such as FSAF (Zhu et al., 2019), CenterNet (Zhou et al., 2019a)
FCOS (Tian et al., 2019).
Compared to the keypoint position based methods, keypoint offset based methods are able to better capture contextual information about the objects, and are thus more commonly used to design detectors.
[Figure]
However, existing object modeling strategies for keypoint offset based methods may be sub-optimal.
Most existing anchor-free detectors such as FCOS (Tian et al., 2019) are based on Cartesian coordinates, which learn offsets to the boundary of objects.
However, this kind of design yields a lot of poor quality keypoints.
These points are near the boundary with extremely large variance of offsets (See
Figure 1(e)).
Besides, the bounding box prediction is based on the prediction of these offsets, which is scale-sensitive.
Our goal is to have an anchor-free detector, that can avoid poor quality keypoints, and is able to simultaneously learn scale-insensitive feature for bounding box regression.
To achieve this goal, in this paper, we propose a new keypoint based object detector named “PolarNet”, which learns keypoints based on polar coordinates.
Figure 1 (f) illustrates the idea of the proposed PolarNet compared to the other anchor-free detectors.
The set of keypoints is represented by polar coordinates to avoid large variance of offsets.
And the corner points in PolarNet are also used to localize objects, which is scale-invariant.
The key contributions of this work are:
• We introduce a uniﬁed view of keypoint based object detection for understanding popular anchor-free object detectors, in which many popular anchor-free object detectors can be viewed as a special case of keypoint based detectors with different object modeling strategies; • We propose a new anchor-free object detector named “PolarNet” which present keypoints based on polar coordinates which enables learning of better quality keypoints by reducing the variance of learned offsets compared to the existing approaches.
• We conduct experiments to evaluate the performance of our PolarNet detector on the
COCO benchmark, in which our results show that PolarNet outperforms all the existing anchor-free detectors, and is able to achieve highly competitive results better or on par with the state-of-the-art two-stage anchor-based detectors on COCO test-dev ( 48 . 0% AP with DCNv2-ResNeXt-101 backbone on COCO test-dev under single-model single-scale settings).
Our source code and models will be released publicly upon acceptance.
The rest of this paper is organized as follows.
Section 2 reviews two major categories of related work in deep-learning based object detection: popular anchor-based detectors and recent anchor-free detectors.
Section 3 presents the proposed PolarNet detector in detail.
Section 4 discusses our experimental results and analysis, and Section 5 concludes this paper.
R ELATED W ORK
In this section, we brieﬂy review two major groups of related work in the literature of deep-learning based object detection approaches: the mainstream family of anchor-based object detection methods and the emerging family of anchor-free object detection methods.
We refer readers to more extensive surveys of deep-learning based object detection studies in (Liu et al., 2020; Wu et al., 2020).
2. A NCHOR - BASED O BJECT D ETECTION
The methods in this group represent the mainstream detectors widely used in many real-world applications.
They can be broadly categorized into two groups: two-stage detectors (Ren et al., 2015; Girshick et al., 2014; Girshick, 2015) and one-stage detectors (Liu et al., 2016;
Zhang et al., 2018; Lin et al., 2017b).
Two-stage detectors consist of two stages: (i) region proposal generation, and (ii) region proposal classiﬁcation and regression.
For example, one of most popoular two-stage detectors is Faster R-CNN
(Ren et al., 2015) that uses a Region Proposal Network (RPN) to generate regions of interest in the ﬁrst stage and then sends the region proposals down the pipeline for object classiﬁcation and bounding-box regression.
Faster R-CNN has resulted in many various extensions and improvements in literature (Lin et al., 2017a; Kong et al., 2016; Zhu et al., 2017; Dai et al., 2017; 2016).
Single-stage detectors, also known as single-shot detectors, do not need the proposal generation and simply treat object detection as a simple classiﬁcation and regression problem by taking an input image and directly learning the class probabilities and bounding box coordinates of objects via convolutional networks.
Popular single-stage detectors include YOLO (Redmon et al., 2016), SSD (Liu et al., 2016), and RetinaNet (Lin et al., 2017b).
Typically, single-stage detectors are less accurate than two-stage detectors, but are much faster and thus more amenable to real-time inference needs.
In general, anchor-based detectors suffer from some critical limitations, including requiring heuristic design of anchors, poor alignment of anchors with ground truth objects, and incurring a large number of false positives when anchors are not carefully designed.
2. A NCHOR - FREE O BJECT D ETECTION
Here, we view most anchor-free detectors from as keypoint based detectors.
We can categorize the existing anchor-free object detection methods into two groups according to different bounding box prediction strategies: 1) Keypoint Position and 2) Keypoint Offsets based detectors.
We review some representative works in each group below.
Keypoint Position: This kind of anchor-free detectors predict bounding box via keypoint positions, such as corners.
A representative detector is CornerNet (Law & Deng, 2018).
CornerNet models each object by a pair of corner keypoints, which eliminates the need of anchor boxes and is perhaps the ﬁrst anchor-free detector that achieved the state-of-the-art single-stage object detection accuracy.
There have been some extensions of CornerNet to improve its efﬁciency towards real-time applications such as CornerNet-Lite (Law et al., 2019).
Based on CornerNet, CenterNet (Duan et al., 2019), models an object by a triplet of keypoints, including one center and two corner keypoints.
ExtremeNet (Zhou et al., 2019b) models an object by a set of ﬁve keypoints, including one center and four extreme points ( (top-most, leftmost, bottom-most, right-most) of an object based on a standard keypoint estimation network.
RPDet (Yang et al., 2019) represents an object by a ﬁxed set of 9 keypoints learned from the center of an object which are reﬁned progressively during the training process.
Keypoint Offsets: This kind of anchor-free detectors predict bounding box via learning offsets based on keypoints.
A representative anchor-free detector is CenterNet (Zhou et al., 2019a) that models an object by the center point of its bounding box, and uses keypoint estimation to ﬁnd center points and regresses to all other object properties, such as size, 3D location, orientation, and even pose.
Some approaches such as FSAS (Zhu et al., 2019) and FoveaBox (Kong et al., 2019) sample many keypoints from the center region of an object and learn to predict objects.
Some approaches such as
FCOS (Tian et al., 2019) and SAPD (Zhu et al., 2019) treat all the pixels within an object as candidate keypoints during training and improve them by a separate post-processing strategy.
These keypoint based detectors all learn offsets to the boundary of the objects based on Cartesian coordinates, which yields a lot of poor quality keypoints.
Some strategies are adopted to remove these bad points such as center sampling (Kong et al., 2019; Zhu et al., 2019) or centerness score (Tian et al., 2019).
Unlike the above keypoint based detectors that learn keypoints based on Cartesian coordinates, our approach learns a set of keypoints based on polar coordinates which makes it easier to learn high quality keypoints.
P OLAR N ET D ETECTOR 3. P OLAR C OORDINATES VS C ARTESIAN C OORDINATES
𝜌 𝑡𝑟 𝜌 𝑏𝑟 𝜌 𝑡𝑙 𝜌 𝑏𝑙 𝜃 𝑡𝑟 𝜃 𝑏𝑟 𝜃 𝑏𝑙 𝜃 𝑡𝑙 (a) Polar r b t l (b) Cartesian
S
L (c) FCOS worst case
S
L (d) PolarNet worst case
Many popular keypoint based detectors represent keypoints based on Cartesian coordinates.
This strategy yields a lot of keypoints with poor quality (see Figure 1(e)), making it difﬁcult to optimize without manually designed strategies (such as centerness (Tian et al., 2019) or center sampling (Zhu et al., 2019)).
A better approach for keypoints representation is thus required to avoid poor quality keypoints (such as points near the boundary).
In order to overcome this challenge, we represent the keypoints with polar coordinates instead of vanilla Cartesian coordinates.
We learn the offsets of each keypoints pointing to the corners, and select the optimal corner pair for detector training.
Furthermore, the corners are used for scale-insensitive localization.
For each keypoint, we have to predict offsets based on this point to generate the bounding box (bbx).
Vanilla keypoint based detectors learn keypoints based on Cartesian coordinates, which learns 4D vectors ( t, l, b, r ) , corresponding to (top,bottom, left, right) pointing to the boundary of the objects (See Figure 2 (b)).
In PolarNet, for each object, we have two pairs of corners(top left(tl), bottom right(br) and top right(tr), bottom left(bl)).
And thus for each point ( x, y ) , we predict two pair of 4D vectors: ( θ tr , ρ tr , θ bl , ρ bl ) and ( θ tl , ρ tl , θ br , ρ br ) , which point to the four corners of the object (See Figure 2(a)).
Here ρ and θ denote the distance and angle of point ( x, y ) to corner (corner ∈ { br, tl, bl, tr } and θ ∈ (0 , π 2 ) ).
We defer the discussion for training the keypoint predictor later.
For keypoint offsets based detectors, learning offsets with large variance yields unsatisfactory results.
And thus in many existing methods, poor quality points will be removed (Zhu et al., 2019) or be suppressed (Tian et al.,
2019).Here we analyze the worst case in FCOS (by Cartesian coordinates) and PolarNet (by Polar coordinates) when training the detectors.
Assume the height and width of input object as h and w , we deﬁne L and S as L = max( h, w ) and
S = min( w, h ) .
The range r of learned offsets in FCOS is:
[Equation]
In Figure 2(c), when the point is close to the boundary, the variance of learned offsets is very large (shorter offset is close to 0 while longer offset is close to L ).
In PolarNet, we will learn two pair of offsets for each keypoint, pointing to different corner pairs (TL-BR and TR-BL).
We will keep the pair with close offsets for training PolarNet.
And thus, the range r of learned offsets is:
[Equation]
The worst case in PolarNet is when the keypoints lie in the center of short line of the objects, the ratio of longer offsets with shorter offsets equals to (cid:113) 1 + 4 L 2 S 2 (See Figure 2(d)), which signiﬁcantly reduces the variance.
[Figure]
3. O VERVIEW
We now present the proposed keypoint based detection network (PolarNet), a new anchor-free detector that is capable of better representing keypoints and localizing the objects.
Figure 3 gives an overview of the architecture of the proposed PolarNet.
An input image is passed through a CNN network to produce a set of feature maps.
Note that following the CNN backbone, we also apply the Feature
Pyramid Network (FPN) to help deal with scale variances.
Based on the feature maps, a Fully
Convolutional layer is applied to perform the pixel-wise objectness prediction, which predicts the objectness likelihood of a pixel with respect to a particular object category.
Then for each keypoint within the objects, we will learn a set of polar coordinates pointing to the corners of the objects.
The keypoints predictor will be used here to select the optimal coordinates for detector training.
And the corners will also be used here to supervise bounding box regression learning.
Finally, after the selected keypoints are obtained, the keypoints’ bounding boxes together with their objectness and likelihood scores are passed through NMS to obtain the ﬁnal detection result.
Next we will discuss several key modules of the proposed framework, including polar coordinates, pixel-wise objectness prediction, overall detector training, inferences, and other details.
3. P IXEL - WISE O BJECTNESS P REDICTION
The input to this module is a set of feature maps from a CNN backbone, denoted by F i ∈
R H × W × C the feature map at layer i of a CNN with a total of C classes.
We view any pixel/location ( x, y ) of the feature map as a potential candidate for keypoints, and the objectness prediction module aims to predict how likely a particular location of the feature map is relevant to some particular class of objects.
This idea follows the principle of fully convolutional networks (FCN) for semantic segmentation and has also been used previously in FCOS (Tian et al., 2019).
Speciﬁcally, we predict the objectness of a particular location ( x, y ) by a real vector ( c x,y , b x,y ) , where c x,y ∈ (0 , 1) C denotes a C -dimensional vector of object class prediction scores for ( x, y ) .
3. D ETECTOR T RAINING 3.4. T RAINING LOSSES FOR KEYPOINTS SELECTION
We train the objectness prediction using both classiﬁcation loss and bounding box regression loss.
We deﬁne Q =
( x, y ) is the set of candidate locations that fall into the ground-truth bounding boxes.
The classiﬁcation loss is deﬁned as
[Equation]
where L focal is based on the focal loss (Lin et al., 2017b) and c ∗ x,y ∈ [0 , 1] C denotes the ground-truth class labels at location ( x, y ) .
For bounding box regression, we only consider a location that falls into any ground-truth box.
Unlike vanilla keypoint detectors which yield poor quality keypoints due to large variance of learned offsets, in our model, each keypoint has two target boxes which point to different corner pairs.
And we assume, the corner pair with similar distance ρ to the keypoints is more suibtale for training the detector.
More speciﬁcally, we learn a keypoints selector to select suitable corner pair as:
[Equation]
where t ∗ ( x,y ) is the label of selected box in ( x, y ) , and t = 0 if TL-BR pair is selected otherwise t = 1 .
After removing the undesirable box, we guarantee for each keypoint, at least one box is available for training the detector.
The selected box will be used for training the models, and here for each point we learn a binary classiﬁer to indicate which corner pair to use as
[Equation]
where t x,y is the predicted score in point ( x, y ) .
3.4. T RAINING LOSS FOR CORNER SUPERVISION
In vanilla keypoint detector, the learned offsets will ﬁrst be converted into boxes, and then a IoU loss is followed to learn the bbox regressor.
However, the learned offsets are sensitive to scales, and in IoU loss, the coordinates of bounding box are not explicitly optimized.
Inspired by the scale-invariant property of corner features, we aim to enhance the original feature by corner features.
We ﬁrst learn the corner features supervised by corner annotation, and then integrate them into the original feature map to make it robust to scale variance.
Here we train the bbox regressors based on the new generated features maps.
Suppose the selected polar coordinates in ( x, y ) is B x , y as ( θ br , ρ br , θ tl , ρ tl ) , and we can easily obtain the corner coordinates B ∗ x , y as ( θ ∗ br , ρ ∗ br , θ ∗ tl , ρ ∗ tl ) , and thus we determine the supervision from corners as:
[Equation]
3.4. I O U LOSS FOR BOUNDING BOXES REGRESSION
In addition to corner supervision, here we also keep the original GIoU loss in training bounding boxes.
We can easily to obtain the bounding box based on the selected polar coordinate.
And we deﬁne the bounding box regression loss as:
[Equation]
where L GIoU is based on the GIoU loss (Rezatoﬁghi et al., 2019).
We transform the learned offsets into bounding box and optimize the GIoU loss.
3.4. O VERALL TRAINING LOSS AND ADAPTIVE KEYPOINT TRAINING
Combining the above training losses for both objectness prediction and polar coordinates modules, we can deﬁne the overall training loss function as follows:
[Equation]
3. I NFERENCE
During the inference stage, PolarNet takes an image as an input and passes it through the CNN network followed by the FPN module to obtain the feature maps.
Based on the resulting feature maps, we then predict the objectness scores c x,y and bounding box offsets b x,y of each point/location ( x, y ) on the feature map.
After that, we select top k points/locations with the highest class objectness scores as the candidate points to the keypoint prediction module.
For each candidate keypoint, we predict t x,y to determine optimal corner pair and output the optimal box from b x,y as the ﬁnal output of the predicted box.
Finally, we pass the predicted boxes to a soft-version of Non-Maximum Suppression (NMS) to obtain the ﬁnal detection result.
E XPERIMENTS 4. E XPERIMENTAL D ATASET AND S ETUP
We conducted experiments on MSCOCO dataset, which has 80 categories in three splits: train (115k images), val (5k images), and test-dev (20k images).
Following common practice, we used the train set to train our model and the val set for ablation studies, and ﬁnally report the results on test-dev set for comparison.
In our experiments, only bounding box level annotations are used.
We consider three types of backbones: ResNet-50 (He et al., 2016), ResNet-101 (He et al., 2016) and
ResNeXt-101-DCNv2(Xizhou Zhu & Dai, 2019).
For efﬁciency, ResNet-50 and ResNet-101 is used in our ablation study.
4. E XPERIMENTAL R ESULTS
Table 1 shows the results on the COCO val set by comparing our method with other popular anchorfree detectors mostly with ResNet-101 (for CornerNet and CenterNet we add results on Hourglasssince they are designed based on Hourglass backbones).
For comparison purposes, we also include two anchor-based detectors, including the popular RetinaNet(Lin et al., 2017b) and the state-of-the-art
ATSS (Zhang et al., 2020) .
[Table]
The models are trained on MSCOCO train with 115k images, and validated on MSCOCO val set with 5k images.
“R-101” denotes ResNet-101 backbone and “HG-104” denotes Hourglass-104 backbone.
From the results
[Table]
we can see that all anchor-free/keypoint-based methods outperform RetinaNet which uses predeﬁned anchors and IoU matching methods.
This conﬁrms the advantage of keypointbased detection methods over heuristic anchor-based designs.
However, the existing anchor-free detectors are worse than ATSS, which is a recent state-of-the-art anchor-based method by borrowing and adapting some advanced strategies from anchor-free methods.
By examining the results of our PolarNet, we found that it outperforms all the existing keypoint-based detectors.
Compared with Keypoint Position methods such as CornerNet, our model is able to capture more contextual information of the objects.
Compared with other Keypoint Offsets methods such as FCOS, our method represents keypoints by polar coordinates which eliminate poor keypoints and learn box via corner supervision.
This merit signiﬁcantly boost the performance of our method.
Finally, our method is also better than the state-of-the-art anchor-based ATSS, but eliminates the need of manually designed anchors.
4. A BLATION S TUDY
This ablation study aims to examine the effeciveness of polar coordinates and corner supervision in our PolarNet.
Table 2 shows the results of our ablation study and our baseline FCOS.
From the results in Table 2, we can see that original FCOS produce poor results without Centerness due to the poor points.
The results of FCOS improves from 34.3% to 38.5% by polar coordinates and it also outperforms FCOS with Centerness (37.1%), which indicates the effectiveness of polar coordinates.
We further add corner supervision in FCOS, and the results improve from 37.1% to 38.3%, which proves that our corner supervision is effective.
[Table]
4. C OMPARISON WITH S TATE - OF - THE - ART D ETECTORS
We compare PolarNet with other state-of-the-art detectors on COCO test-dev set.
Unlike the previous experiments, we train our models on backbone ResNeXt-101-DCNv2.
Table 3 shows the results on
COCO test-dev under the single-model single-scale settings.
PolarNet outperforms all single-stage detectors by a substantial margin (except ATSS), also outperform a variety of two-stage/multi-stage detectors
[Table]
and achieves the best results among all the keypoint based detectors.
This promising result validates our hypothesis of learning keypoints based on polar coordinates with corner supervision is able to better predict the objects.
Speciﬁcally, compared with other center-based methods such as
CenterNet or FSFA, our method not only extracts features from the central region
[Table]
but also encodes features from the whole bounding boxes.
Besides, our corner supervision is scale-invariant and thus shows better results in localization.
Finally, compared with the SOTA anchor-based ATSS, our method eliminates the need of using anchors and thus avoids heuristic anchor design
[Table]
C ONCLUSION
In this paper, we presented a view of the popular anchor-free object detectors from the object modeling based detection perspective.
We argue that the existing keypoint based detectors yields a lot of poor quality keypoints based on Cartesian coordinates and the bounding box regression learning is also based on scale-variant features.
To overcome the limitation, we proposed PolarNet, a new keypoint based detector which represents keypoints by polar coordinates which avoids poor quality keypoints as well as learning scale-invariant corner features for object localization.
Our new detector obtained the state-of-the-art results on the MS COCO test-dev set under the single-model single-scale settings.
A I MPLEMENTATION D ETAILS A. N ETWORK B ACKBONES
Following the recent state-of-the-art object detectors such as FCOS (Tian et al., 2019) and RetinaNet (Lin et al., 2017b), we adopt the ResNet (He et al., 2016) and ResNeXt (Xie et al., 2017) CNN network as our backbone architecture.
ResNet and ResNeXt are two fully convolutional networks, which are composed of a sequence of residual modules and were ﬁrst used for image classiﬁcation.
Residual module ﬁrst encodes the input feature by a sequence of convolution and normalization layers, and then aggregates the generated feature map with the original input features.
In order to predict objects with large scale variance, we also apply the Feature Pyramid Network (FPN)
(Lin et al., 2017a) in our approach, which combines the shallow layer features with deep layer features by the latent connection.
To learn a scale-robust detector, each level of FPN is responsible for a certain scale of objects, making it very suitable for object detection.
Speciﬁcally, we use 5 FPN levels to make prediction, with stride 8, 16, 32, 64 and 128 compared with the original image, and each of the level is responsible for a certain scale of the objects: (0, 64], (64, 128], (128, 256], (256, 512] and (512, INF].
We adopt ResNet-50 (He et al., 2016), ResNet-101 (He et al., 2016) and DCN2-ResNeXt-101-64x4 (Xizhou Zhu & Dai, 2019) as our backbone architecture in our experiments.
A. I NITIALIZATION AND O PTIMIZATION
We train the model from weights pre-trained on ImageNet classiﬁcation task and other parameters are initialized by the same methods as RetinaNet (Lin et al., 2017b).
The model is trained with SGD optimization methods with 180k iterations with 16 images per mini-batch.
The initial learning rate is set to 1e-2 and is reduced 10 times at 120k and 160k iterations.
We re-scale the the input images into 800x1333 pixels before training.
We use the same data augmentation strategy presented in (Tian et al., 2019) when training the model, and for each image, the top-50 predictions are produced
B M ORE A BLATION S TUDY B. I MPORTANCE OF GI O U LOSS
In this section, we explore the importance of the GIoU loss.
We can directly predict objects by learned corners.
However, this way fails to differentiate the quality of the positive predictions (quality means the IoU with objects).
If the GIoU loss is removed, the performance drops from 39.3% to 36.5% (See Table 4), indicating the importance of the GIoU loss.
[Table]