liveBook · Manning

Object detection

As explained in Inside Deep Learning: Math, Algorithms, Models

A vision task in which a system identifies and localizes multiple objects in a single image, often producing several predictions per image.

Object detection identifies what objects appear in one image and where they are. Unlike image classification, it can produce zero, one, or many predictions per image. section 8.0

A practical detector usually predicts a class and a bounding box for each object. A box is represented by four absolute coordinates, such as (x1, y1, x2, y2), and should tightly contain the entire object without duplicating it. section 8.4 section 8.4.2

Two common ways to obtain object locations are:

  • Image segmentation classifies every pixel as an object category or background, then connected regions can reveal each object. It is precise but requires expensive pixel-level labels. section 8.1
  • Bounding-box detection finds candidate locations in one pass and classifies the objects found there. Faster R-CNN combines a convolutional backbone with networks for proposing regions and deciding their classes. section 8.4 section 8.7
  • Non-maximum suppression reduces false positives by filtering overlapping predictions. section 8.7

A minimal PyTorch detection dataset

A toy MNIST detector places a random number of digits on a 100 × 100 canvas. Each sample returns an image and a dictionary: boxes has shape (k, 4), while labels has shape (k), allowing k to vary between images. Faster R-CNN receives lists of images and dictionaries through a custom collate function rather than a padded tensor batch. section 8.4.2

Figure 8.8 A stop sign as the target for bounding-box-based object detection. The green box shows the ground truth, a box just large enough to contain the entire object. The red box shows a potential prediction, which is close but not quite correct. Water doesn’t obey the whimsical desires of the lowly stop sign.

Use the stop-sign diagram to compare a ground-truth box with a nearby but imperfect prediction. section 8.4

How Inside Deep Learning: Math, Algorithms, Models covers it

How deep it goes
Descends from task definition to segmentation, bounding boxes, Faster R-CNN components, target formats, batching, training, and inference.
Examples
Uses birds, horses, people, cars, stop signs, and synthetic MNIST digits to illustrate detection targets and predictions.
What it assumes
Assumes familiarity with image classification and CNNs while teaching variable object counts, box coordinates, and detector-specific batches.
What you can do after
Build it from scratch with PyTorch data targets, custom collation, Faster R-CNN training, inference, and plotted predictions.
How it connects
Connects image classification, image segmentation, convolutional neural networks, bounding boxes, Faster R-CNN, and non-maximum suppression.

Also explained in

Compare how 5 books explain object detection →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Inside Deep Learning: Math, Algorithms, Models. The section links point to the parts of the book it draws on.