liveBook · Manning

Bounding box prediction

As explained in Deep Learning with Python, Third Edition

The model output that estimates object-localizing rectangle coordinates for an image region.

Bounding box prediction estimates an object’s rectangle inside an image. In a YOLO-style detector, each grid location emits four box values plus one confidence value, alongside class probabilities. section 12.2.2

A 6 × 6 prediction grid

Resize an image to 448 × 448, run it through a ResNet backbone, and reshape the prediction head into a 6 × 6 grid. Each cell produces five box-related values and 91 class scores. The box values are split from the class predictions; the class scores receive softmax activation. Because the dense head uses the entire feature map, a detector can use whole-image context even when an object extends across multiple cells. section 12.2.2

Use these rules when training the box output:

  • Compare predicted and target box parameters with squared error, computing placement error only for cells containing labeled objects. section 12.2.4
  • Set confidence targets to zero for empty cells; for occupied cells, use Intersection over Union (IoU) between predicted and target boxes. section 12.2.4
  • Scale placement error up, reduce empty-cell confidence error, and compare square-root-transformed width and height to prevent large boxes dominating training. section 12.2.4

How Deep Learning with Python, Third Edition covers it

How deep it goes
Explains grid outputs, custom losses, IoU targets, weighting, and visualization, but defers later postprocessing details.
Examples
Uses a 448 × 448 image, a 6 × 6 grid, 91 labels, IoU utilities, custom loss code, and drawn validation predictions.
What it assumes
Assumes convolutional backbones and classification losses, while introducing grid outputs, IoU-based confidence, and custom box loss.
What you can do after
Build it from scratch with Keras, train coordinate and confidence outputs, and inspect predicted boxes on validation images.
How it connects
Connects bounding box prediction with object detection, YOLO, convolutional neural networks, classification, confidence scores, and Intersection over Union.

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.