liveBook · Manning

RetinaNet

As explained in Deep Learning with R, Third Edition

RetinaNet is a one-stage object detection architecture designed to detect objects in images using convolutional feature representations and classification and localization heads.

RetinaNet is a single-stage object detector that predicts object classes and bounding boxes in one step. Its Feature Pyramid Network combines semantically rich deep features with high-resolution early features, helping detect both small and large objects. section 12.3 section 12.4

Run a pretrained detector

Use a COCO-trained Keras Hub preset, then inspect and draw its detections: `detector <- keras_hub$models$ObjectDetector$from_preset("retinanet_resnet50_fpn_v2_coco", bounding_box_format = "rel_xywh")` `predictions <- predict(detector, list(image))` The result contains `boxes`, `confidence`, `labels`, and `num_detections`; each box can be rendered with its COCO label. section 12.3

The architecture addresses a central limitation of using only final convolutional features:

  • Combines upsampled deep features with same-sized features from earlier convolutional layers through lateral connections. section 12.3
  • Builds feature maps at multiple scales, improving detection across different object pixel sizes. section 12.4
  • Runs classification and localization as a single-stage detector, favoring speed and efficiency over two-stage region-proposal workflows. section 12.4 section 12.1
Figure 12.8 An FPN creates semantically interesting feature maps at different scales.
figure

Use the FPN diagram to see how feature maps at different scales retain semantic information while representing differently sized image regions. section 12.3

How Deep Learning with R, Third Edition covers it

How deep it goes
Explains FPN upsampling and lateral connections, but does not detail RetinaNet training or loss functions.
Examples
Demonstrates COCO inference on A Sunday Afternoon on the Island of La Grande Jatte with bounding boxes, labels, and confidence scores.
What it assumes
Assumes basic object-detection concepts such as bounding boxes and convolutional features while demonstrating inference concretely.
What you can do after
Operate a pretrained RetinaNet detector through Keras Hub and render its predicted bounding boxes and labels.
How it connects
Connects object detection with convolutional neural networks, YOLO, R-CNNs, and Feature Pyramid Networks.

Related concepts

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