2020-11-30 11:41:48 +08:00
# RIFE Video Frame Interpolation v1.4
2020-11-27 13:51:53 +08:00
## [arXiv](https://arxiv.org/abs/2011.06294) | [Project Page](https://rife-vfi.github.io) | [Reddit](https://www.reddit.com/r/linux/comments/jy4jjl/opensourced_realtime_video_frame_interpolation/) | [YouTube](https://www.youtube.com/watch?v=60DX2T3zyVo&feature=youtu.be)
2020-11-14 14:05:02 +08:00
2020-11-30 16:24:20 +08:00
**11.30 News: We have updated the v1.4 model to greatly reduce the patch artifacts when the camera moves vigorously. Please check our [update log ](https://github.com/hzwer/arXiv2020-RIFE/issues/41 ).**
2020-11-30 12:11:05 +08:00
2020-11-22 15:11:39 +08:00
**11.22 News: We notice a new windows app is trying to integrate RIFE, we hope everyone to try and help them improve. You can download [Flowframes ](https://nmkd.itch.io/flowframes ) for free.**
2020-11-22 12:29:05 +08:00
2020-11-30 11:46:08 +08:00
**There is [a tutorial of RIFE ](https://www.youtube.com/watch?v=gf_on-dbwyU&feature=emb_title ) on Youtube.**
2020-11-23 15:05:29 +08:00
**You can easily use [colaboratory ](https://colab.research.google.com/github/hzwer/arXiv2020-RIFE/blob/main/Colab_demo.ipynb ) to have a try and generate the [our youtube demo ](https://www.youtube.com/watch?v=LE2Dzl0oMHI ).**
2020-11-14 14:05:02 +08:00
2020-12-02 17:51:42 +08:00
Our model can run 30+FPS for 2X 720p interpolation on a 2080Ti GPU. Currently our method supports 2X,4X interpolation for 1080p video, and multi-frame interpolation between a pair of images. Everyone is welcome to use our alpha version and make suggestions!
2020-11-12 20:27:43 +08:00
2020-11-13 20:24:27 +08:00
16X interpolation results from two input images:
2020-11-13 18:41:50 +08:00


2020-11-13 18:24:04 +08:00
2020-11-12 17:31:40 +08:00
## Abstract
2020-11-17 16:17:03 +08:00
We propose RIFE, a Real-time Intermediate Flow Estimation algorithm for Video Frame Interpolation (VFI). Most existing methods first estimate the bi-directional optical flows and then linearly combine them to approximate intermediate flows, leading to artifacts on motion boundaries. RIFE uses a neural network named IFNet that can directly estimate the intermediate flows from images. With the more precise flows and our simplified fusion process, RIFE can improve interpolation quality and have much better speed. Based on our proposed leakage distillation loss, RIFE can be trained in an end-to-end fashion. Experiments demonstrate that our method is significantly faster than existing VFI methods and can achieve state-of-the-art performance on public benchmarks.
2020-11-12 17:31:40 +08:00
2020-11-26 09:49:42 +08:00
## Usage
### Installation
2020-11-12 20:27:43 +08:00
```
2020-11-26 09:49:42 +08:00
git clone git@github .com:hzwer/arXiv2020-RIFE.git
cd arXiv2020-RIFE
pip install -r requirements.txt
2020-11-12 20:27:43 +08:00
```
2020-11-15 16:40:43 -08:00
2020-11-16 16:19:18 +08:00
* Download the pretrained models from [here ](https://drive.google.com/file/d/1zYc3PEN4t6GOUoVYJjvcXoMmM3kFDNGS/view?usp=sharing ).
We are optimizing the visual effects and will support animation in the future.
2020-11-13 01:44:56 +08:00
2020-11-30 11:41:48 +08:00
(我们也提供了百度网盘链接:https://pan.baidu.com/s/1TniBk2Ld2O6XXgr-AY9DMQ 密码:ub97, 把压缩包解开后放在 train_log/\*.pkl)
2020-11-13 00:06:58 +08:00
* Unzip and move the pretrained parameters to train_log/\*.pkl
2020-11-12 23:39:28 +08:00
2020-11-15 16:29:23 +08:00
The models under different setting is coming soon.
2020-11-16 05:27:06 +08:00
2020-11-26 09:49:42 +08:00
### Run
2020-11-26 11:34:11 +08:00
**Video Frame Interpolation**
2020-11-15 16:40:43 -08:00
2020-11-18 12:01:50 +08:00
You can use our [demo video ](https://drive.google.com/file/d/1i3xlKb7ax7Y70khcTcuePi6E7crO_dFc/view?usp=sharing ) or use your own video to process.
2020-11-16 05:27:06 +08:00
```
2020-11-19 11:07:37 +08:00
$ python3 inference_video.py --exp=1 --video=video.mp4
2020-11-16 05:27:06 +08:00
```
2020-11-23 15:05:29 +08:00
(generate video_2X_xxfps.mp4)
2020-11-16 05:27:06 +08:00
```
2020-11-19 11:07:37 +08:00
$ python3 inference_video.py --exp=2 --video=video.mp4
2020-11-16 05:27:06 +08:00
```
2020-11-23 15:05:29 +08:00
(for 4X interpolation)
2020-11-16 05:27:06 +08:00
```
2020-11-19 11:07:37 +08:00
$ python3 inference_video.py --exp=2 --video=video.mp4 --fps=60
2020-11-16 05:27:06 +08:00
```
2020-11-26 11:34:11 +08:00
(add slomo effect, the audio will be removed)
2020-11-18 11:29:08 +08:00
```
2020-11-18 12:01:50 +08:00
$ python3 inference_video.py --video=video.mp4 --montage --png
2020-11-17 19:19:21 +08:00
```
2020-11-18 11:29:08 +08:00
(if you want to montage the origin video, and save the png format output)
2020-11-16 05:27:06 +08:00
2020-11-18 12:01:50 +08:00
The warning info, 'Warning: Your video has * * * static frames, it may change the duration of the generated video.' means that your video has changed the frame rate by adding static frames, it is common if you have processed 25FPS video to 30FPS.
2020-11-16 05:29:36 +08:00
2020-11-13 23:28:32 +08:00
**Image Interpolation**
2020-11-12 23:39:28 +08:00
```
2020-11-19 11:07:37 +08:00
$ python3 inference_img.py --img img0.png img1.png --exp=4
2020-11-16 21:37:23 +08:00
```
2020-11-14 02:54:24 +08:00
(2^4=16X interpolation results)
2020-11-16 21:37:23 +08:00
After that, you can use pngs to generate mp4:
```
2020-11-13 17:42:43 +08:00
$ ffmpeg -r 10 -f image2 -i output/img%d.png -s 448x256 -c:v libx264 -pix_fmt yuv420p output/slomo.mp4 -q:v 0 -q:a 0
2020-11-16 21:37:23 +08:00
```
You can also use pngs to generate gif:
```
2020-11-13 23:28:32 +08:00
$ ffmpeg -r 10 -f image2 -i output/img%d.png -s 448x256 -vf "split[s0][s1];[s0]palettegen=stats_mode=single[p];[s1][p]paletteuse=new=1" output/slomo.gif
```
2020-11-16 05:27:06 +08:00
## Evaluation
2020-11-16 19:45:18 +08:00
First you should download [RIFE model reported by our paper ](https://drive.google.com/file/d/1c1R7iF-ypN6USo-D2YH_ORtaH3tukSlo/view?usp=sharing ).
2020-11-14 14:56:13 +08:00
We will release our training and benchmark validation code soon.
2020-11-26 19:11:17 +08:00
**Vimeo90K**: Download [Vimeo90K dataset ](http://toflow.csail.mit.edu/ ) at ./vimeo_interp_test
2020-11-26 19:12:36 +08:00
2020-11-26 19:11:17 +08:00
**MiddleBury**: Download [MiddleBury OTHER dataset ](https://vision.middlebury.edu/flow/data/ ) at ./other-data and ./other-gt-interp
2020-11-14 17:02:45 +08:00
```
2020-11-26 19:11:17 +08:00
$ python3 benchmark/Vimeo90K.py
2020-11-26 18:47:55 +08:00
(Final result: "Avg PSNR: 35.695 SSIM: 0.9788")
2020-11-26 19:11:17 +08:00
$ python3 benchmark/MiddelBury_Other.py
(Final result: "2.058")
2020-11-14 17:02:45 +08:00
```
2020-11-13 11:16:57 +08:00
## Citation
2020-11-16 20:19:45 +08:00
<img src="demo/intro.png" alt="img" width=350 />
2020-11-13 23:28:32 +08:00
2020-11-13 10:27:30 +08:00
```
@article {huang2020rife,
title={RIFE: Real-Time Intermediate Flow Estimation for Video Frame Interpolation},
author={Huang, Zhewei and Zhang, Tianyuan and Heng, Wen and Shi, Boxin and Zhou, Shuchang},
journal={arXiv preprint arXiv:2011.06294},
year={2020}
}
```
## Reference
2020-11-13 11:16:57 +08:00
Optical Flow:
2020-11-26 11:34:11 +08:00
[ARFlow ](https://github.com/lliuz/ARFlow ) [pytorch-liteflownet ](https://github.com/sniklaus/pytorch-liteflownet ) [RAFT ](https://github.com/princeton-vl/RAFT ) [pytorch-PWCNet ](https://github.com/sniklaus/pytorch-pwc )
2020-11-13 11:16:57 +08:00
Video Interpolation:
2020-11-26 11:34:11 +08:00
[DAIN ](https://github.com/baowenbo/DAIN ) [CAIN ](https://github.com/myungsub/CAIN ) [AdaCoF-pytorch ](https://github.com/HyeongminLEE/AdaCoF-pytorch )