TL;DR
SSD is a single convolutional network that finds objects in an image in one forward pass. Instead of first proposing boxes and then resampling pixels for each one, it predicts, at every location of several feature maps, a score for each object class and a correction to a fixed set of default boxes. It handles different object sizes by using feature maps of different resolutions. The paper reports 74.3% mAP on PASCAL VOC2007 at 59 frames per second with a 300 by 300 input, using batched inference.
Builds on: Anchor Box, Cross-Entropy Loss, Bounding-Box Regression, Intersection over Union, Non-Maximum Suppression · Leads to: Object Detection, Region Proposal Network
Why it mattered
Before SSD, the accurate detectors were slow. The paper's introduction calls Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks the fastest high-accuracy detector of its time, and notes that it runs at only 7 frames per second. It also says that earlier attempts at speed lost accuracy. SSD showed that a single network could match the proposal-based accuracy at real-time speed. To the authors' knowledge, its 300 by 300 model is the first real-time method to pass 70% mAP on VOC2007 (Section 3.7).
The authors designed the model to be simple to train and to fit into larger systems. The abstract says it "encapsulates all computation in a single network", which makes it "easy to train and straightforward to integrate into systems that require a detection component". Their conclusion names video tracking as a future use, which is a claim about a direction, not a result.
The default-box idea is the paper's version of the Anchor Box used in Faster R-CNN, applied to several feature maps rather than one. The paper compares itself directly with You Only Look Once: Unified, Real-Time Object Detection, the earlier single-stage method. In Section 3.3 it says its large accuracy gain over YOLO is "likely due to" the default boxes on multiple feature maps and its matching strategy. That is the authors' explanation, not a separate experiment.
The problem
Detection has two outputs for every object: where it is and what it is. The proposal-based pipeline first guesses boxes, then crops or pools features for each guess, then classifies each crop. This is accurate, but the crop-and-classify step runs once per proposal, which is expensive. Speeding up each stage had cost accuracy.
The paper asks whether the network can skip proposals and still be accurate. Three things have to work for that. The network must produce predictions for the whole range of box shapes and sizes, without a proposal step to supply them. Ground-truth boxes must be assigned to a fixed set of outputs during training. And the many background predictions must not swamp the few object predictions in the loss. The paper gives a specific answer to each.
How it works
The network has three parts: a base network, extra feature layers, and a set of small prediction filters. The diagram shows the path from an image to the final detections.
flowchart LR A["Input image 300 by 300"] --> B["Base network: VGG-16 without its classifier"] B --> C["Extra layers give feature maps at decreasing sizes"] C --> D["3 by 3 filters on each map: class scores and 4 offsets per default box"] D --> E["Training: match default boxes to ground truth at IoU 0.5"] D --> F["Test: confidence above 0.01, NMS at 0.45, keep top 200"]
Trace one tiny case through the detector. Keep the numbers small.
- Start from a feature map. Take a feature map of size 4 by 4. Each of its 16 cells is a location. Check: 4 times 4 is 16 locations.
- Place default boxes at each location. At each cell, place a fixed set of boxes. The paper uses 6 per location on most layers: aspect ratios 1, 2, 3, 1/2 and 1/3, plus one extra box of intermediate scale for aspect ratio 1. The boxes are fixed in position relative to the cell and are not learned. Check: 16 locations times 6 boxes is 96 default boxes on this map.
- Predict per box. For each default box, the network predicts a score for each of the c classes and 4 offsets that move the default box centre and resize it. The c scores include background, which the confidence loss treats as class 0. For VOC that is 20 object classes plus background, so c = 21. A 3 by 3 filter does this at every location, so the output has (c + 4) times k values per location. With k = 6 that is 25 times 6, or 150 values per location, and 2400 values for the whole 4 by 4 map. Check: 150 times 16 is 2400.
- Combine maps. Repeat step 3 on several feature maps of different sizes and add the results. This is why one object can be found by a coarse map and another by a fine one.
- Match during training. Each ground-truth box is first matched to the default box with the best overlap. Then every default box whose overlap with any ground truth is above 0.5 is also matched to it. The rest are negatives. Check: one object can have several positive default boxes.
- Compute the loss. The loss adds a softmax classification term over the matched and hard-negative boxes to a localisation term on the matched boxes. The two are summed with a weight of 1.
- Filter at test time. Keep only boxes whose score is above 0.01, run non-maximum suppression per class with overlap 0.45, and keep the top 200 detections. Check: the filtering is the only extra work the detector does after the network.
The paper's systems numbers come from this loop. On an NVIDIA Titan X, the 300 by 300 model runs at 59 frames per second with batch size 8, and the post-processing takes 1.7 milliseconds per image. The rest of the time goes mostly to the base network, which the paper says takes about 80% of the forward time.
The math
The objective, the matching rule and the box encoding all come from the paper. Symbols are named in words the first time they appear.
Here is 1 if default box is matched to ground-truth box of class , and 0 otherwise. The paper sets by cross-validation.
Step 5 in symbols: matching
Each ground truth is matched to its best default box. Then any default box whose Jaccard overlap (intersection over union) with some ground truth is above 0.5 is matched too. Because one object can match several boxes, the sum can be greater than 1. The paper says this makes it easier for the network to give high scores to several overlapping boxes than to pick one.
Step 6 in symbols: the two loss terms
The localisation loss is a Smooth L1 loss on the offsets of the centre and size of each matched box. The regression targets are encoded relative to the default box :
Smooth L1 (from the Fast R-CNN paper, cited as [6]) is quadratic for errors below 1 and linear beyond that, so large outliers pull less than they would under a squared loss. The classification loss is a softmax cross-entropy:
Class 0 is background. The negative sum runs over the mined negatives, not all of them, which is the next step.
Step 2 in symbols: the default boxes
For feature maps, the scale of the boxes on map is
with and . A box with aspect ratio has width and height .
Worked numbers. With , the step is , so the scales are 0.2, 0.375, 0.55, 0.725 and 0.9. For a box on the first map with : width and height , both as fractions of the image side. This box is wide: its width is twice its height. Its area is , the same as the square box .
Step 5b in symbols: hard negative mining
Most default boxes are background. The paper sorts the negatives by their confidence loss and keeps the largest ones so that the number of negatives is at most three times the number of positives. For 4 positive boxes, that means the 12 hardest negatives are kept and the rest are ignored.
Results
The table below copies the paper's Table 1 and Table 7 values for VOC2007 test. The abstract and the introduction quote some of the same numbers with different values, which the table notes below explain.
| Method | Training data | mAP | FPS | Input |
|---|---|---|---|---|
| Faster R-CNN (VGG16) | 07+12 | 73.2% | 7 | about 1000 by 600 |
| Fast YOLO | 07+12 | 52.7% | 155 | 448 by 448 |
| YOLO (VGG16) | 07+12 | 66.4% | 21 | 448 by 448 |
| SSD300 | 07+12 | 74.3% | 46 (batch 1), 59 (batch 8) | 300 by 300 |
| SSD512 | 07+12 | 76.8% | 19 (batch 1), 22 (batch 8) | 512 by 512 |
All rows come from the paper's Table 7. The SSD mAP values also appear in Table 1 with the same numbers. Other numbers from the paper:
- Table 1, VOC2007, training on 07 only: SSD300 68.0%, SSD512 71.6%, Faster R-CNN 69.9%. With 07+12: SSD300 74.3%, SSD512 76.8%, Faster R-CNN 73.2%.
- Table 1, with COCO pre-training and 07+12 fine-tuning: SSD512 81.6%, the best reported in the paper's table.
- Table 2, data augmentation: removing the sampling strategy drops SSD300 from 74.3% to 65.5%. The paper calls this an 8.8 point gain.
- Table 2, aspect ratios: removing the 1/3 and 3 boxes costs 0.6 points; also removing 1/2 and 2 costs another 2.1 points.
- Table 5, COCO test-dev: SSD512 reaches 26.8 AP at IoU 0.5 to 0.95 and 46.5 AP at IoU 0.5, against 24.2 and 45.3 for the Faster R-CNN row the paper lists.
- Table 6, zoom-out augmentation: SSD512 with the new augmentation reaches 79.8% on VOC2007 (07+12) and 83.2% (07+12+COCO).
Notes on the numbers. The abstract gives 72.1% mAP at 58 FPS for 300 by 300 and 75.1% for 500 by 500. Table 1 and Table 7 give 74.3% and 76.8%, and the introduction gives 59 FPS and 74.3% mAP. The tables are the detailed source, so this lesson uses them. The introduction also gives YOLO as 63.4% at 45 FPS, while Table 7 lists YOLO at 66.4% and 21 FPS. Table 3 is also worth a careful read: the text says the mAP drops monotonically as layers are removed, but the table's second row, with conv11_2 removed, is 74.6%, a little above the full model's 74.3%.
Limits. The results are on three datasets, with a VGG-16 base network. Small objects are the weak spot: the paper says SSD is "very sensitive" to box size and does much worse on small objects. The zoom-out augmentation helps small objects, but the paper also says the default-box tiling is an open question. The Titan X timings are from one GPU with the authors' Caffe code, so the speeds are not comparable across hardware without rerunning them.
Reading guide
- Abstract and Section 1 need Object Detection and Intersection over Union. The contribution list in Section 1 is the paper's claims in short form.
- Section 2.1, Model needs Convolutional Neural Network, Very Deep Convolutional Networks for Large-Scale Image Recognition (VGG) and Receptive Field. Figure 1 shows the 8 by 8 and 4 by 4 maps used for explanation.
- Section 2.1, default boxes needs Anchor Box, since the paper says its default boxes are similar to Faster R-CNN's anchors.
- Section 2.2, Matching and training objective needs Intersection over Union, Bounding-Box Regression, Cross-Entropy Loss and Softmax.
- Section 2.2, Scales and aspect ratios needs Receptive Field: the paper notes that default boxes need not match the actual receptive fields, but it still ties each map to a range of object scales.
- Section 2.2, Hard negative mining and augmentation needs Data Augmentation.
- Section 3, Experiments is a set of tables. Read Table 1 and Table 7 first, then Table 2 for the design choices.
- Section 3.7, Inference time needs Non-Maximum Suppression.
- Section 4, Related work needs Region Proposal Network and Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks for the comparison with proposal methods.