pytorch version of spatial transformer networks
Ported from https://github.com/qassemoquab/stnbhwd according to pytorch tutorial. Now support CPU and GPU. To use the ffi you need to install the
cffipackage from pip.
cd script ./make.sh #build cuda code, don't forget to modify -arch argument for your GPU computational capacity version python build.py python test.py
There is a demo in
STNis the spatial transformer module, it takes a
B*H*W*Dtensor and a
B*H*W*2grid normalized to [-1,1] as an input and do bilinear sampling.
B*2*3matrix and generate an affine transformation grid.
B*1theta vector and generate a transformation grid to remap equirectangular images along x axis.
B*H*W*6tensor and do affine transformation for each pixel. Example of convolutional spatial transformer can be found in
An example of the landscape of the loss function of a simple STN with L1 Loss can be found in the demo.
STN is able to handle a complex grid, however, how to parameterize the grid is a problem.