Paper commentary
CornerNet: Detecting Objects as Paired Keypoints
CornerNet detects objects as paired corners without anchor boxes
- Problem One-stage detectors place huge numbers of anchor boxes across the image, most of them negatives, and set their sizes by hand. This makes training slow and imbalanced.
- Method CornerNet predicts each object's top-left and bottom-right corners with one network, then joins matching corners by embedding distance. Corner pooling helps it find corners that lack local visual evidence.
- Results CornerNet reaches 42.2% AP on MS COCO test-dev with multi-scale evaluation, outperforming all existing one-stage detectors.
Why replace anchor boxes
One-stage detectors lay anchor boxes densely across the image, score each one, and refine its coordinates by regression. This design runs into two problems, and the first is scale: DSSD uses more than 40k anchors and RetinaNet more than 100k. Only a small share of these anchors overlaps a ground-truth box, so positives and negatives are heavily imbalanced and training slows.
The second problem is the number of design choices, such as how many boxes to use and what sizes and aspect ratios they take, and these have mostly been set by heuristics. Multiscale designs multiply these choices, because each resolution brings its own features and its own anchor set. CornerNet drops anchor boxes entirely and represents each object by two keypoints, the top-left and bottom-right corners of its box.
Detecting a box as two corners
Each set has one channel per object category and its size is H×W, with no background channel, so each channel marks where corners of one class are. For each detected corner the network also outputs an embedding, which is one-dimensional in this design. Corners that belong to the same object are trained to receive close embeddings, so the embeddings decide which top-left and bottom-right corners to join.
A separate offset is predicted to correct the coordinates lost when the heatmap is downsampled, with one offset set shared by all top-left corners and another by all bottom-right corners.
The authors give two reasons for expecting corners to be easier to localize than box centers. A center depends on all four sides of the object, while a corner depends on only two sides. Corners also discretize the space of boxes more efficiently: O(wh) corners can represent O(w²h²) possible anchor boxes.
Corner pooling for corners without local evidence
A corner often lies outside the object, so the pixels around it show no visual evidence of it. To decide whether a pixel is a top-left corner, the network has to look right along the row for the object's topmost edge and down the column for its leftmost edge. Corner pooling implements this by taking two feature maps as input. For a top-left corner at location (i, j), the first map is max-pooled over the positions from (i, j) to (i, H), and the second map is max-pooled over the positions from (i, j) to (W, j).
The two pooled vectors are then added together.
The pooled values are computed with a recurrence, t_ij = max(f_t,ij, t_(i+1)j) for the vertical pass, so each position reuses the result of its neighbour instead of re-scanning the whole row or column. The bottom-right version works the same way but pools toward the origin: over positions from (0, j) to (i, j) in one map and from (i, 0) to (i, j) in the other.
In the prediction module, the first 3×3 convolution of a residual block is replaced by a corner pooling module, which applies two 3×3 convolution modules with 128 channels before pooling.
Training the corner heads
The heatmap loss is a variant of focal loss, with exponents set to \(\alpha = 2\) and \(\beta = 4\) in all experiments. Around each ground-truth corner, the penalty on negative locations is reduced by an unnormalized 2D Gaussian centered on the positive location, with sigma set to one third of the radius. The radius is chosen so that two corners placed anywhere inside it would still form a box with at least 0.3 IoU with the ground-truth box.
The motivation is that nearby false corners can still produce a box that overlaps the ground truth well, so penalizing them fully would be too strict.
The offset loss is a smooth L1 loss applied at the ground-truth corner locations. The embedding training follows Associative Embedding: a pull loss brings each top-left and bottom-right embedding toward the mean of the pair, and a push loss separates the means of different objects with a hinge at a margin Δ of 1. Both embedding losses are applied only at ground-truth corner locations.
The total loss adds these terms with weights that are also written α and β, but these are the pull and push weights and are separate from the focal-loss exponents; the offset weight is γ, and both α and β are set to 0.1 and γ to 1.
The network is trained with Adam, and it is initialized randomly with no pretraining on any external dataset. Training uses random horizontal flipping, random scaling, random cropping, random color jittering and PCA on the input image. Inputs are 511 × 511 pixels and the heatmaps are 128 × 128. The batch size is 49, spread over 10 Titan X (PASCAL) GPUs.
Hourglass backbone and test-time grouping
The backbone is an hourglass network with two hourglass modules and a depth of 104 layers, and the prediction modules read only its last layer. Each hourglass module downsamples and then upsamples features with skip connections, which keeps both global context and local detail. In this design the downsampling uses stride 2 rather than max pooling, and feature channels grow across five resolution reductions, from 256 to 512.
The authors also add intermediate supervision during training but do not feed the intermediate predictions back into the network, since they found this hurts performance.
Pairs are rejected when their L1 embedding distance exceeds 0.5 or when the two corners come from different categories. Each surviving box takes the average of its two corner scores, and detections from the original and flipped images are merged and passed through soft-nms. Images are padded with zeros rather than resized, and each image takes 244 ms on average on a Titan X (PASCAL) GPU.
MS COCO test-dev results
MS COCO has 80k training images, 40k validation images and 20k test images. Training uses all training images and 35k of the validation images, with the remaining 5k used for hyperparameter search and ablations, and test-set results are scored on an external server. The main results are reported on test-dev so that they can be compared with other detectors.
CornerNet511 reaches 40.6 AP with single-scale evaluation and 42.2 AP with multi-scale evaluation, with an AP50 of 57.8 in the multi-scale row. The authors describe this as the state of the art among one-stage methods and competitive with two-stage methods.
Ablations: corner pooling and penalty reduction
The ablation network without corner pooling keeps the same number of parameters, and it reaches 36.5 AP on MS COCO validation. With corner pooling, AP rises to 38.4, a gain of 2.0, and AP50 and AP75 rise by 2.1 and 2.1. Gains are larger for medium and large objects, with APm up 2.4 and APl up 3.6, and the authors expect this because the object boundaries that corner pooling reaches are farther from the corners for those sizes.
A separate measure of corner classification, mAP over image quadrants, also improves with pooling in every quadrant and for both corner types, by between 2.6 and 3.1 points.
Reducing the penalty on negatives near positives is compared in three conditions: no reduction, a fixed radius of 2.5, and the object-dependent radius. AP is 32.9 without reduction, 35.6 with the fixed radius and 38.4 with the object-dependent radius. The object-dependent radius adds a further 2.8 AP over the fixed radius, and the authors note that the benefit is largest for medium and large objects.
Backbone choice
The authors replace the hourglass with FPN on a ResNet-101 backbone and use only the final FPN output for predictions. They also train an anchor-box detector on the hourglass backbone, with anchors designed following RetinaNet and intermediate supervision. CornerNet with the hourglass backbone reaches 38.4 AP, against 30.2 for CornerNet with FPN and 32.9 for the anchor-based hourglass detector.
Box quality and where the errors come from
At the AP90 threshold, CornerNet reaches 23.4, against 19.5 for Cascade R-CNN + IoU Net, 15.8 for Cascade R-CNN and 15.1 for RetinaNet. At the lower thresholds the picture differs: CornerNet scores 40.6 AP, below the 41.4 of Cascade R-CNN + IoU Net and above RetinaNet's 39.8, and its AP50 of 56.1 trails RetinaNet's 59.5.
To split the error, the predicted heatmaps and offsets are replaced one at a time with ground-truth values on the validation set. Ground-truth heatmaps raise AP from 38.4 to 73.1, and adding ground-truth offsets raises it further to 86.1. The authors conclude that the main bottleneck is detecting corners, while grouping and offset accuracy also leave room for improvement.
The failure cases include corners that combine boundary evidence from different objects and corners from different objects that receive similar embeddings.
Limitations
The ground-truth replacement experiment is an upper bound on what better corner detection would give, not a measured system result. The authors identify corner detection as the bottleneck, so corner localization and embedding quality decide most of the remaining gap. Ablations are trained for 250k iterations at a learning rate of 2.5 × 10⁻⁴, while the comparisons with other detectors add a further 250k iterations and drop the rate to 2.5 × 10⁻⁵ for the final 50k.
Inference takes 244 ms per image on a Titan X (PASCAL) GPU, and the reported runtime is for that single hardware setup. All reported experiments use MS COCO, and the high-IoU comparison is reported with the authors' selected baselines.
Paper info
- Authors
- Hei Law, Jia Deng
- Venue
- arXiv · Preprint
- First published
- 2018-8-3
- Added
- 2026-11-12
- Updated
- 2019-3-18
- Version
- v2
- arXiv
- 1808.01244
- Category
- cs.CV
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Hei Law, Jia Deng (2018). CornerNet: Detecting Objects as Paired Keypoints. arXiv:1808.01244v2. https://arxiv.org/abs/1808.01244v2
BibTeX
@misc{law2018cornernet,
title = {{CornerNet: Detecting Objects as Paired Keypoints}},
author = {Hei Law and Jia Deng},
year = {2018},
eprint = {1808.01244},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1808.01244v2}
}