Giter Site home page Giter Site logo

anatanick / dssd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zqpei/dssd

0.0 0.0 0.0 1.22 MB

Pytorch implementation of DSSD (Deconvolutional Single Shot Detector)

License: MIT License

Python 93.15% C++ 2.40% C 0.17% Cuda 3.27% Shell 1.02%

dssd's Introduction

DSSD in pytorch

This repository implements DSSD : Deconvolutional Single Shot Detector. The code were borrowed heavily from SSD. The things I did was the DSSD network definition, including the backbone of resnet101, deconvolutional module, and the prediction modules. Code for training, distributed training, dataset loading and data augmention is the same as lufficc's SSD. Thanks @lufficc for his great job.

It is worth mentioning that I changed the DSSD321 to DSSD320 and DSSD513 to DSSD512 to fit pytorch convolution and deconvolution modules. The mAP will not be affected at all. In fact, I get a higher mAP than paper!

Example DSSD output (resnet101_dssd320_voc0712).

Installation

Requirements

  1. Python3
  2. PyTorch 1.0 or higher
  3. yacs
  4. Vizer
  5. GCC >= 4.9
  6. OpenCV

Step-by-step installation

git clone https://github.com/ZQPei/DSSD.git
cd DSSD
#Required packages
pip install -r requirements.txt

Build

If your torchvision >= 0.3.0, nms build is not needed! We also provide a python-like nms, but is very slower than build-version.

# For faster inference you need to build nms, this is needed when evaluating. Only training doesn't need this.
cd ext
python build.py build_ext develop

Train

Setting Up Datasets

Pascal VOC

For Pascal VOC dataset, make the folder structure like this:

VOC_ROOT
|__ VOC2007
    |_ JPEGImages
    |_ Annotations
    |_ ImageSets
    |_ SegmentationClass
|__ VOC2012
    |_ JPEGImages
    |_ Annotations
    |_ ImageSets
    |_ SegmentationClass
|__ ...

Where VOC_ROOT default is datasets folder in current project, you can create symlinks to datasets or export VOC_ROOT="/path/to/voc_root".

COCO

For COCO dataset, make the folder structure like this:

COCO_ROOT
|__ annotations
    |_ instances_valminusminival2014.json
    |_ instances_minival2014.json
    |_ instances_train2014.json
    |_ instances_val2014.json
    |_ ...
|__ train2014
    |_ <im-1-name>.jpg
    |_ ...
    |_ <im-N-name>.jpg
|__ val2014
    |_ <im-1-name>.jpg
    |_ ...
    |_ <im-N-name>.jpg
|__ ...

Where COCO_ROOT default is datasets folder in current project, you can create symlinks to datasets or export COCO_ROOT="/path/to/coco_root".

Single GPU training

# edit script file
vi scripts/resnet101_dssd320_voc0712_single_gpu.sh

# change line 2 export VOC_ROOT="/data/pzq/voc/VOCdevkit" to your path of VOC dataset.
# do the same change to the rest scripts file.

# for example, train DSSD320 on VOC:
sh scripts/resnet101_dssd320_voc0712_single_gpu.sh

Multi-GPU training

# for example, train DSSD320 with 4 GPUs:
sh scripts/resnet101_dssd320_voc0712_multi_gpu.sh

Evaluate

Single GPU evaluating

# for example, evaluate DSSD320:
python test.py --config-file configs/resnet101_dssd320_voc0712.yaml

Multi-GPU evaluating

# for example, evaluate DSSD320 with 4 GPUs:
export NGPUS=4
python -m torch.distributed.launch --nproc_per_node=$NGPUS test.py --config-file configs/resnet101_dssd320_voc0712.yaml

Demo

Predicting image in a folder is simple:

python demo.py --config-file configs/resnet101_dssd320_voc0712.yaml --images_dir demo --ckpt [ckpt_path]

Develop Guide

If you want to add your custom components, please see DEVELOP_GUIDE.md for more details.

dssd's People

Contributors

lufficc avatar zqpei avatar huaizhengzhang avatar tkhe avatar alexey-gruzdev avatar beibinli avatar

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.