PIXELBANKv9.1.0
Menu

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 C3,C4,C5C_3, C_4, C_5 are generated by the backbone, where C5C_5 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 P4P_4:

  1. Upsample C5C_5 by 2× using nearest-neighbor interpolation
  2. Element-wise add upsampled C5C_5 to C4C_4
P4=Upsample(C5,2×)+C4P_4 = \text{Upsample}(C_5, 2\times) + C_4

This technique is widely used in object detection tasks, such as those found in autonomous vehicles.

Example:

Input:
C4 (8×8, all 2s), C5 (4×4, all 4s)
Output:
8×8 matrix, all values 6.0 (upsampled 4 + original 2)
Reasoning:

Each 1×1 cell in C5 becomes a 2×2 block with value 4. Adding to C4 (value 2) gives 6.

Constraints:

  • C3C_3 dimensions: H×WH \times W (e.g., 16×16)
  • C4C_4 dimensions: H/2×W/2H/2 \times W/2 (e.g., 8×8)
  • C5C_5 dimensions: H/4×W/4H/4 \times W/4 (e.g., 4×4)
  • All values are scalar intensities
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.
FPN Feature Fusion (Simplified) - Hard | PixelBank