Foundations to Frontier
Tests
E. Deep Learning › E9 Object Detection Architectures

SSD

SSD, the Single Shot MultiBox Detector (Liu et al., 2016), detects objects in one pass with no proposal stage. Small convolutional heads on six feature maps of decreasing resolution score a fixed set of default boxes for every class and regress their offsets; maps at 38 × 38 handle small objects and 1 × 1 the largest. SSD300 reached 74.3% mAP on VOC 2007 at 59 frames per second, faster and more accurate than Faster R-CNN. This page covers default boxes and their scales, matching, hard-negative mining and augmentation. In the exercises you reproduce SSD300's 8,732 default boxes, then match them to objects: positives are outnumbered about 225 to 1, and objects under 32 pixels match only 2.8 default boxes on average against 12–14 for larger ones.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Detect everything in one look

Two-stage detectors first propose regions, then classify them. SSD does both at once. It lays a fixed grid of “default boxes” of several shapes over several feature maps, fine maps for small objects and coarse maps for large ones. For every default box it directly predicts the class scores and a small box correction. One forward pass gives all detections, fast enough for real-time video.

Detection lab
kept 7 of 14 boxes above the score threshold (3 objects). Too high an IoU threshold keeps duplicates; too low merges neighbouring objects.
Why engineers care

Single-shot detectors like SSD, especially SSD with MobileNet backbones, made real-time detection possible on phones, drones and embedded robot computers.

📝 Quick check (Level 0)
0/3 answered
  1. 1. SSD has a proposal stage?
  2. 2. Fine feature maps handle…
  3. 3. SSD predicts for each default box…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Feature maps for SSD300: 38, 19, 10, 5, 3 and 1, with 4, 6, 6, 6, 4 and 4 default boxes per cell. That gives 5,776 + 2,166 + 600 + 150 + 36 + 4 = 8,732 boxes.
  • Scales: s_k = s_min + (s_max − s_min)(k − 1)/(m − 1), with s_min = 0.2, s_max = 0.9 and m = 6, giving 0.2, 0.34, 0.48, 0.62, 0.76 and 0.9 of the image. The released SSD300 puts 0.1 (30 pixels) on the 38 × 38 map.
  • Shapes per cell: aspect ratios 1, 2, ½ (and 3, ⅓ on 6-box maps) at scale s_k, plus a square at √(s_k s_(k+1)).
  • Outputs: per cell, k(C + 1) class scores and 4k offsets. With 6 boxes and 20 classes that is 126 scores and 24 offsets.
  • Matching: each object’s best default box, plus any with IoU > 0.5, is positive.
  • Loss: softmax confidence plus α·smooth-L1 localisation (α = 1), averaged over positives.
  • Hard-negative mining: keep the highest-loss negatives at 3:1 to positives.
📝 Quick check (Level 1)
0/3 answered
  1. 1. SSD300's default boxes:
  2. 2. Negative-to-positive ratio after mining:
  3. 3. Matching IoU threshold:

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

SSD in code

Exercise 1.

  • The scale formula gave 0.2 to 0.9.
  • The box count was 8,732, of which 5,776 are on the 38 × 38 map.
  • Hard-negative mining kept the three highest-loss negatives per positive.
  • The head sizes matched.

Practice.

  • torchvision’s ssd300_vgg16 and ssdlite320_mobilenet_v3_large implement SSD.

  • Backbone: VGG-16 with fc6 and fc7 converted to (dilated) convolutions, plus extra layers. conv4_3 features are L2-normalised with a learned scale, because their magnitude differs from deeper layers.

  • Augmentation is crucial:

    • random crops that must contain objects;
    • “zoom out”, placing the image on a larger canvas to create small objects;
    • photometric distortions.

    Zoom-out added 2–3 mAP points.

  • Inference: keep the top 200 detections per image after per-class NMS at IoU 0.45.

model = torchvision.models.detection.ssdlite320_mobilenet_v3_large(weights="DEFAULT")   # real-time on CPU
🐍 Exercise 1: default boxes and mining
Compute SSD scales and default-box counts, hard-negative mining and the head's output sizes.
📝 Quick check (Level 2)
0/3 answered
  1. 1. conv4_3 features are…
  2. 2. 'Zoom out' augmentation creates…
  3. 3. torchvision's mobile SSD:

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Single shot versus two stages.

  • Two-stage detectors resample features for each proposal (RoI pooling), which is accurate but sequential.
  • SSD predicts directly from fixed positions on the feature maps, so detection is one fully convolutional pass.
  • Default boxes play the role of anchors, but each is classified into C + 1 classes directly, with no proposal filtering.

Class imbalance. Thousands of default boxes but few objects means most predictions are easy background. Without countermeasures the loss is dominated by these easy negatives, and training is slow and unstable. SSD sorts negatives by loss and keeps the top three per positive. RetinaNet (E9-10) later replaced this with the focal loss.

Small objects. The finest map (38 × 38, stride 8 for 300 pixels) is shallow and semantically weak, and its smallest boxes are 30 pixels. Small objects match few default boxes (exercise 2) and are detected poorly. SSD512 and zoom-out augmentation help. FPN-style top-down features (E9-5) and DSSD addressed it more directly.

Results.

  • SSD300: 74.3% mAP on VOC 2007 at 59 frames per second (Titan X).
  • SSD512: 76.8% at 22 frames per second.
  • For comparison, Faster R-CNN reached 73.2% at 7 frames per second, and YOLOv1 63.4% at 45.
📝 Quick check (Level 3)
0/3 answered
  1. 1. SSD avoids which step of two-stage detectors?
  2. 2. SSD's answer to class imbalance:
  3. 3. SSD300's speed:

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How do default boxes meet objects?

History.

  • W. Liu, D. Anguelov, D. Erhan, C. Szegedy, S. Reed, C.-Y. Fu and A. Berg (2016) introduced SSD at ECCV.
  • J. Redmon et al. (2016) introduced YOLO (E9-7), the other early single-shot detector.
  • C.-Y. Fu et al. (2017) proposed DSSD with deconvolutional context; MobileNet-SSD and SSDLite became standard on mobile.

Exercise 2. This is a calculation, not a training run. It builds SSD300’s default boxes and 200 synthetic images, each with 4 objects of 12 to 250 pixels and aspect ratios ½ to 2. It matches defaults to objects by SSD’s rule and counts positives and the default boxes matched per object:

object size matched default boxes per object
small (under 32 px) 2.8
medium (32–96 px) 12.5
large (over 96 px) 13.7
  • The count reproduces SSD300’s 8,732 default boxes.
  • Positives are rare: about 39 per image against 8,693 negatives, 225 to 1. Hard-negative mining at 3:1 keeps about 116 negatives per image, so the loss is not swamped.
  • Small objects get few matches, mostly through the best-match rule, because the smallest default boxes are 30 pixels. Fewer positive examples per small object are one reason SSD is weaker on small objects.
🐍 Exercise 2 (research): how do default boxes meet objects?
Build SSD300's default boxes, match them to synthetic objects, and measure the positive–negative imbalance and matches by object size.

SSD in AI, robotics and aerospace

  • Embedded real-time detection: SSD and SSDLite with MobileNet backbones run on drones, robots and phones for people, vehicle and obstacle detection.
  • Edge accelerators: SSD-MobileNet is a standard benchmark model for embedded AI chips used in robotics.
  • Small objects: for distant targets from aircraft, add higher-resolution maps or FPN-style features, or use SSD512.

References

  1. W. Liu et al. (2016). “SSD: single shot MultiBox detector.” Proc. ECCV.
  2. J. Redmon, S. Divvala, R. Girshick, A. Farhadi (2016). “You only look once: unified, real-time object detection.” Proc. CVPR.
  3. C.-Y. Fu, W. Liu, A. Ranga, A. Tyagi, A. C. Berg (2017). “DSSD: deconvolutional single shot detector.” arXiv:1701.06659.