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.
Use the architecture sketch to trace how low-resolution semantic features and high-resolution localized features form a multi-scale representation. section 12.3

