Back to paper library
arXiv 2015ECCV 2016Object detectionPaper notes

SSD

Save Time, Save Pooling

Original paper

SSD: Single Shot MultiBox Detector

Paper authors

Wei Liu · Dragomir Anguelov · Dumitru Erhan …

Show all 7 authors

Wei Liu · Dragomir Anguelov · Dumitru Erhan · Christian Szegedy · Scott Reed · Cheng-Yang Fu · Alexander C. Berg

Publication
ECCV 2016Conference
First submitted to arXiv
arXiv:1512.02325
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{objectdetectionssd2015,
  title = {{SSD: Single Shot MultiBox Detector}},
  author = {Wei Liu and Dragomir Anguelov and Dumitru Erhan and Christian Szegedy and Scott Reed and Cheng-Yang Fu and Alexander C. Berg},
  year = {2015},
  eprint = {1512.02325},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1512.02325}
}
On this page

Faster R-CNN was still the industry benchmark.

The common workflow typically follows these steps:

  1. Bounding Box Proposal: Use an RPN to generate candidate boxes.
  2. Feature Resampling for Each Box (RoI Pooling): Resample features for each proposed region.
  3. Classification: Send the features to a classifier.

Defining the Problem

Although these methods are accurate, their computational cost remains high, especially for embedded systems. Even the high-accuracy Faster R-CNN comparison in the paper reaches only about 7 FPS.

The authors see a bottleneck in processing and classifying each proposed region. Perhaps… we can skip that step.

Solution

Model Architecture

To address this problem, the authors proposed the SSD architecture. The image above compares SSD with YOLO-v1.

As shown, SSD eliminates region proposals and predicts directly from locations on several feature maps.

While this may seem abstract, let’s break it down step by step:

  1. First, use VGG as the backbone and extract a feature map at a 1/8 scale, sized 38×3838 \times 38.

    At each location, the network predicts class scores and location offsets for four default boxes with different scales or aspect ratios.

    This results in 38×38×4=577638 \times 38 \times 4 = 5776 candidate default boxes.


  1. The feature map is then downsampled to 19×1919 \times 19.

    Here, 6 detection boxes are predicted per pixel, so this layer predicts 19×19×6=216619 \times 19 \times 6 = 2166 boxes.


  1. Downsample the feature map again to 10×1010 \times 10.

    Six detection boxes are predicted, resulting in 10×10×6=60010 \times 10 \times 6 = 600 boxes.


  1. Downsample again to 5×55 \times 5.

    This layer predicts 6 boxes, yielding 5×5×6=1505 \times 5 \times 6 = 150 boxes.


  1. Next, downsample to 3×33 \times 3.

    This layer predicts 4 boxes, giving 3×3×4=363 \times 3 \times 4 = 36 boxes.


  1. Finally, downsample to 1×11 \times 1.

    This layer predicts 4 boxes, resulting in 1×1×4=41 \times 1 \times 4 = 4 boxes.


Adding all of these up: 5776+2166+600+150+36+4=87325776 + 2166 + 600 + 150 + 36 + 4 = 8732 candidate default boxes, before filtering and non-maximum suppression.

Positive and Negative Sample Matching Strategy

During training, we need to decide which default boxes correspond to each ground-truth box.

The default boxes vary in position, aspect ratio, and scale so they can cover objects of different shapes and sizes.

The authors use Jaccard overlap, the ratio of intersection to union (usually called IoU), to match default boxes with ground truth.

For each ground-truth box, they first select the default box with the highest IoU. This ensures that every ground-truth box has at least one match and gives the network a box from which to learn a location adjustment.

Unlike MultiBox, SSD does not stop there. It also matches default boxes with IoU greater than 0.5 against any ground-truth box. Multiple overlapping default boxes can therefore become positives instead of retaining only each ground truth's best match.

This flexibility improves the accuracy of predictions when multiple suitable predicted boxes exist.

Training Objective

SSD’s training objective extends the MultiBox loss function to handle multiple object classes.

Let xijp∈{0,1}x_{ij}^{p}\in\{0,1\} indicate whether default box ii matches ground-truth box jj of class pp. Since one ground-truth box can match several default boxes, ∑ixijp≥1\sum_i x_{ij}^{p}\geq1.

The total loss is a weighted sum of localization loss (LlocL_{loc}) and confidence loss (LconfL_{conf}):

L(x,c,l,g)=1N(Lconf(x,c)+αLloc(x,l,g))L(x, c, l, g) = \frac{1}{N}(L_{conf}(x, c) + \alpha L_{loc}(x, l, g))

Here NN is the number of matched default boxes; if N=0N=0, the loss is set to zero. Cross-validation sets α=1\alpha=1.

  • Localization Loss

    Smooth L1 loss compares the predicted offsets (ll) with the target offsets (g^\hat g) of ground truth (gg) relative to a default box (dd). As in Faster R-CNN, it regresses the center (cx,cycx,cy), width (ww), and height (hh):

    Lloc(x,l,g)=∑i∈Pos∑m∈{cx,cy,w,h}xijp⋅smoothL1(lim−g^jm)L_{loc}(x, l, g) = \sum_{i \in Pos} \sum_{m \in \{cx, cy, w, h\}} x_{ij}^p \cdot smoothL1(l^m_i - \hat{g}^m_j)

    The offsets for the ground truth boxes g^\hat{g} are computed as:

    g^jcx=gjcx−dicxdiw,g^jcy=gjcy−dicydih\hat{g}^{cx}_j = \frac{g^{cx}_j - d^{cx}_i}{d^w_i}, \quad \hat{g}^{cy}_j = \frac{g^{cy}_j - d^{cy}_i}{d^h_i} g^jw=log⁡gjwdiw,g^jh=log⁡gjhdih\hat{g}^w_j = \log \frac{g^w_j}{d^w_i}, \quad \hat{g}^h_j = \log \frac{g^h_j}{d^h_i}
  • Confidence Loss

    The confidence loss is based on softmax loss and measures the difference between predicted class scores and the true class:

    Lconf(x,c)=−∑i∈Posxijplog⁡(c^ip)−∑i∈Neglog⁡(c^i0)L_{conf}(x, c) = - \sum_{i \in Pos} x_{ij}^p \log(\hat{c}^p_i) - \sum_{i \in Neg} \log(\hat{c}^0_i)

    where c^ip\hat{c}^p_i is the predicted probability for class pp:

    c^ip=exp⁡(cip)∑qexp⁡(ciq)\hat{c}^p_i = \frac{\exp(c^p_i)}{\sum_q \exp(c^q_i)}

    Most default boxes are background after matching. The authors select harder negatives by confidence loss and keep at most a 3:1 negative-to-positive ratio, rather than training on all of them.

Predicting Box Sizes and Aspect Ratios

The scales and aspect ratios of the prediction boxes in SSD are carefully designed. Suppose we have mm feature maps for prediction. The scale sks_k of the prediction box at layer kk is calculated as:

sk=smin+smax−sminm−1(k−1),k∈[1,m]s_k = s_{\text{min}} + \frac{s_{\text{max}} - s_{\text{min}}}{m - 1}(k - 1), \quad k \in [1, m]

Here smin=0.2s_{\text{min}}=0.2 and smax=0.9s_{\text{max}}=0.9. The general formula spaces intermediate scales evenly between them.

Different aspect ratios, ar∈{1,2,3,12,13}a_r \in \{1, 2, 3, \frac{1}{2}, \frac{1}{3}\}, are used for each prediction box.

The width and height of each prediction box are:

wka=skar,hka=skarw^a_k = s_k \sqrt{a_r}, \quad h^a_k = \frac{s_k}{\sqrt{a_r}}

Additionally, an extra box is added for aspect ratio 1, with the following scale:

sk′=sksk+1s'_k = \sqrt{s_k s_{k+1}}

This set of aspect ratios generally yields six default boxes per location. In the SSD300 configuration shown above, conv4_3, conv10_2, and conv11_2 omit the 1/31/3 and 33 aspect ratios and use only four boxes each; that is how the total becomes 8,732.

The center of each box is located at:

(i+0.5∣fk∣,j+0.5∣fk∣)\left( \frac{i+0.5}{|f_k|}, \frac{j+0.5}{|f_k|} \right)

where ∣fk∣|f_k| is the size of feature map kk, and i,j∈[0,∣fk∣)i,j\in[0,|f_k|). The 0.20.2 minimum is part of the general scale formula; on VOC, SSD300 separately sets the earliest conv4_3 scale to 0.10.1.

Combining positions, scales, and aspect ratios lets SSD cover different object shapes and sizes. In the figure below, the dog's ground-truth box matches a default box on the 4×44\times4 map but not one on the 8×88\times8 map: those finer-map default boxes do not overlap the dog enough and are treated as negatives during training.

Discussion

The authors performed an extensive analysis of the model’s design and evaluated its experimental results.

Data Augmentation

Look at the first and last columns of the table above for SSD’s data augmentation.

SSD uses a broader cropping and distortion strategy similar to YOLO. In this Table 2 comparison, switching that setting raises VOC2007 test mAP from 65.5% to 74.3%, a gain of 8.8 percentage points. The authors speculate that methods with RoI pooling may benefit less, but the table does not test those methods.

Variety of Box Shapes

The design of default-box shapes significantly affects performance. The six-box configuration in this ablation includes aspect ratios 1/3,1/2,1,2,31/3,1/2,1,2,3 and one extra scale at aspect ratio 1. As noted above, not every layer of the actual SSD300 configuration uses six boxes.

  • Removing aspect ratios 1/31/3 and 33 lowers mAP from 74.3% to 73.7%, a drop of 0.6 percentage points.
  • Removing 1/21/2 and 22 as well lowers mAP to 71.6%, another 2.1 percentage points.

This supports the use of varied default-box shapes to help predict object boundaries.

Atrous Convolution

SSD uses atrous convolution in an adjusted high-level VGG16 configuration. In Table 2, a comparison with the full VGG16 base, original pool5 setting, changed fc6/fc7 subsampling, and a conv5_3 prediction map yields 74.2% mAP versus 74.3% for the original setup, but runs about 20% slower.

That comparison changes several design choices together; the speed difference cannot be attributed to atrous convolution alone.

Class Analysis

The authors conducted a detailed analysis across different classes (e.g., animals, vehicles, furniture) and studied the distribution of false positives.

The top row shows cumulative shares of correct detections and different false-positive types as the number of detections grows. The solid red line is recall under the 0.5 IoU criterion, and the dashed line uses the looser 0.1 IoU criterion; the latter is higher.

The bottom graph categorizes false positives in each class into errors due to poor localization (Loc), confusion with similar classes (Sim), confusion with other classes (Oth), and background (BG) errors.

These charts compare detections and error types among animal, vehicle, and furniture categories. Object size and aspect ratio belong to the next figure.

Object Size Analysis

The authors also explored how the size and aspect ratio of bounding boxes impact model performance.

In the left plot, very small and small objects fare noticeably worse than larger ones in several categories; for example, SSD300's chair score is around 0.09 for XS and 0.67 for M. SSD512 generally improves XS. The right plot varies by category and shows no uniform rule that a more extreme aspect ratio always means lower accuracy. The results support the choice of varied default-box shapes.

Performance on COCO Dataset

Objects in the COCO dataset are typically smaller than those in the PASCAL VOC dataset, so SSD adjusts its box sizes accordingly.

  • The minimum general box scale (smins_{\text{min}}) decreases from 0.2 to 0.15, while conv4_3 uses 0.07 (21 pixels in a 300×300 image).
  • For the SSD512 model, the minimum box scale is further reduced to 0.1, and the conv4_3 layer is set to 0.04.
  • SSD300 and SSD512 models are trained on the trainval35k dataset.
  • The training process consists of three stages: 160,000 iterations with a learning rate of 10−310^{-3}, followed by 40,000 iterations at 10−410^{-4}, and a final 40,000 iterations at 10−510^{-5}.

On COCO test-dev2015, SSD300 reaches 41.2 [email protected] and 23.2 AP@[0.5:0.95], both above the Fast R-CNN configurations in the table. Its [email protected] is 23.4, close to ION's 23.6 and Faster R-CNN's 23.5, while its [email protected] is below the latter's 45.3. These methods do not all use identical COCO training subsets.

At 512×512 input, SSD512 reaches 46.5 [email protected] and 26.8 AP@[0.5:0.95], above the table's Faster R-CNN row at 45.3 and 24.2. Its [email protected] is 27.8 versus 23.5, a 4.3-percentage-point gap according to the table; the paper's prose says 5.3%, which does not match those rows. The [email protected] gap is 1.2 percentage points.

Against that same Faster R-CNN row, SSD512 has 4.8-percentage-point higher AP and 4.6-point higher AR for large objects, versus only 1.3-point higher AP and 2.0-point higher AR for small objects. The gains are more visible for large objects in this COCO comparison; small objects remain harder.

Visual Results

Conclusion

SSD's main advantage is that it dispenses with region proposals and predicts detections directly from feature maps. That substantially improves speed while retaining strong accuracy. SSD300 reports 59 FPS and higher VOC detection accuracy than the contemporary YOLOv1; the paper's timing table measures that 59 FPS at batch size 8, while its YOLOv1 row uses batch size 1.

Additionally, SSD performs multi-scale object detection by predicting from multiple feature maps. This design allows the model to effectively detect objects of various sizes and shapes.

SSD, as an efficient object detection method, deserves further study.