GithubHelp home page GithubHelp logo

trendingtechnology / detectorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ignacio-rocco/detectorch

0.0 2.0 0.0 2.48 MB

Detectorch - detectron for PyTorch

License: Other

Jupyter Notebook 67.58% C++ 3.00% Cuda 3.37% Python 25.36% Shell 0.08% C 0.60%

detectorch's Introduction

Detectorch - detectron for PyTorch

(Disclaimer: this is work in progress and does not feature all the functionalities of detectron. Currently only inference and evaluation are supported -- no training) (News: Now supporting FPN and ResNet-101!)

This code allows to use some of the Detectron models for object detection from Facebook AI Research with PyTorch.

It currently supports:

  • Fast R-CNN
  • Faster R-CNN
  • Mask R-CNN

It supports ResNet-50/101 models with or without FPN. The pre-trained models from caffe2 can be imported and used on PyTorch.

Example Mask R-CNN with ResNet-101 and FPN.

Evaluation

Both bounding box evaluation and instance segmentation evaluation where tested, yielding the same results as in the Detectron caffe2 models. These results below have been computed using the PyTorch code:

Model box AP mask AP model id
fast_rcnn_R-50-C4_2x 35.6 36224046
fast_rcnn_R-50-FPN_2x 36.8 36225249
e2e_faster_rcnn_R-50-C4_2x 36.5 35857281
e2e_faster_rcnn_R-50-FPN_2x 37.9 35857389
e2e_mask_rcnn_R-50-C4_2x 37.8 32.8 35858828
e2e_mask_rcnn_R-50-FPN_2x 38.6 34.5 35859007
e2e_mask_rcnn_R-101-FPN_2x 40.9 36.4 35861858

Training

Training code is experimental. See train_fast.py for training Fast R-CNN. It seems to work, but slow.

Installation

First, clone the repo with git clone --recursive https://github.com/ignacio-rocco/detectorch so that you also clone the Coco API.

The code can be used with PyTorch 0.3.1 or PyTorch 0.4 (master) under Python 3. Anaconda is recommended. Other required packages

  • torchvision (conda install torchvision -c soumith)
  • opencv (conda install -c conda-forge opencv )
  • cython (conda install cython)
  • matplotlib (conda install matplotlib)
  • scikit-image (conda install scikit-image)
  • ninja (conda install ninja) (required for Pytorch 0.4 only)

Additionally, you need to build the Coco API and RoIAlign layer. See below.

Compiling the Coco API

If you cloned this repo with git clone --recursive you should have also cloned the cocoapi in lib/cocoapi. Compile this with:

cd lib/cocoapi/PythonAPI
make install

Compiling RoIAlign

The RoIAlign layer was converted from the caffe2 version. There are two different implementations for each PyTorch version:

  • Pytorch 0.4: RoIAlign using ATen library (lib/cppcuda). Compiled JIT when loaded.
  • PyTorch 0.3.1: RoIAlign using TH/THC and cffi (lib/cppcuda_cffi). Needs to be compiled with:
cd lib/cppcuda_cffi
./make.sh 

Quick Start

Check the demo notebook.

detectorch's People

Contributors

ignacio-rocco avatar

Watchers

 avatar  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.