liveBook · Manning

Grid

As explained in Deep Learning with Python, Third Edition

A grid is a regular arrangement of positions or cells organized by rows and columns or by fixed neighboring relationships.

A grid divides an image into regular cells so a detector can make localized predictions. In a YOLO-style model, each cell predicts a bounding box, class information, and confidence; most cells usually contain no object. section 12.2.2

A 6 × 6 prediction grid

With grid_size = 6, the prediction head reshapes its output to (6, 6, num_labels + 5). Each cell stores five box values—x, y, width, height, and confidence—plus class predictions. A cell is responsible for an object whose center falls inside that cell. section 12.2.2 section 12.2.3

Grid coordinates use two representations. A normalized box is converted to a cell index and offsets within that cell; decoding reverses the operation to recover image-relative coordinates. Training targets place the class label and box at the responsible cell, while other locations receive zero confidence. section 12.2.3

When implementing a grid-based detector:

  • Treat a simple grid as a teaching model: overlapping boxes, multiple boxes per cell, and larger output grids require further design. section 12.2.4
Figure 12.4 YOLO outputs as visualized in the first YOLO paper
yolo diagram

Visualizes how YOLO associates image regions with box predictions and confidence scores. section 12.2.2

How Deep Learning with Python, Third Edition covers it

How deep it goes
Defines cell responsibility, coordinate conversion, target arrays, and prediction shapes, but defers robust overlapping-box handling.
Examples
Demonstrates a 6 × 6 YOLO grid, coordinate conversion utilities, target arrays, and decoded prediction visualizations.
What it assumes
Assumes normalized bounding boxes and class labels, while teaching their translation into cell indices and offsets.
What you can do after
Build it from scratch by encoding boxes into grid targets and decoding cell predictions into image-relative boxes.
How it connects
Connects bounding boxes, confidence scores, class labels, convolutional neural networks, and object detection.

Also explained in

Compare how 8 books explain grid →

Related concepts

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.