Abstract
Deformable Convolution v4 (DCNv4) represents a significant leap in the efficiency and performance of sparse, dynamic operators for computer vision. By addressing the memory-bound nature of its predecessor, DCNv3, and rethinking the necessity of softmax normalization, DCNv4 achieves a 3x speedup in runtime and markedly faster training convergence. This work demonstrates that DCNv4 can serve as a highly effective, universal drop-in replacement for standard convolutions and attention mechanisms across a wide array of tasks, including classification, detection, segmentation, and image generation.
Introduction
The landscape of computer vision has been dominated by the competition between Convolutional Neural Networks (ConvNets) and Transformers. Deformable Convolutions (DCN) were introduced to combine the best of both worlds: the inductive biases of convolutions with the dynamic, long-range modeling capabilities of attention. DCNv3, the backbone of the InternImage model, showed great promise but suffered from two critical bottlenecks: high practical latency due to being memory-bound and slow convergence during the early stages of training.
DCNv4 is designed to overcome these limitations, making sparse dynamic operators practical for high-speed, real-world applications. By optimizing memory access patterns and simplifying the operator's micro-design, the authors have created one of the fastest core operators in the field.
Methods: Rethinking the Sparse Operator
The transition from DCNv3 to DCNv4 involves two major shifts: a conceptual rethinking of dynamic properties and a rigorous optimization of low-level implementation.
Rethinking the Dynamic Property
In DCNv3, a softmax function was used to normalize aggregation weights, a design choice intended to mimic the behavior of self-attention. However, the authors observed that unlike self-attention, which shares "keys" across a global or local window, DCN uses a dedicated aggregation window for every query location. This distinction makes the softmax normalization redundant.
As shown in the figure above, removing the softmax allows the weights to become "unbounded," similar to standard convolutions. This change increases the expressive power of the operator and, crucially, accelerates convergence by removing the learning constraints imposed by the 0-1 range.
Memory Access Optimization
Instruction-level profiling revealed that 99% of DCNv3's runtime was consumed by memory access rather than computation. DCNv4 addresses this "Memory Access Cost" (MAC) through several CUDA-level optimizations:
- Thread Sharing: A single GPU thread now processes multiple channels that share the same sampling offsets and weights, eliminating redundant memory reads and bilinear interpolation calculations.
- Vectorized Instructions: The implementation utilizes 128-bit vectorized load/store instructions to maximize utilization of the GPU's memory bandwidth.
- Micro-design Simplification: Redundant layers within the offset generation sub-network, such as LayerNorm and GELU, were removed to further reduce computational overhead.
Experimental Evaluation
The effectiveness of DCNv4 was validated across a diverse set of benchmarks:
- ImageNet-1K: Used to measure classification accuracy and convergence speed.
- COCO & ADE20K: Benchmarks for object detection and semantic segmentation.
- nuScenes: Testing performance in 3D object detection for autonomous driving.
- Generative Modeling: Evaluated using Latent Diffusion Models (LDM) on ImageNet 256x256.
Key Results
The optimizations in DCNv4 yield dramatic improvements in both speed and learning efficiency.
Massive Speedup and Efficiency
DCNv4 is approximately 3x faster than DCNv3 in terms of raw forward pass speed. When integrated into full models, the impact is substantial. The "FlashInternImage" model, created by replacing DCNv3 with DCNv4, achieved a 50% to 80% increase in overall speed. For instance, FlashInternImage-S reaches 84.4% accuracy on ImageNet-1K, outperforming ConvNeXt-B while maintaining a significantly higher throughput.
Faster Convergence
As illustrated in the convergence plots, DCNv4 learns much faster than its predecessor and other common operators like depthwise convolutions (DWConv) or dense attention. This faster convergence is attributed to the removal of the softmax constraint, allowing the model to adapt its weights more freely in the early stages of training.
Versatility as a Drop-in Replacement
DCNv4 proves to be a universal operator. Replacing depthwise convolutions in ConvNeXt or self-attention in ViT with DCNv4 resulted in comparable or superior accuracy with significantly improved throughput. In generative tasks, DCNv4-enhanced U-Nets improved the FID score from 2.94 to 2.44, showcasing its superior spatial modeling capabilities.
Discussion and Future Work
DCNv4 demonstrates that sparse, dynamic operators can be as efficient as standard convolutions if memory access is properly optimized. However, some challenges remain. The current optimizations are highly specific to NVIDIA CUDA kernels, and porting this efficiency to other hardware like TPUs or mobile processors is a key area for future research. Additionally, while DCNv4 scales well to "Large" models, its performance in "Giant" scale models with billions of parameters remains to be explored. Future work will also involve tuning architectural hyperparameters specifically for DCNv4 to unlock even greater performance gains.
Conclusion
By rethinking the fundamental properties of deformable convolutions and prioritizing memory efficiency, DCNv4 bridges the gap between the theoretical elegance of sparse operators and their practical utility. It stands as a powerful, efficient, and versatile tool for the next generation of vision models.
Summary updated