A feature pyramid network (FPN) is a neural network architecture that builds a multi-scale set of feature maps from a single image, where every level carries strong semantic information and spatial detail suited to its resolution. In computer vision, it serves as the neck between a backbone and a detection or segmentation head, and it became a standard component of modern artificial intelligence systems for object detection after its introduction in 2017.
The core problem an FPN solves is scale variation: a pedestrian may occupy 20 pixels in one photo and 600 pixels in another. Earlier detectors either processed a costly image pyramid or predicted from one coarse feature map, so they missed small objects. FPN delivers multi-scale features at a modest extra cost, typically 10 to 20 percent more computation than the backbone alone.
How a feature pyramid network combines scales
An FPN works by merging two information flows: a bottom-up pathway, which is the ordinary forward pass of a backbone such as ResNet, and a top-down pathway joined to it by lateral connections. Deep layers know what objects are but have coarse resolution, while shallow layers know precisely where edges are but carry weak semantics. FPN gives every level both.
- The backbone produces stage outputs C2 to C5 at strides of 4, 8, 16 and 32 pixels.
- A 1×1 convolution projects each stage to a common width, usually 256 channels.
- Starting from the deepest level, the map is upsampled by a factor of two with nearest-neighbor interpolation and added element-wise to the next lateral projection.
- A 3×3 convolution smooths each merged map to reduce upsampling artifacts, producing outputs P2 to P5.
- Many detectors add P6 and P7 by strided convolution to cover very large objects.
The following table summarizes the standard pyramid levels and the object sizes each one typically serves. The object-to-level assignment follows these strides, so a level responds mainly to objects of matching size.
| Level | Stride | Resolution for 800 px input | Typical object size |
|---|---|---|---|
| P2 | 4 | 200 x 200 | Below 32 px |
| P3 | 8 | 100 x 100 | 32 to 64 px |
| P4 | 16 | 50 x 50 | 64 to 128 px |
| P5 | 32 | 25 x 25 | 128 to 256 px |
| P6 | 64 | 13 x 13 | Above 256 px |
Why shared heads and level assignment matter
Because every pyramid level has the same channel width, one prediction head can be shared across all levels. A shared head sees many more training examples per parameter and treats a small object at P3 the same way as a large object at P5, which is a form of scale equivariance.
In two-stage detectors such as Faster R-CNN, region proposals are assigned to a level by the rule k = floor(4 + log2(sqrt(wh) / 224)), so a region of 224 by 224 pixels maps to P4. In one-stage detectors such as RetinaNet, anchor boxes of different sizes are attached to different levels, typically from 32 pixels at P3 to 512 pixels at P7. This assignment is what turns a feature hierarchy into an effective multi-scale detector.
FPN compared with other multi-scale strategies
FPN is one of several answers to scale variation, and its value is clearest next to the alternatives. The table compares cost, accuracy on small objects and semantic quality of each approach.
| Approach | How it handles scale | Cost | Small-object accuracy |
|---|---|---|---|
| Featurized image pyramid | Runs the network on several resized images | Very high | Strong |
| Single feature map | Predicts only from the deepest layer | Low | Weak |
| Pyramidal hierarchy (SSD style) | Predicts from several backbone layers directly | Low | Moderate, shallow levels lack semantics |
| Feature pyramid network | Top-down fusion with lateral connections | Low to moderate | Strong |
| PANet and BiFPN | Adds bottom-up or weighted bidirectional fusion | Moderate | Stronger |
Later designs refine the idea rather than replace it. PANet adds a second bottom-up path so localization detail travels upward faster, NAS-FPN searches the fusion topology automatically, and BiFPN in EfficientDet uses learned weights to balance inputs. Even transformer-based backbones such as Swin Transformer and ViTDet feed a pyramid-style neck.
Where feature pyramid networks are used
FPN is a task-agnostic neck, so it appears wherever dense predictions must cover many scales. The table lists the main applications and what each one gains from the pyramid.
| Task | Representative model | Benefit of the pyramid |
|---|---|---|
| Two-stage object detection | Faster R-CNN with FPN | Better proposals and RoI features for small objects |
| One-stage object detection | RetinaNet, FCOS | Dense anchors or points on every level |
| Instance segmentation | Mask R-CNN | Sharper masks from high-resolution levels |
| Panoptic segmentation | Panoptic FPN | One neck shared by semantic and instance branches |
| Scene text detection | Segmentation-based text detectors | Handles text lines of very different heights |
In practice, engineers choose the number of levels and the channel width to match their data. Datasets with many tiny objects, such as aerial imagery, benefit from keeping P2 active, while datasets with large objects can drop P2 to save memory and latency.
Limitations and common mistakes
FPN is not free, and several of its weaknesses are well documented. The most frequent problems and their usual fixes are shown below, because misconfigured pyramids cause many silent accuracy losses.
| Symptom | Likely cause | Typical fix |
|---|---|---|
| Small objects still missed | P2 removed or anchors too large | Restore P2 or reduce minimum anchor size |
| High GPU memory use | Large P2 maps at high input resolution | Use P3 to P7 or lower input size |
| Aliasing at object edges | Missing 3×3 smoothing after upsampling | Keep the output convolutions |
| Unbalanced training across levels | Most positives fall on one level | Adjust level assignment or loss weighting |
A subtler limitation is the one-directional information flow: deep semantics reach shallow levels, but precise localization cues travel up only through the long backbone path. This motivated PANet and BiFPN. Another common misconception is that FPN alone fixes small-object detection; in reality, input resolution, anchor design and annotation quality often matter just as much.
The idea in brief
A camera picture can contain a distant bird and a nearby car at once. A feature pyramid network helps a computer look at both sizes well. It takes what the deep layers of a network understand and passes that understanding down to the detailed layers.
Think of a map service. The zoomed-out view shows which city you are in. The zoomed-in view shows single streets. FPN combines both views at every zoom level. The result is that small and large objects are found reliably, without running the network several times.
A practical scenario
A team building a traffic monitoring system must detect vehicles and pedestrians from a camera mounted on a tall pole. In each 1920 by 1080 frame, nearby trucks cover more than 400 pixels, while pedestrians at the far end of the crossing cover only 15 to 25 pixels. Their first detector, which predicted from a single stride-16 map, found the trucks but missed most distant pedestrians.
The engineers switched to a ResNet-50 backbone with an FPN neck and kept levels P2 to P6 with 256 channels. Pedestrians were now handled by the high-resolution P2 and P3 maps, while trucks fell on P5 and P6. Recall for small pedestrians rose substantially, and the added neck increased inference time by roughly 12 percent, which still met the target of 25 frames per second on the deployed GPU.