Skip to content
Search

Single Shot MultiBox Detector

lastmod 2025-03-28created 2016-12-0927 edits

SSD: Single Shot MultiBox Detector.

Abstract

We present a method for detecting objects in images using a single deep neural network. Our approach, named SSD, discretizes the output space of bounding boxes into a set of default boxes over different aspect ratios and scales per feature map location. At prediction time, the network generates scores for the presence of each object category in each default box and produces adjustments to the box to better match the object shape. Additionally, the network combines predictions from multiple feature maps with different resolutions to naturally handle objects of various sizes. Our SSD model is simple relative to methods that require object proposals because it completely eliminates proposal generation and subsequent pixel or feature resampling stage and encapsulates all computation in a single network. This makes SSD easy to train and straightforward to integrate into systems that require a detection component. Experimental results on the PASCAL VOC, MS COCO, and ILSVRC datasets confirm that SSD has comparable accuracy to methods that utilize an additional object proposal step and is much faster, while providing a unified framework for both training and inference. Compared to other single stage methods, SSD has much better accuracy, even with a smaller input image size. For 300×300 input, SSD achieves 72.1% mAP on VOC2007 test at 58 FPS on a Nvidia Titan X and for 500×500 input, SSD achieves 75.1% mAP, outperforming a comparable state of the art Faster R-CNN model. Code is available at this https URL.

Python2 -> Python3 migration

  1. Change every xrange function in caffe/model_libs.py and the SSD-related python files to range.
  2. Remove assert len > 0 from caffe/model_libs.py.
  3. Convert every pad variable computed as a floating-point value in the VGGNetBody function of caffe/model_libs.py to an integer. (e.g. pad = int(pad))

Performance Test

  • Ubuntu 16.04 LTS
  • weiliu89-caffe-ssd master
  • Intel Xeon(R) CPU E5-2698 v4 @ 2.20GHz * 40
  • Tesla V100-DGXS-16GB/PCIe/SSE2
  • OS-Type 16bit
  • Memory 251.8GiB
  • Disk: 7.6TB

SSD 300x300 results

  • About 0.017ms ~ 0.025ms per run.
  • Only 1 GPU used.
  • 1374MiB of GPU memory required per processor
  • 100 iterations per processor, 11 processors in total (1100 images in total) -> average 32.450ms
  • Temperature: increased from 43 to 46 degrees
  • Power: increased from 68W to 100~200W
  • GPU utilization: 60~70%

For reference, with 100 iterations per processor and only 1 processor, it takes about 26.733~27.467ms.

Category

Troubleshooting

Protobuf TypeError

When using SSD with Python3, the following error may occur.

Traceback (most recent call last):
  File "asset/models/ssd/ssd_pascal.py", line 460, in <module>
    print(net.to_proto(), file=f)
  File "/Users/your/Project/cyclops/script/pycaffe/caffe/net_spec.py", line 211, in to_proto
    top._to_proto(layers, names, autonames)
  File "/Users/your/Project/cyclops/script/pycaffe/caffe/net_spec.py", line 101, in _to_proto
    return self.fn._to_proto(layers, names, autonames)
  File "/Users/your/Project/cyclops/script/pycaffe/caffe/net_spec.py", line 164, in _to_proto
    _param_names[self.type_name] + '_param'), k, v)
  File "/Users/your/Project/cyclops/script/pycaffe/caffe/net_spec.py", line 75, in assign_proto
    getattr(proto, name).extend(val)
  File "/Users/your/.pyenv/versions/3.5.3/envs/__your_pyclops_opy_3.5.3__/lib/python3.5/site-packages/google/protobuf/internal/containers.py", line 275, in extend
    new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
  File "/Users/your/.pyenv/versions/3.5.3/envs/__your_pyclops_opy_3.5.3__/lib/python3.5/site-packages/google/protobuf/internal/containers.py", line 275, in <listcomp>
    new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
  File "/Users/your/.pyenv/versions/3.5.3/envs/__your_pyclops_opy_3.5.3__/lib/python3.5/site-packages/google/protobuf/internal/type_checkers.py", line 133, in CheckValue
    raise TypeError(message)
TypeError: 1.0 has type <class 'float'>, but expected one of: (<class 'int'>,)

This happens because a Protobuf type is not correct. It most likely occurs when moving from Python2 to Python3, because the result of division changes from int to float.

For debugging, add print statements as follows.

  • caffe/net_spec.py
# ...
def assign_proto(proto, name, val):
    # ...
            print("* Debugging name: " + name) ## 디버깅을 위해 추가한다.
            getattr(proto, name).extend(val)
    # ...
# ...
  • caffe/net_spec.py
# ...
class Function(object):
    # ...
    def _to_proto(self, layers, names, autonames):
        # ...
        layer.name = self._get_name(names, autonames)
        print("layer.name: " + layer.name) ## 디버깅을 위해 추가한다.
        # ...
# ...

This way you can tell which attribute of which layer is the problem.

Documentation

SSD - Single Shot MultiBox Detector
https://arxiv.org/abs/1512.02325
1512.02325v4.pdf
1512.02325v5.pdf
SSD - Single Shot MultiBox Detector - eccv2016 slide
http://www.cs.unc.edu/%7Ewliu/papers/ssd_eccv2016_slide.pdf
Ssd_eccv2016_slide.pdf
weiliu89-caffe-ssd master
https://github.com/weiliu89/caffe/tree/ssd
Caffe-ssd-77c1c51.zip
Caffe-ssd-efdc164.zip
A PyTorch Implementation of Single Shot MultiBox Detector
https://github.com/amdegroot/ssd.pytorch
Single Shot MultiBox Detector Implementation in Pytorch
MobileNetV1, MobileNetV2, VGG based SSD/SSD-lite implementation in Pytorch 1.0 / Pytorch 0.4. Out-of-box support for retraining on Open Images dataset. ONNX and Caffe2 support. Experiment Ideas like CoordConv.
https://github.com/qfgaohao/pytorch-ssd
Understand Single Shot MultiBox Detector (SSD) and Implement It in Pytorch

See also

Favorite site

References


  1. DeepLAB_library_4027_-SSD-_Single_Shot_MultiBox_Detector.pdf ↩

  2. Sogangori_-Single_Shot_MultiBox_Detector-_Review.pdf ↩

author Zer0 sitemap