A single-stage detector skips the proposal step and predicts boxes straight from a grid. Build the grid encoding and decoding by hand, match objects to anchor shapes, then run YOLOv8 and an SSD and measure how much faster they are than the Faster R-CNN from Lab 5.
Divide the image into an S × S grid. For a box, find its centre, the cell that contains the centre, and the centre's offset inside that cell. Decoding reverses every step.
Every cell predicts B boxes and C class probabilities. Each box has five numbers: an objectness score c, the offsets x and y, and the width w and height h.
Anchors are preset box shapes. Only width and height are compared, as if both boxes shared a centre. This lets one cell specialise: tall objects to one anchor, wide objects to another.
Training adds up errors on where the box is, whether anything is there and what it is. Choose a term to see what it penalises.
A coarse grid cannot see an object smaller than a cell. YOLOv3, SSD and later models predict from several feature maps with different strides, so each object size has a suitable grid.
Compute per image is a guide to speed. Published figures for the detectors you run in this lab are below. Compare accuracy (COCO box AP) with compute (GFLOPs).
The time column is only compute divided by a sustained TFLOPS figure you choose. It ignores memory traffic, pre- and post-processing and NMS, and real hardware rarely sustains its peak. Measure your own FPS in Task 7. AP and GFLOPs are taken from the model documentation of each library and may differ between versions and input sizes.
Copy each cell into Colab and run them in order. Tasks 1 to 4 use NumPy only. Task 5 uses PyTorch (Ultralytics) and Task 6 uses TensorFlow, so you can do either in one runtime. Task 7 times everything on the same machine. Comments in the code explain each step.
Answers are saved in this browser only. Open a hint after you have tried.