# Deformable Convolutional Networks

Deformable convolution lets CNNs learn where to sample their inputs

Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu and 1 more · arXiv · 2017-3-17

- **Problem** Standard CNNs read inputs at fixed grid locations and pool over fixed bins, so they cannot follow the shape of objects. Data augmentation and larger models only partly compensate for this fixed geometry.
- **Method** Deformable convolutional networks add a learned offset to each sampling point of a convolution. Offsets are predicted from the input feature map by an extra convolution, and the same idea is applied to RoI pooling.
- **Results** On COCO test-dev, deformable R-FCN scored 34.5 mAP@\[0.5:0.95\], up from 30.8 for the plain model with the same ResNet-101 backbone.

## Why fixed sampling limits CNNs

CNNs handle geometric variation mostly through heavy data augmentation, large model capacity, and a few hand-built pooling steps. Those sources of invariance are partial, because a convolution reads its input at fixed locations and a pooling layer shrinks resolution by a fixed ratio. RoI pooling works the same way: it splits every region into a fixed set of spatial bins, so it has no built-in way to follow an object's shape.

The authors trace the limitation to this fixed geometry of CNN modules rather than to the amount of training data.

The fixed geometry has a visible cost. Every activation unit in one layer has the same receptive field size, even though different locations may cover objects of different scales. That matters for segmentation with fully convolutional networks, where adaptive scale or receptive field size is needed for fine localization. Object detection faces a similar problem, since current approaches still extract features from primitive bounding boxes, which the authors call clearly sub-optimal for non-rigid objects.

## Learned offsets on the sampling grid

The key idea is to let each sampling point of a convolution move by a learned offset that depends on the image, so the kernel reads from an irregular grid. The offsets come from the preceding feature map through an extra convolutional layer, so the deformation depends on the local input features. The authors expected this to be cheap, since the modules add only a small number of parameters and computation for offset learning.

A standard 2D convolution first samples the input over a regular grid R and then sums the samples weighted by w, which gives the output at each location p0. In deformable convolution each grid point gets an offset Δpn, so the sample at p0 + pn + Δpn replaces the sample at p0 + pn: \\\[ y(p\_0)=\\sum\_{p\_n\\in R} w(p\_n)\\, x(p\_0+p\_n+\\Delta p\_n) \\\] Because an offset is usually fractional, the value at a fractional location is read by bilinear interpolation, a weighted sum over integral positions q with the kernel G(q, p).

That kernel is separable into two one-dimensional parts, g(qx, px) times g(qy, py), with g(a, b) = max(0, 1 − \|a − b\|), and only a few integral positions have a non-zero weight, so the computation stays fast.

The offsets are produced by a convolution over the same input feature map, with the same kernel size and dilation as the layer it modifies. Its output has 2N channels, one 2D offset for each of the N sampling positions, and the output has the same spatial resolution as the input. The offset layer and the output convolution kernels are learned together, with gradients passed back through the bilinear operations.

## Offsets for RoI pooling

RoI pooling divides a w × h region into k × k bins and averages the input values in each bin, which gives a fixed-size output for any RoI size. Deformable RoI pooling adds an offset Δpij to each bin position before averaging, and the offset is again sampled through bilinear interpolation.

The offsets are generated in two steps: RoI pooling first produces pooled feature maps, and a fully connected layer then predicts normalized offsets from them. Those normalized offsets are multiplied element-wise by the RoI width and height and by γ, as Δpij = γ · Δp̂ij ∘ (w, h), with γ set to 0.1. The authors normalize by RoI size so that the offset learning does not depend on how large the RoI is.

Position-sensitive RoI pooling works differently, because a convolution first turns the input into k² score maps for each class, and each bin pools from its own map. In the deformable PS version, the offsets come from a convolution at full spatial resolution, and PS RoI pooling is applied to these offset fields for each RoI and each class.

## Plugging the modules into backbones and detectors

The authors use ResNet-101 and a modified Inception-ResNet, called Aligned-Inception-ResNet, as feature extractors, both pre-trained on ImageNet. The last convolutional block's stride is reduced from 2 to 1, so the effective stride drops from 32 to 16 pixels, and the dilation of its filters is changed from 1 to 2 to compensate. Deformable convolution is applied to the last few convolutional layers, and the authors settled on 3 layers as a trade-off across tasks.

The added offset layers start from zero weights, so the network begins as the plain model and the offsets grow only as training requires. Their learning rate is β times the rate of the existing layers, with β set to 1 by default and to 0.01 for the fc layer in Faster R-CNN.

The task-specific heads sit on top of this feature map: DeepLab adds a 1 × 1 convolution with a softmax, and the category-aware RPN replaces the 2-class classifier with a (C+1)-class classifier. In both detectors the RoI pooling layer can optionally be swapped for its deformable version.

On PASCAL VOC, training runs for 30k SGD iterations, and on COCO for 240k iterations, on 8 GPUs. For the VOC ablations the authors use pre-trained, fixed RPN proposals without feature sharing, which keeps the comparisons controlled.

## How many layers to make deformable

With deformable convolution in the last three 3 × 3 layers of ResNet-101, DeepLab's mIoU@V rose from 69.7 to 75.2. Class-aware RPN's mAP@0.7 rose from 44.9 to 57.2 with the same three layers. The gain for R-FCN was smaller, with mAP@0.5 rising from 80.0 to 81.4 and mAP@0.7 from 61.8 to 64.7 on VOC 2007 test.

Most of the improvement comes from the first few deformable layers, and the curve flattens after that. For DeepLab the gain saturates at 3 layers, and the other tasks saturate at 6, so the authors kept 3 for the remaining experiments. Six layers gave DeepLab 74.8 mIoU@V, slightly below the 75.2 with three layers, so more deformable layers do not always help.

## Do learned receptive fields follow objects?

They applied R-FCN with three deformable layers to VOC 2007 test images and grouped the filters by ground truth box size and by where the filter center lies. Objects are split into small, medium and large by bounding box area, with small below 962 pixels and large above 2242 pixels.

In res5c, the effective dilation was 5.3 ± 3.3 for small objects, 5.8 ± 3.5 for medium ones and 8.4 ± 4.5 for large ones, and 6.2 ± 3.0 for background. The same ordering holds in res5b and res5a, so larger objects are matched with larger receptive fields. Background filters fall between the medium and large values, which the authors read as a sign that a fairly large receptive field is needed to recognize background.

## Against atrous dilation and deformable RoI pooling

The default ResNet-101 uses atrous convolution with dilation 2 in the last three 3 × 3 layers, and the authors tried dilations 4, 6 and 8 to see whether a larger receptive field alone would close the gap. For DeepLab, dilation 6 reached 73.6 mIoU@V, compared to 75.3 with deformable convolution. For R-FCN, dilation 6 gave 80.2 mAP@0.5 and 63.5 mAP@0.7, compared to 81.4 and 64.7 with deformable convolution.

Larger dilations help every task, but the best dilation differs by task, which the authors take as evidence that the receptive field should be learned rather than set by hand. Deformable convolution gave the best accuracy in this comparison, so the authors conclude that adaptive filter deformation is effective and necessary. Deformable RoI pooling alone raised R-FCN's mAP@0.7 from 61.8 to 65.0, and combining it with deformable convolution gave 82.6 mAP@0.5 and 68.5 mAP@0.7.

## COCO detection gains

With ResNet-101, Faster R-CNN rose from 29.4 to 33.1 mAP@\[0.5:0.95\] on COCO test-dev when made deformable. R-FCN rose from 30.8 to 34.5 with the same backbone. The authors report these as relative gains of about 13% and 12%, which they count as the same kind of improvement across detectors.

With Aligned-Inception-ResNet, R-FCN rose from 32.9 to 36.1, and Faster R-CNN rose from 30.8 to 34.1. So the deformable modules still help after the backbone itself gets stronger.

## Overhead in parameters and runtime

These timings were measured on an Intel E5-2650 v2 CPU with an Nvidia K40 GPU, so they are not comparable to other hardware. The authors conclude that the gains come from modeling geometric transformations rather than from extra parameters.

## How the approach differs from earlier learned transformations

Spatial Transform Networks learn one global parametric transformation, such as an affine map, and warp the feature map with it. Deformable convolution instead samples locally and densely and then applies a weighted summation, which Spatial Transform Networks lack. Active Convolution also learns sampling offsets, but its offsets are shared across spatial locations and are static parameters.

The offsets in deformable convolution are dynamic outputs that change with each image location, which the authors argue is needed for dense prediction.

The authors also describe deformable convolution as a generalization of atrous convolution, since the special cases in their figure cover scale, aspect ratio and rotation. Deformable RoI pooling is similar in spirit to deformable part models, because both learn the deformation of object parts, but it considers no spatial relations between parts.

## Limitations

The COCO gains are reported on test-dev with ResNet-101 and Aligned-Inception-ResNet backbones only. The layer-count and dilation comparisons are on VOC, and the effective dilation analysis uses only R-FCN on VOC 2007 test images. The simplified Faster R-CNN head that the authors use is said to slightly lower accuracy, so the baseline numbers are conservative for that detector.

The authors leave open whether the gains carry over to tasks beyond the segmentation and detection benchmarks reported here.

## Paper info

- **Authors**: Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, Yichen Wei
- **Venue**: arXiv · Preprint
- **First published**: 2017-3-17
- **Added**: 2026-11-11
- **Updated**: 2017-6-5
- **Version**: v3
- **arXiv**: 1703.06211
- **Category**: cs.CV
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1703.06211v3) · [PDF ↗](https://arxiv.org/pdf/1703.06211v3)

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

Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, Yichen Wei (2017). Deformable Convolutional Networks. arXiv:1703.06211v3. https://arxiv.org/abs/1703.06211v3

**BibTeX**

```
@misc{dai2017deformable,
  title = {{Deformable Convolutional Networks}},
  author = {Jifeng Dai and Haozhi Qi and Yuwen Xiong and Yi Li and Guodong Zhang and Han Hu and Yichen Wei},
  year = {2017},
  eprint = {1703.06211},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1703.06211v3}
}
```

## Other paper commentary

- [TransUNet: Transformers Make Strong Encoders for Medical Image Segmentation](https://refivu.com/en/papers/28bfb581-8f1f-42dd-ab0d-1b3c56282f6a-transunet-transformers-make-strong-encoders-for-medical.md)
- [Accurate Image Super-Resolution Using Very Deep Convolutional Networks](https://refivu.com/en/papers/8f850d36-527c-4a2a-8e8a-5d7766bd5c35-accurate-image-super-resolution-using-very-deep.md)
- [Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps](https://refivu.com/en/papers/d3437c7c-4a6a-4f65-b699-3116ccfbfdee-deep-inside-convolutional-networks-visualising-image.md)
- [Enhanced Deep Residual Networks for Single Image Super-Resolution](https://refivu.com/en/papers/755b4a71-c6fa-4954-b300-73653bb1c2b2-enhanced-deep-residual-networks-for-single-image-super.md)
- [3D U-Net: Learning Dense Volumetric Segmentation from Sparse Annotation](https://refivu.com/en/papers/47c4aa8a-4522-4109-b8e8-dec7f7502462-3d-u-net-learning-dense-volumetric-segmentation-from.md)
- [Show, Attend and Tell: Neural Image Caption Generation with Visual Attention](https://refivu.com/en/papers/167ebd87-d3c8-4b72-a59d-bf158aa626aa-show-attend-and-tell-neural-image-caption-generation.md)
- [Graph Neural Networks: A Review of Methods and Applications](https://refivu.com/en/papers/a985ee6a-3fda-41af-b6ea-0451377e5861-graph-neural-networks-a-review-of-methods-and.md)
- [Distributed Representations of Sentences and Documents](https://refivu.com/en/papers/f945f364-5ce3-4c12-bc05-c40bf55f4f8d-distributed-representations-of-sentences-and-documents.md)
- [An Empirical Evaluation of Generic Convolutional and Recurrent Networks for Sequence Modeling](https://refivu.com/en/papers/b568511a-a3c8-42b3-9fd2-bd1b072662ac-an-empirical-evaluation-of-generic-convolutional-and.md)
- [Artificial Intelligence: the global landscape of ethics guidelines](https://refivu.com/en/papers/d19d6be2-ce31-43ea-b84d-0b4bbe03543f-artificial-intelligence-the-global-landscape-of-ethics.md)
- [Machine Learning in Automated Text Categorization](https://refivu.com/en/papers/f3ed4c42-7556-47e0-bc36-a9acdd9bf6d0-machine-learning-in-automated-text-categorization.md)

## Terms in this paper

- [Object detection](https://refivu.com/en/terms/113bfdb14049-object-detection)
- [COCO](https://refivu.com/en/terms/41f3215c4f4a-coco)
- [Semantic segmentation](https://refivu.com/en/terms/00dfce7ec404-semantic-segmentation)
- [mIoU](https://refivu.com/en/terms/901dcc5384c2-miou)
- [mAP](https://refivu.com/en/terms/477dad058d88-map)
- [Cityscapes](https://refivu.com/en/terms/1067bb006500-cityscapes)
- [Resnet-101](https://refivu.com/en/terms/e1917778abec-resnet-101)
- [PASCAL VOC](https://refivu.com/en/terms/f661ede6fa9d-pascal-voc)
- [bilinear interpolation](https://refivu.com/en/terms/7e615ad35dbd-bilinear-interpolation)
- [R-FCN](https://refivu.com/en/terms/7bbaf3ca2a0f-r-fcn)
- [atrous convolution](https://refivu.com/en/terms/315fe62fcd5a-atrous-convolution)
- [DeepLab](https://refivu.com/en/terms/1d51bd71db10-deeplab)
- [deformable convolution](https://refivu.com/en/terms/2caf738356d7-deformable-convolution)
- [RoI pooling](https://refivu.com/en/terms/ff93251d28ae-roi-pooling)
- [deformable ConvNets](https://refivu.com/en/terms/4e3127272a7a-deformable-convnets)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/578e91c5-050a-4482-bf73-97db86a8865f-deformable-convolutional-networks)
