Home

Awesome

SSD: Single Shot MultiBox Detector

Introduction

Here is my pytorch implementation of 2 models: SSD-Resnet50 and SSDLite-MobilenetV2. These models are based on original model (SSD-VGG16) described in the paper SSD: Single Shot MultiBox Detector. This implementation supports mixed precision training.

<p align="center"> <img src="demo/video.gif"><br/> <i>An example of SSD Resnet50's output.</i> </p>

Motivation

Why this implementation exists while there are many ssd implementations already ?

I believe that many of you when seeing this implementation have this question in your mind. Indeed there are already many implementations for SSD and its variants in Pytorch. However most of them are either:

The above-mentioned points make learner hard to understand how original ssd looks like. Hence, I re-implement this well-known model, focusing on simplicity. I believe this implementation is suitable for ML/DL users from different levels, especially beginners. In compared to model described in the paper, there are some minor changes (e.g. backbone), but other parts follow paper strictly.

Datasets

DatasetClasses#Train images#Validation images
COCO201780118k5k

Docker

For being convenient, I provide Dockerfile which could be used for running training as well as test phases

Assume that docker image's name is ssd. You already created an empty folder name trained_models for storing trained weights. Then you clone this repository and cd into it.

Build:

docker build --network=host -t ssd .

Run:

docker run --rm -it -v path/to/your/coco:/coco -v path/to/trained_models:/trained_models --ipc=host --network=host ssd

How to use my code

Assume that at this step, you either already installed necessary libraries or you are inside docker container

Now, with my code, you can:

You could download my trained weight for SSD-Resnet50 at link

Experiments

I trained my models by using NVIDIA RTX 2080. Below is mAP evaluation for SSD-Resnet50 trained for 54 epochs on COCO val2017 dataset

<p align="center"> <img src="demo/mAP.png"><br/> <i>SSD-Resnet50 evaluation.</i> </p> <p align="center"> <img src="demo/tensorboard.png"><br/> <i>SSD-Resnet50 tensorboard for training loss curve and validation mAP curve.</i> </p>

Results

Some predictions are shown below:

<img src="demo/1.jpg" width="250"> <img src="demo/2.jpg" width="250"> <img src="demo/3.jpg" width="250">

<img src="demo/4.jpg" width="250"> <img src="demo/5.jpg" width="250"> <img src="demo/6.jpg" width="250">

<img src="demo/7.jpg" width="250"> <img src="demo/8.jpg" width="250"> <img src="demo/9.jpg" width="250">

References