This repository only provides the 1D correlation function needed for DispNetCorr1D in Pytorch. I mainly made this because there are ample resources for Tensorflow implementation of the following papers but the Pytorch implementation have no 1D correlation layer. So I wrote my own.
- DispNetCorr1D A Large Dataset to Train Convolutional Networks for Disparity, Optical Flow, and Scene Flow Estimation
- FlowNet FlowNet: Learning Optical Flow with Convolutional Networks
I only used Pytorch functions so a faster version can be implemented in CUDA. This version was also fast enough for training in my experiments.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
First Install all the relevant requirements given in the requirements.txt file in your pip or anaconda environments.
This repo is just a sample so I included one pair of left and right images as an example as shown below
Execute the main.py file.
I replicated the tensor flow version from the following repository.
- dispflownet-tf Tensorflow implementation of https://lmb.informatik.uni-freiburg.de/Publications/2016/MIFDB16
The mentioned repository provides the CUDA version also which is not covered in this repository.
To make sure my version is exactly equal to the Tensorflow version I had to make sure that both of the following condition are checked:
- Forward function
- Backward function
As you can confirm by running the program that the Pytorch Version is exactly similar to TF version as shown below:
I made sure using Grad check that gradients were flowing correctly. For this :
1. Set gradCheck = True
2. Set scale = 0.05
3. Run main.py
4. You should be able to see "True" printed after execution which means Grad Check passed.
This project is licensed under the MIT License. For specific helper function used in this repository please see the license agreement of the Repo linked in Acknowledgement section
My implementation has been inspired from the following sources.
** dispflownet-tf Tensorflow implementation of https://lmb.informatik.uni-freiburg.de/Publications/2016/MIFDB16
You can use my function with the following repository:
** FlowNetPytorch Pytorch implementation of FlowNet by Dosovitskiy et al.
** SfmLearner-Pytorch Pytorch version of SfmLearner from Tinghui Zhou et al.
In the above simply modify FlowNet or DispnetS and use my 1D Correlation function to get DispNetCorr1D