Files
ECCV2022-RIFE/Colab_demo.ipynb

126 lines
3.2 KiB
Plaintext
Raw Permalink Normal View History

2020-11-14 13:57:03 +08:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
2020-11-14 13:57:03 +08:00
},
"source": [
2020-11-16 16:21:01 +08:00
"<a href=\"https://colab.research.google.com/github/hzwer/arXiv2020-RIFE/blob/main/Colab_demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
2020-11-14 13:57:03 +08:00
]
},
{
"cell_type": "code",
"execution_count": null,
2020-11-14 13:57:03 +08:00
"metadata": {
"id": "FypCcZkNNt2p"
},
"outputs": [],
2020-11-14 13:57:03 +08:00
"source": [
"!git clone https://github.com/hzwer/arXiv2020-RIFE"
]
2020-11-14 13:57:03 +08:00
},
{
"cell_type": "code",
"execution_count": null,
2020-11-14 13:57:03 +08:00
"metadata": {
"id": "1wysVHxoN54f"
},
"outputs": [],
2020-11-14 13:57:03 +08:00
"source": [
"!mkdir /content/arXiv2020-RIFE/train_log\n",
"%cd /content/arXiv2020-RIFE/train_log\n",
"!gdown --id 1APIzVeI-4ZZCEuIRE1m6WYfSCaOsi_7_\n",
"!7z e RIFE_trained_model_v3.6.zip"
]
2020-11-14 13:57:03 +08:00
},
{
"cell_type": "code",
"execution_count": null,
2020-11-14 13:57:03 +08:00
"metadata": {
"id": "AhbHfRBJRAUt"
},
"outputs": [],
2020-11-14 13:57:03 +08:00
"source": [
2020-11-15 23:34:14 +08:00
"%cd /content/arXiv2020-RIFE/\n",
2020-12-03 15:13:16 +08:00
"!gdown --id 1i3xlKb7ax7Y70khcTcuePi6E7crO_dFc\n",
"!pip install git+https://github.com/rk-exxec/scikit-video.git@numpy_deprecation"
]
2020-11-14 13:57:03 +08:00
},
{
"cell_type": "markdown",
"metadata": {
"id": "rirngW5uRMdg"
},
"source": [
2020-11-15 23:34:14 +08:00
"Please upload your video to content/arXiv2020-RIFE/video.mp4, or use our demo video."
2020-11-14 13:57:03 +08:00
]
},
{
"cell_type": "code",
"execution_count": null,
2020-11-14 13:57:03 +08:00
"metadata": {
"id": "dnLn4aHHPzN3"
},
"outputs": [],
2020-11-14 13:57:03 +08:00
"source": [
"!nvidia-smi\n",
2023-05-03 01:27:30 +08:00
"!python3 inference_video.py --exp=2 --video=demo.mp4 --montage"
]
2020-11-14 13:57:03 +08:00
},
2020-11-16 13:24:13 +08:00
{
"cell_type": "markdown",
"metadata": {
"id": "77KK6lxHgJhf"
},
"source": [
2020-11-18 11:58:29 +08:00
"Our demo.mp4 is 25FPS. You can adjust the parameters for your own perference.\n",
"For example: \n",
2020-11-19 11:07:37 +08:00
"--fps=60 --exp=1 --video=mydemo.avi --png"
2020-11-16 13:24:13 +08:00
]
},
2020-11-17 19:14:15 +08:00
{
"cell_type": "code",
"execution_count": null,
2020-11-17 19:14:15 +08:00
"metadata": {
"cellView": "code",
"id": "0zIBbVE3UfUD"
2020-11-17 19:14:15 +08:00
},
"outputs": [],
2020-11-17 19:14:15 +08:00
"source": [
2020-12-02 17:55:20 +08:00
"from IPython.display import display, Image\n",
"import moviepy.editor as mpy\n",
"display(mpy.ipython_display('demo_4X_100fps.mp4', height=256, max_duration=100.))"
]
2020-11-17 19:14:15 +08:00
},
2020-11-14 13:57:03 +08:00
{
"cell_type": "code",
"execution_count": null,
2020-11-14 13:57:03 +08:00
"metadata": {
2020-12-02 17:55:20 +08:00
"id": "tWkJCNgP3zXA"
2020-11-14 13:57:03 +08:00
},
"outputs": [],
2020-11-14 13:57:03 +08:00
"source": [
2020-12-02 17:55:20 +08:00
"!python3 inference_img.py --img demo/I0_0.png demo/I0_1.png\n",
"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\n",
"# Image interpolation"
]
2020-11-14 13:57:03 +08:00
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"include_colab_link": true,
"name": "Untitled0.ipynb",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}