Abstract
Traditional activation functions like the Rectified Linear Unit (ReLU) are static, applying a fixed transformation to all inputs regardless of context. This paper introduces Dynamic ReLU (DY-ReLU), an adaptive activation function that adjusts its parameters based on input data via a lightweight hyper-function. By making the activation function context-aware, DY-ReLU significantly enhances the representational power of neural networks. Experimental results demonstrate that DY-ReLU improves MobileNetV2 performance on ImageNet by up to 6.1% with only a ~5% increase in computational cost.
Introduction
The Rectified Linear Unit (ReLU) has been a cornerstone of deep learning due to its simplicity and efficiency. However, static activation functions like ReLU, LeakyReLU, and PReLU apply the same mapping regardless of the input's specific characteristics. This lack of flexibility is particularly detrimental for lightweight networks (e.g., MobileNet, ShuffleNet) designed for resource-constrained environments. These models have limited depth and width, necessitating more expressive individual operations. Dynamic ReLU addresses this by allowing the activation function to adapt to the input context on the fly.
Methodology
The core innovation is the Dynamic ReLU (DY-ReLU) function. Unlike a fixed $y = \max(0, x)$, DY-ReLU is a piecewise linear function where the slopes ($a$) and intercepts ($b$) are determined dynamically by the input itself.
The Hyper-function
DY-ReLU utilizes a "hyper-function" to generate parameters. For a given input, the model uses a small sub-network—similar to a Squeeze-and-Excitation block—to capture global context. This involves global average pooling followed by two fully connected layers that output the parameters for the activation function.
Mathematical Formulation
The activation is defined as the maximum of $K$ linear transformations: $$y = \max_{k}\{a_k(x)x + b_k(x)\}$$ where $a_k(x)$ and $b_k(x)$ are functions of the input $x$. The authors propose three variations:
- DY-ReLU-A: Parameters are shared across all spatial locations and channels.
- DY-ReLU-B: Parameters are shared across spatial locations but vary per channel.
- DY-ReLU-C: Parameters adapt to both the specific channel and spatial location (pixel) using an additional attention branch.
Experimental Results
The researchers evaluated DY-ReLU on ImageNet for classification and COCO for human keypoint detection. The performance gains are remarkably high for the low cost involved:
- MobileNetV2 (0.35x): On ImageNet, Top-1 accuracy jumped from 60.3% to 66.4% (+6.1% improvement).
- MobileNetV2 (1.0x): Accuracy rose from 72.0% to 76.2% (+4.2% improvement).
- COCO Keypoint Detection: Replacing static ReLU with DY-ReLU improved the Average Precision (AP) by up to 4.0 points.
Key Insights and Discussion
- Global Context: By allowing the activation function to "see" the whole image before processing a single pixel, the network can suppress noise or highlight important features more effectively than a static ReLU.
- Dynamic "Bending": Visualization of the learned functions reveals that the activation functions "bend" more (become more complex) in the lower layers of the network and become more linear in the higher layers.
- Efficiency: All these gains were achieved with only about a 5% increase in FLOPs (Floating Point Operations), making it highly practical for real-world mobile deployment.
Conclusion
Dynamic ReLU provides a simple yet powerful way to increase the representational capacity of neural networks by making activation functions context-aware. While Variation B is generally optimal for classification, Variation C is critical for dense tasks like keypoint detection where spatial location matters. Future work may explore extending this dynamic approach to non-vision tasks like Natural Language Processing.
Summary updated