https://github.com/amazingang/pytorch-tvnet
TVNet to generate optical flow in pytorch
https://github.com/amazingang/pytorch-tvnet
optical-flow pytorch
Last synced: about 1 year ago
JSON representation
TVNet to generate optical flow in pytorch
- Host: GitHub
- URL: https://github.com/amazingang/pytorch-tvnet
- Owner: AmazingAng
- License: mit
- Created: 2019-02-12T07:04:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-05T05:17:03.000Z (about 6 years ago)
- Last Synced: 2025-05-06T22:45:56.381Z (about 1 year ago)
- Topics: optical-flow, pytorch
- Language: Python
- Size: 1.35 MB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pytorch-tvnet
This project contains a **simple** and **pytorch** implementation of TVNet in ['End-to-End Learning of Motion Representation for Video Understanding'](http://lijiefan.me/project_webpage/TVNet_cvpr/papers/TVNet_cvpr.pdf) with **pytorch-style**.
- **Simple**: in total ~350 lines of code
- **Pytorch-style**: All modules (central gradient, forward gradient & divergence) extend torch.nn.Module.
The original implementation was in tensorflow, which can be found in https://github.com/LijieFan/tvnet.
- **Update 2020/04/20**: GPU support, try demo_gpu.py; support batch mode, try demo_batch_mode.py.
# Requirements
- **Python 3**: also tested on python 2.7.
- **pytorch**
- **matlab (optinonal)**: In the original tensorflow version, authors use `.mat` file for TVNet generated results saving, and `Matlab` for results [`visualization`](http://sintel.is.tue.mpg.de). In the demo code, I also add code for visulizing flow map using cv2 (in python).
# Usage
#### I) Put input frames in `frame/img1.png`, `frame/img2.png`.
#### II) Use TVNet to generate motion representation
Sample usages include
- Generate motion representation for frames in `frame/img1.png` and `frame/img2.png`.
```
python demo.py
```
#### III) Check results and visualization
-TVNet generated results are saved in `result/result-pytorch.mat`
-For matlab visualization, run ```run visualize/visualize.m```. For python, use code attached at the bottom of ```demo.py```.
# Sample input

# Sample output

tensorflow implementation
pytorch implementation
# Acknowledgement
Thanks [Huang, Wenbing](https://sites.google.com/site/wenbinghuangshomepage/) for the kindly reply and discussions on the original paper.
# Reference
if you find my code useful for your research, please cite the original paper:
@inproceedings{fan2018end,
title={End-to-End Learning of Motion Representation for Video Understanding},
author={Fan, Lijie and Huang, Wenbing and Gan, Chuang and Ermon, Stefano and Gong, Boqing and Huang, Junzhou},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
pages={},
year={2018}
}
# License
This project is licensed under the MIT License - see the LICENSE.md file for details