Home

Awesome

Tiny-DSOD: Lightweight Object Detection for Resource Restricted Usage

This repository releases the code for our paper

Tiny-DSOD: Lightweight Object Detection for Resource Restricted Usage (BMVC2018)

Yuxi Li, Jianguo Li, Jiuwei Li and Weiyao Lin

The code is based on the SSD and DSOD framework.

Introduction

Tiny-DSOD tries to tackle the trade-off between detection accuracy and computation resource consumption. In this work, our tiny-model outperforms other small sized detection network (pelee, mobilenet-ssd or tiny-yolo) in the metrics of FLOPs, parameter size and accuracy. To be specific, on the dataset of PASCAL VOC2007, Tiny-DSOD achieves mAP of 72.1% with less than 1 million parameters (0.95M)

basic unit DDB

D-FPN

Preparation

  1. Install dependencies our caffe framework needs. You can visit the caffe official website and follow the instructions there to install the dependent libraries and drivers correctly.

  2. Clone this repository and compile the code

git clone https://github.com/lyxok1/Tiny-DSOD.git

cd Tiny-DSOD
# visit the Makefile then modify the compile options and path to your library there
make -j8
  1. Prepare corresponding dataset (if need training). Please see the document in SSD detail

Train a model from scratch

Suppose the code is runing under the main directory of caffe.

First generate the model prototxt files

python examples/DCOD/DCOD_pascal.py  # for voc training

python examples/DCOD/DCOD_kitti.py # for kitti training

python examples/DCOD/DCOD_coco.py # for coco training

And then use the binary ./build/tools/caffe to train the generated network

./jobs/DCOD300/${DATASET}/DCOD300_300x300/DCOD300_${DATASET}_DCOD300_300x300.sh
# Alternatively, you can directly use the binary to train in command line

./build/tools/caffe train -solver models/DCOD300/$DATASET/DCOD300_300x300/solver.prototxt -gpu all 2>&1 | tee models/DCOD300/$DATASET/DCOD300_300x300/train.log

Deploy a pre-trained model

If you want to directly deploy a pre-trained model, you can use the demo scripts we provide in the example/DCOD/ directory

python examples/DCOD/image_detection_demo.py <option>

optional arguments:
  -h, --help            show this help message and exit
  -model MODEL          path to model prototxt file
  -weights WEIGHTS      path to weight file
  -img_dir IMG_DIR      path to input image
  -num NUM              number of images for detection
  -gpu                  specifiy using GPU or not
  -threshold THRESHOLD  threshold to filter bbox with low confidence
python examples/DCOD/video_detection_demo.py <option>

optional arguments:
  -h, --help            show this help message and exit
  -model MODEL          path to model prototxt file
  -weights WEIGHTS      path to weight file
  -video VIDEO          path to input video
  -gpu                  specifiy using GPU or not
  -threshold THRESHOLD  threshold to filter bbox with low confidence

Results

Method# ParamsFLOPsmAP
Faster-RCNN134.70M181.12B73.2
SSD26.30M31.75B77.2
Tiny-YOLO15.12M6.97B57.1
MobileNet-SSD5.50M1.14B68.0
DSOD-smallest5.90M5.29B73.6
Pelee5.98M1.21B70.9
Tiny-DSOD0.95M1.06B72.1
Method# ParamsFLOPscarcyclistpedestrainmAP
MS-CNN80M-85.075.275.378.5
FRCN121.2M-86.0---
SqueezeDet1.98M9.7B82.976.870.476.7
Tiny-DSOD0.85M4.1B88.373.669.177.0
Method# ParamsFLOPsmAP(IOU 0.5:0.95)
MobileNet-v2+SSDLite4.30M0.80B22.1
Pelee5.98M1.29B22.4
Yolo-v267.43M34.36B21.6
Tiny-DSOD1.15M1.12B23.2

Released model

We released a model pretrained on VOC2007 on Baidu Yun (3.8MB) and Google Drive

Example

kitti1

kitti1

kitti1

Citation

If you think this work is helpful for your own research, please consider add following bibtex config in your latex file

@inproceedings{li2018tiny,
  title = {{Tiny-DSOD}: Lightweight Object Detection for Resource-restricted Usage},
  author = {Yuxi Li, Jianguo Li, Jiuwei Li and Weiyao Lin},
  booktitle = {BMVC},
  year = {2018}
}