Giter Site home page Giter Site logo

mal-inference's Introduction

MAL-inference

This repo is optimized for Multiple Anchor Learning(MAL) detector inference based on NVIDIA Object Detection Toolkit (ODTK).

For more details of MAL, please refer to our CVPR2020 paper: Multiple Anchor Learning for Visual Object Detection and the original MAL repo.

Citation:

@inproceedings{kehuang2020,
  title={Multiple Anchor Learning for Visual Object Detection},
  author={Wei Ke and Tianliang Zhang and Zeyi Huang and Qixiang Ye and Jianzhuang Liu and Dong Huang},
  booktitle={CVPR},
  year={2020}
}

1. Installation

Requirements:

  • Python>=3.6.9
  • Docker with API version >=Nvidia 1.4
  • Nvidia drivers with version >= 361
  • cuda10.1
  • Tensorrt=6.0.1-1
  • g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  • Opencv >=3.4.0
  • PyTorch 1.3 with CUDA support
  • pycocotools

Step-by-step installation

# install MAL-inference
git https://github.com/DeLightCMU/MAL-inference.git

# load MAL-inference in NVIDIA docker
sudo docker run --gpus all -v /home/usrname/MAL-inference:/workspace --rm --ipc=host -it nvcr.io/nvidia/pytorch:19.10-py3

# the following will install the lib with
# symbolic links, so that you can modify
# the files if you want and won't need to
# re-build it
cd MAL-inference
python setup.py clean --all install
python setup.py build develop
#re-build C++ code
cd extras/cppapi/build
rm -rf *
cmake -DCMAKE_CUDA_FLAGS="--expt-extended-lambda -std=c++11" ..
make -j8

2. Download MAL model and convert to the ODTK format (TODO)

Backbone COCO test-dev mAP (single-scale) Inference time COCO pth models
ResNet-50-FPN 39.2 ms download
ResNet-101-FPN 43.6 ms download
ResNext-101-FPN 45.9 ms download
#Download MAL model and convert to the ODTK format
download resnet50 model to MAL-inference/models/resnet50/
#edit convert script
vi MAL-inference/models/transfer_model.py
 "
  model_name = './resnet50/"downloadname.pth"'
  transferred_model_name = './resnet50/transferred_model_XXXX.pth'
 "
#convert  
python models/transfer_model.py the MAL model will convert to ODTK format

3. Running for COCO metrics (Pytorch)

#you need download cocco dataset in you computer  [COCO 2017](http://cocodataset.org/#download)
CUDA_VISIBLE_DEVICES=0 retinanet infer "path to config file.yaml" MODEL.WEIGHT "path to.pth file" --images "path to coco dataset/val2017/"   --annotations "path to coco dataset/annotations/instances_val2017.json"  --batch=1

4. Running for single images (C++)

#export model to Tensorrt format 
CUDA_VISIBLE_DEVICES=0 python retinanet/main.py export  --"path/to/config/file.yaml"  non.pth modelname.plan --size 800 1280(you can set high and wide according you need for example 800 1200 , 1024 1344 etc)

cp modelname.plan extras/cppapi/build

cd extras/cppapi/build

./infer modelname.plan picturename.png

mal-inference's People

Contributors

azuryl avatar dghuanggh avatar

Stargazers

 avatar Danqing Kang avatar Ankit Shah avatar Researcher.YuanYuhui avatar

Watchers

James Cloos avatar  avatar

Forkers

ankitshah009

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.