FPN Feature Fusion (Simplified)
Implement a Feature Pyramid Network (FPN) fusion module, a crucial component in ConvNext architectures for multi-scale object detection. This module combines low-resolution semantic features with high-resolution spatial features.
The Feature Pyramid Network (FPN) is a technique used to leverage the benefits of both high-resolution and low-resolution feature maps. In a typical ConvNext architecture, feature maps are generated by the backbone, where is the deepest and smallest map. To fuse these features, the FPN uses a top-down pathway with upsampling and element-wise addition.
Here are the steps to compute :
- Upsample by 2× using nearest-neighbor interpolation
- Element-wise add upsampled to
This technique is widely used in object detection tasks, such as those found in autonomous vehicles.
Example
C4 (8×8, all 2s), C5 (4×4, all 4s)
8×8 matrix, all values 6.0 (upsampled 4 + original 2)
Each 1×1 cell in C5 becomes a 2×2 block with value 4. Adding to C4 (value 2) gives 6.
Constraints
- dimensions: (e.g., 16×16)
- dimensions: (e.g., 8×8)
- dimensions: (e.g., 4×4)
- All values are scalar intensities