Wednesday, March 21, 2018

How to use SSD: Single Shot MultiBox Detector

I'm using Linux mint OS and keras 2.1.4. The github's page of SSD is here.

Copy the project to your local.
$ git clone https://github.com/rykov8/ssd_keras.git
$ cd ssd_keras

Maybe you need
$ sudo apt-get install python-opencv

Download the learned weights from here.
And move the downloaded weight to the "ssd_keras" folder.


Open the jupyter notebook.
$ jupyter notebook

If you get "AttributeError: type object 'IOLoop' has no attribute 'initialized'.", maybe you should uninstall tornade5 and install tornade4 instead.
$ pip uninstall tornado
$ pip install tornado==4.5.3

Click on "SSD.ipynb".


And you can run the sample.
But if you want to use Keras 2, you need to customize a bit.

Open ssd_layers.py:

And change "def get_output_shape_for(self, input_shape):"

to "def compute_output_shape(self, input_shape):"
(Just copy and paste and change the function name.)


Also, on SSD.ipynb (on jupyter notebook), we need to add dummy compile to here:
model.compile('sgd','mse') is a dummy compile.

Then run the example.



References


https://github.com/rykov8/ssd_keras/issues/60
https://github.com/keras-team/keras/issues/9394


Contents


How to use SSD: Single Shot MultiBox Detector
Single Shot Multibox Detector: how to train with own dataset