Awesome Open Source
Awesome Open Source


Caffe implementation of SSD detection on MobileNetv2, converted from tensorflow.


Tensorflow and Caffe version SSD is properly installed on your computer.


  1. Firstly you should download the original model from tensorflow.
  2. Use to generate the train.prototxt and deploy.prototxt (or use the default prototxt).
python -s deploy -c 91 >deploy.prototxt
  1. Use to dump the weights of conv layer and batchnorm layer.
  2. Use to load the dumped weights to deploy.caffemodel.
  3. Use the code in src to accelerate your training if you have a cudnn7, or add "engine: CAFFE" to your depthwise convolution layer to solve the memory issue.
  4. The original tensorflow model is trained on MSCOCO dataset, maybe you need deploy.caffemodel for VOC dataset, use to get deploy_voc.caffemodel.

Train your own dataset

  1. Generate the trainval_lmdb and test_lmdb from your dataset.
  2. Write a labelmap.prototxt
  3. Use to generate some prototxt files, replace the "CLASS_NUM" with class number of your own dataset.
python -s train -c CLASS_NUM >train.prototxt
python -s test -c CLASS_NUM >test.prototxt
python -s deploy -c CLASS_NUM >deploy.prototxt
  1. Copy coco/solver_train.prototxt and coco/ to your project and start training.


There are some differences between caffe and tensorflow implementation:

  1. The padding method 'SAME' in tensorflow sometimes use the [0, 0, 1, 1] paddings, means that top=0, left=0, bottom=1, right=1 padding. In caffe, there is no parameters can be used to do that kind of padding.
  2. MobileNet on Tensorflow use ReLU6 layer y = min(max(x, 0), 6), but caffe has no ReLU6 layer. Replace ReLU6 with ReLU cause a bit accuracy drop in ssd-mobilenetv2, but very large drop in ssdlite-mobilenetv2. There is a ReLU6 layer implementation in my fork of ssd.
Alternatives To Mobilenetv2 Ssdlite
Select To Compare

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (888,878
Dataset (33,267
Tensorflow (22,886
Caffe (3,299
Padding (2,366
Ssd (1,973
Mobilenet (1,161
Mobilenetv2 (283
Caffemodel (173
Mobilenetv2 Ssdlite (9
Ssdlite (5