Coder Social home page Coder Social logo

pinto0309 / mobilenetv2-ssdlite Goto Github PK

View Code? Open in Web Editor NEW
23.0 5.0 11.0 16.66 MB

My proprietary procedure. Caffe implementation of SSD and SSDLite detection on MobileNetv2, converted from tensorflow.

Home Page: https://github.com/chuanqi305/MobileNetv2-SSDLite

License: MIT License

Shell 1.06% Python 78.14% C++ 13.41% Cuda 7.39%

mobilenetv2-ssdlite's Introduction

MobileNetv2-SSDLite

Caffe implementation of SSD detection on MobileNetv2, converted from tensorflow.
【As of June 3, 2018】 Be careful as it will not work with Intel Movidius Neural Compute Stick (NCS) NCSDK v1.12.00.

I fixed a little clone of Chuanqi305/MobileNetv2-SSDLite.
https://github.com/chuanqi305/MobileNetv2-SSDLite.git
I have not confirmed the behavior of the generated model at all.
Pull Request is welcomed.

Environment

Ubuntu 16.04
Python 2.7.12
Python 3.5.2

Prerequisites

Tensorflow and Caffe version SSD is properly installed on your computer.
There is a ReLU6 layer implementation in chuanqi305's fork of SSD.

Procedure

Implementation of MovileNetv2-SSDLite (Pascal VOC, ReLU6 layer enabled) by Caffe





Usage

  1. Firstly you should download the original model from tensorflow.
  2. Use gen_model.py to generate the train.prototxt and deploy.prototxt (or use the default prototxt).
python gen_model.py -s deploy -c 91 >deploy.prototxt
  1. Use dump_tensorflow_weights.py to dump the weights of conv layer and batchnorm layer.
  2. Use load_caffe_weights.py 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 coco2voc.py 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 gen_model.py to generate some prototxt files, replace the "CLASS_NUM" with class number of your own dataset.
python gen_model.py -s train -c CLASS_NUM >train.prototxt
python gen_model.py -s test -c CLASS_NUM >test.prototxt
python gen_model.py -s deploy -c CLASS_NUM >deploy.prototxt
  1. Copy coco/solver_train.prototxt and coco/train.sh to your project and start training.

Note

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.

mobilenetv2-ssdlite's People

Contributors

pinto0309 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mobilenetv2-ssdlite's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.