liveBook · Manning

Feature pyramid network

As explained in Deep Learning with Python, Third Edition

An architecture that merges multi-scale feature maps from different depths to support detection of objects at multiple sizes.

A feature pyramid network (FPN) helps an object detector recognize objects with different pixel footprints. Final ConvNet layers provide semantically meaningful object representations but low-resolution maps; early layers preserve high-resolution details but mostly represent simple features such as edges and curves. section 12.3

RetinaNet inference

A RetinaNet preset exposes the pattern directly: detector = keras_hub.models.ObjectDetector.from_preset("retinanet_resnet50_fpn_v2_coco", bounding_box_format="rel_xywh"). Calling detector.predict(image) returns boxes, confidence scores, labels, and the number of detections. The detector can then draw each predicted box and its COCO label on the image. section 12.3

The construction follows a practical rule:

  • Upsample final ConvNet features progressively with Conv2DTranspose layers. section 12.3
  • Add lateral connections by summing each upsampled map with the same-sized map from the original ConvNet. section 12.3
  • Use the resulting semantically meaningful maps at multiple scales to improve detection of small and large objects. section 12.3 section 12.4
Figure 12.8 A feature pyramid network creates semantically interesting feature maps at different scales.
feature pyramid network

Use the architecture sketch to trace how low-resolution semantic features and high-resolution localized features form a multi-scale representation. section 12.3

How Deep Learning with Python, Third Edition covers it

How deep it goes
Explains upsampling and lateral summation, but stops short of mathematical derivation or detailed layer design.
Examples
Uses RetinaNet COCO inference on a Pointillist painting, with predicted boxes, labels, confidence scores, and plotted detections.
What it assumes
Assumes familiarity with ConvNet layers and feature maps while clarifying why early and late representations serve different detection needs.
What you can do after
Apply it via KerasHub by loading a RetinaNet preset, predicting detections, and visualizing labeled bounding boxes.
How it connects
Connects object detection, ConvNets, RetinaNet, YOLO, single-stage detectors, and Conv2DTranspose layers.

Also explained in

Compare how 2 books explain feature pyramid network →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with Python, Third Edition. The section links point to the parts of the book it draws on.