Skip to content

C++ extension implementation of RoIAlign & RolPool (both GPU and CPU) for PyTorch

Notifications You must be signed in to change notification settings

AceCoooool/RoIAlign-RoIPool-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RoI-op-pytorch

C++ extension of RoIPool & RoIAlign (both CPU and GPU) in PyTorch,this code is converted from caffe2 operation. (need pytorch 0.4.0)

**Warning:**You may change AT_CHECK to AT_ASSERT(0.4 version using AT_ASSERT, and latest version using AT_CHECK

**Note: **

  1. roi_xxx_cpu.cpp&roi_xxx_binding.cpp:contains the cpu version of forward and backward operation.(Note: roi_xxx_binding.cpp is for pybind, you can put this code into roi_xxx_cpu.cpp as well)
  2. roi_xxx_kernel.cu&roi_xxx_cuda.cpp:contains the cuda version of forward and backward operation.
  3. main.py&temp.h&CMakeLists.txt:help you to debug in c++ code, rather than to run python setup.py install to debug. (Note: only support cpu version ~ I don't know how to debug .cu code 😣)
  4. setup.py:you can run python setup.py install to install this operation as a package (You can find this package in you python site-package)
  5. roi_xxx.py:wrap .cpp code to pytorch's Function & Module ,there is also a small demo testing.

Install

cd roixxx   # roipool or roialign
python setup.py install

RoI Pooling

The "strategy" of roi-pooling in this implementaion likes the follow picture:(:joy: so bad picture)

oi_poo

Note: (please stand on point view rather than block view)

  1. scale=0.5
  2. dotted line is the range of "seleted area" (int form in [left, right) and [top, bottom))

RoI Align

oialig

Note: left sample=1, right sample=2

There are several good resource to explain these two operations:

Reference

  1. caffe2 operator:most of the code is coming from here.
  2. extension-cpp: tutorial
  3. detectorch

About

C++ extension implementation of RoIAlign & RolPool (both GPU and CPU) for PyTorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published