liveBook · Manning

Chapter 12: Object detection

What you will learn in chapter 12 of Deep Learning with Python, Third Edition

This introduction defines object detection through bounding boxes and explains when it is preferable to image segmentation.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction defines object detection through bounding boxes and explains when it is preferable to image segmentation.

Key terms: object detection, bounding boxes, counting, tracking, cropping, segmentation mask, pixel-level information, pixel-precise masks

12.1 Single-stage vs. two-stage object detectors

Introduces the two broad families of object detectors and identifies region proposals as the first step of two-stage detectors.

Key terms: two-stage detectors, region proposals, Region-based Convolutional Neural Networks (R-CNN), single-stage detectors, RetinaNet, You Only Look Once

12.1.1 Two-stage R-CNN detectors

This section explains how two-stage R-CNN detectors turn proposed image regions into object detections, how proposal generation changed over time, and why the approach can be too costly for some applications.

Key terms: R-CNN, region proposals, bounding boxes, ConvNet, class-presence score, Selective Search, heuristic, Faster-R-CNN, Region Proposal Network, two-stage approach

12.1.2 Single-stage detectors

This section defines single-stage object detectors and explains their speed–accuracy tradeoff relative to two-stage detectors.

Key terms: single-stage detector, bounding box coordinates, labels, YOLO, RetinaNet, Single Shot MultiBox Detectors (SSD), single-stage detectors, two-stage counterparts, real-time applications

12.2 Training a YOLO model from scratch

The section explains why the from-scratch example uses the original YOLO model: object detection requires substantial implementation work, and that version is simpler to work with.

Key terms: object detector, bounding boxes, predicted output, original YOLO model

12.2.1 Downloading the COCO dataset

This section prepares COCO images and bounding-box annotations for a runnable YOLO training example.

Key terms: COCO dataset, object labels, bounding box annotations, segmentation masks, image metadata, JSON file, ID, collate, bounding box, x, y, width, height

12.2.2 Creating a YOLO model

This section builds a simplified YOLO detector by adding grid-based box and class predictions to a pretrained ConvNet backbone.

Key terms: single stage detector, grid, bounding box, class label, confidence score, ConvNet backbone, ResNet, pretrained backbone, strided conv layer, feature maps

12.2.3 Readying the COCO data for the YOLO model

This section converts COCO annotations into grid-aligned YOLO targets and prepares images for batched training.

Key terms: grid detector, grid cell, x, y, w, h, class probability map, boxes, confidence, grid

12.2.4 Training the YOLO model

This section defines the losses used to train a YOLO detector and interprets the limited results of a short training run.

Key terms: predicted boxes, predicted grid labels, sparse_categorical_crossentropy, sum-squared error, box confidence, Intersection over Union (IoU), target confidence value, box placement loss, confidence loss, square root

12.3 Using a pretrained RetinaNet detector

The section explains how RetinaNet’s feature pyramid helps detect objects at different scales, then uses a pretrained detector on a painting to illustrate its predictions and generalization.

Key terms: feature pyramid network, Conv2DTranspose, lateral connections, feature maps, KerasHub, ObjectDetector, rel_xywh, bounding boxes, confidences, labels

12.4 Summary

Concepts explained in this chapter

← Chapter 11: Image segmentation Chapter 13: Timeseries forecasting →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.