/Forward-Warp

An optical flow forward warp's lib with backpropagation using pytorch.

Primary LanguagePythonMIT LicenseMIT

Foward Warp Pytorch Version

Has been tested in pytorch=0.4.0, python=3.6, CUDA=9.0

Install

export CUDA_HOME=/usr/local/cuda #use your CUDA instead
chmod a+x install.sh
./install.sh

Test

cd test
python test.py

Usage

from Forward_Warp import forward_warp

# default interpolation mode is Bilinear
fw = forward_warp()
im2_bilinear = fw(im0, flow) 
# use interpolation mode Nearest
# Notice: Nearest input-flow's gradient will be zero when at backward.
fw = forward_warp(interpolation_mode="Nearest")  
im2_nearest = fw(im0, flow)