Code Monkey home page Code Monkey logo

bidet's Introduction

BiDet

This is the official pytorch implementation for paper: BiDet: An Efficient Binarized Object Detector, which is accepted by CVPR2020. The code contains training and testing stages on two binarized object detectors, SSD300 and Faster R-CNN on PASCAL VOC and Microsoft COCO 2014.

Quick Start

Prerequisites

  • python 3.5+
  • pytorch 0.4.0+
  • other packages include numpy, cv2, matplotlib, pillow, cython, cffi, msgpack, easydict, pyyaml

Dataset Preparation

We conduct experiments on PASCAL VOC and Microsoft COCO 2014 datasets.

PASCAL VOC

We train our model on the VOC 0712 trainval sets and test it on the VOC 07 test set. For downloading, just run:

sh data/scripts/VOC2007.sh # <directory>
sh data/scripts/VOC2012.sh # <directory>

Please specify a path to download your data in, or the default path is ~/data/.

COCO

We train our model on the COCO 2014 trainval35k subset and evaluate it on minival5k. For downloading, just run:

sh data/scripts/COCO2014.sh

Also, you can specify a path to save the data.

After downloading both datasets, please modify file faster_rcnn/lib/datasets/factory.py line 24 and file faster_rcnn/lib/datasets/coco.py line 36 by replacing path/to/dataset with your voc and coco dataset path respectively.

Pretrained Backbone

The backbones for our BiDet-SSD300 and BiDet-Faster R-CNN are VGG16 and Resnet-18. We pretrain them on the ImageNet dataset. You can download the pretrained weights on: VGG16 and ResNet18. After downloading them from Google Drive, please put them in ssd/pretrain and faster_rcnn/pretrain respectively.

Training and Testing

Assume you've finished all steps above, you can start using the code easily.

SSD

For training SSD, just run:

$ python ssd/train_bidet_ssd.py --dataset='VOC/COCO' --data_root='path/to/dataset' --basenet='path/to/pretrain_backbone'

For testing on VOC, just run:

$ python ssd/eval_voc.py --weight_path='path/to/weight' --voc_root='path/to/voc'

For testing on COCO, just run:

$ python ssd/eval_coco.py --weight_path='path/to/weight' --coco_root='path/to/coco'

Faster R-CNN

First you need to compile the cuda implementation for RoIPooling, RoIAlign and NMS. Just do:

cd faster_rcnn/lib
python setup.py build develop

For training Faster R-CNN, just run:

$ python faster_rcnn/trainval_net.py --dataset='voc/coco' --data_root='path/to/dataset' --basenet='path/to/pretrain_backbone'

For testing, run:

$ python test_net.py --dataset='voc/coco' --checkpoint='path/to/weight'

bidet's People

Contributors

wuziyi616 avatar ziweiwangthu avatar

Watchers

 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.