RoIAlign-RoIPool-pytorch
RoIAlign-RoIPool-pytorch copied to clipboard
C++ extension implementation of RoIAlign & RolPool (both GPU and CPU) for PyTorch
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: **
roi_xxx_cpu.cpp&roi_xxx_binding.cpp:contains the cpu version of forward and backward operation.(Note:roi_xxx_binding.cppis for pybind, you can put this code intoroi_xxx_cpu.cppas well)roi_xxx_kernel.cu&roi_xxx_cuda.cpp:contains the cuda version of forward and backward operation.main.py&temp.h&CMakeLists.txt:help you to debug in c++ code, rather than to runpython setup.py installto debug. (Note: only support cpu version ~ I don't know how to debug.cucode :persevere:)setup.py:you can runpython setup.py installto install this operation as a package (You can find this package in you python site-package)roi_xxx.py:wrap.cppcode to pytorch'sFunction & 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)

Note: (please stand on point view rather than block view)
- scale=0.5
- dotted line is the range of "seleted area" (int form in
[left, right)and[top, bottom))
RoI Align

Note: left sample=1, right sample=2
There are several good resource to explain these two operations:
Reference
- caffe2 operator:most of the code is coming from here.
- extension-cpp: tutorial
- detectorch