TL;DR
Standard convolutional neural networks (CNNs) waste significant computation by applying the same filters to every pixel in an image, regardless of whether a region contains a complex object or a plain background. This paper introduces Dynamic Convolutions (DynConv), a method that learns to predict pixel-wise masks to skip computations in "unimportant" areas, achieving up to a 60% speedup in tasks like human pose estimation with virtually no loss in accuracy.
The Challenge of Spatial Uniformity
Modern "efficient" architectures, such as MobileNet or ShuffleNet, have drastically reduced the number of parameters and operations in deep learning models. However, they still suffer from a fundamental inefficiency: spatial uniformity. Whether a pixel belongs to a clear blue sky or a person’s face, the network applies the exact same sequence of expensive convolutions to it.
While previous research explored "conditional execution" (skipping entire layers or channels), doing so at the spatial level is difficult. Earlier attempts often struggled with training stability or failed to provide actual "wall-clock" speedups on GPUs because irregular memory access patterns usually negate the theoretical savings of sparsity.
Proposed Method: Dynamic Convolutions (DynConv)
The authors propose a residual block modified with a small, lightweight gating branch called the "mask unit."
1. Gating Decisions
For each block, the mask unit predicts a binary mask determining which spatial locations need to be processed. To make this discrete decision-making process differentiable for backpropagation, the authors utilize the Gumbel-Softmax trick. This allows the network to learn which regions are salient for the task at hand.
2. Sparsity Loss with Annealing
To prevent the model from either skipping everything or skipping nothing, a computational budget ($\theta$) is introduced. A novel loss function with annealing bounds gently nudges the network toward the desired sparsity level during training, ensuring stable convergence even in deep models like ResNet-101.
3. Efficient Implementation (Gather-Scatter)
To turn theoretical FLOP reductions into real-world speedups, the authors developed a custom CUDA implementation. Instead of processing the whole image with a mask, they gather the "active" pixels into a smaller, dense tensor, perform the convolutions, and then scatter the results back to their original positions. Additionally, mask dilation is used for $3 \times 3$ convolutions to ensure that the neighbors needed for the operation are available, preventing artifacts at the boundaries of sparse regions.
Evaluation and Results
The authors evaluated DynConv across several benchmarks, including CIFAR-10, ImageNet, Food-101, and MPII Human Pose.
Key Findings:
- Superior Efficiency: As shown in the accuracy-vs-computation plots, DynConv consistently outperforms SACT (Spatially Adaptive Computation Time) and other layer-skipping methods, maintaining higher accuracy at lower computational budgets.
- Human Pose Estimation: The method achieved a 60% increase in processing speed on an Nvidia GTX 1050 Ti with no loss in accuracy. In this task, the model learns to focus almost exclusively on human joints and limbs, ignoring the background entirely.
- Mobile Architectures: On MobileNetV2, DynConv increased throughput from 508 to 724 images/sec by reducing the computational budget while maintaining competitive accuracy.
- Layer Sensitivity: Analysis showed that downsampling layers are almost always fully evaluated because they are critical for passing information, while deeper, high-level layers become significantly more sparse.
Conclusion and Future Work
DynConv demonstrates that spatial sparsity can be efficiently exploited on modern GPUs to provide significant wall-clock speedups. While the gather-scatter approach introduces some bookkeeping overhead—which might limit benefits for very small networks or low-resolution images—the results in classification and pose estimation are compelling. Future work may extend this approach to object detection, which naturally deals with localized regions of interest in large images, and further optimize implementation for specialized AI accelerators like TPUs or NPUs.
Summary updated