From d7c0520527371c70381c8417fe1aa73cb2bb60c5 Mon Sep 17 00:00:00 2001 From: Alpha Date: Sat, 6 Jun 2020 20:50:35 -0400 Subject: [PATCH 1/3] Ensure Google Colab GPU Compatibility - Added parameters to compile for all available GPU models in Google Colaboratory. - Moved the instructions to a common file used by all setup files - Adapted Colab file, removing outdated error indicators --- Colab_DAIN.ipynb | 94 +++++++++++++++---- .../correlation_package_pytorch1_0/build.sh | 1 + .../correlation_package_pytorch1_0/setup.py | 9 +- my_package/DepthFlowProjection/setup.py | 9 +- my_package/FilterInterpolation/setup.py | 9 +- my_package/FlowProjection/setup.py | 9 +- my_package/Interpolation/setup.py | 9 +- my_package/InterpolationCh/setup.py | 9 +- my_package/MinDepthFlowProjection/setup.py | 9 +- my_package/SeparableConv/setup.py | 9 +- my_package/SeparableConvFlow/setup.py | 9 +- my_package/build.sh | 2 + my_package/nvcc_args.py | 46 +++++++++ 13 files changed, 133 insertions(+), 91 deletions(-) create mode 100644 my_package/nvcc_args.py diff --git a/Colab_DAIN.ipynb b/Colab_DAIN.ipynb index f6533a8..e210073 100644 --- a/Colab_DAIN.ipynb +++ b/Colab_DAIN.ipynb @@ -142,11 +142,6 @@ "# 16GB: Can handle 720p. 1080p will procude an out-of-memory error. \n", "# 8GB: Can handle 480p. 720p will produce an out-of-memory error.\n", "\n", - "# P100: 16GB (Works)\n", - "# T4: 16GB [RuntimeError: CUDA call failed]\n", - "# P4: 8GB (Works)\n", - "# K80: 8GB (Not tested)\n", - "\n", "!nvidia-smi --query-gpu=gpu_name,driver_version,memory.total --format=csv" ], "execution_count": 0, @@ -169,38 +164,98 @@ { "cell_type": "code", "metadata": { - "id": "UeaU8um5-2NS", + "id": "XunYRBtyPZf_", "colab_type": "code", "colab": {} }, "source": [ + "# Install known used versions of PyTorch and SciPy\n", "!pip install torch==1.4.0+cu100 torchvision==0.5.0+cu100 -f https://download.pytorch.org/whl/torch_stable.html\n", - "!pip install scipy==1.1.0\n", - "\n", - "from IPython.display import clear_output\n", - "!git clone https://github.com/baowenbo/DAIN /content/DAIN\n", - "\n", + "!pip install scipy==1.1.0" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "-mRVRXIGPk9I", + "colab_type": "code", + "colab": {} + }, + "source": [ + "# Clone DAIN sources\n", + "# TODO Bring back original repo\n", + "#!git clone https://github.com/baowenbo/DAIN /content/DAIN\n", + "%cd /content\n", + "!rm -rf DAIN\n", + "!git clone -b colab-compatibility --depth 1 https://github.com/AlphaGit/DAIN /content/DAIN\n", + "%cd /content/DAIN\n", + "!git log -1" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "e5AHGetTRacZ", + "colab_type": "code", + "colab": {} + }, + "source": [ "# This takes a while. Just wait. ~15 minutes.\n", "# Building DAIN.\n", "%cd /content/DAIN/my_package/\n", "!./build.sh\n", - "print(\"Building #1 done.\")\n", - "\n", + "print(\"Building #1 done.\")" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "UeaU8um5-2NS", + "colab_type": "code", + "colab": {} + }, + "source": [ "# Wait again. ~5 minutes.\n", "# Building DAIN PyTorch correlation package.\n", "%cd /content/DAIN/PWCNet/correlation_package_pytorch1_0\n", "!./build.sh\n", - "print(\"Building #2 done.\")\n", - "\n", + "print(\"Building #2 done.\")" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "InjqMYIyXCZs", + "colab_type": "code", + "colab": {} + }, + "source": [ "# Downloading pre-trained model\n", "%cd /content/DAIN\n", "!mkdir model_weights\n", - "!wget -O model_weights/best.pth http://vllab1.ucmerced.edu/~wenbobao/DAIN/best.pth\n", - "\n", + "!wget -O model_weights/best.pth http://vllab1.ucmerced.edu/~wenbobao/DAIN/best.pth" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "FrdWsqbvXEid", + "colab_type": "code", + "colab": {} + }, + "source": [ "!CUDA_VISIBLE_DEVICES=0\n", - "\n", "!sudo apt-get install imagemagick imagemagick-doc\n", - "\n", "print(\"Finished installing dependencies.\")" ], "execution_count": 0, @@ -246,6 +301,7 @@ "%shell ffmpeg -i '/content/DAIN/{filename}' '{FRAME_INPUT_DIR}/%05d.png'\n", "\n", "png_generated_count_command_result = %shell ls '{FRAME_INPUT_DIR}' | wc -l\n", + "from IPython.display import clear_output\n", "clear_output()\n", "\n", "pngs_generated_count = int(png_generated_count_command_result.output.strip())\n", diff --git a/PWCNet/correlation_package_pytorch1_0/build.sh b/PWCNet/correlation_package_pytorch1_0/build.sh index 2fb836d..f26b66e 100755 --- a/PWCNet/correlation_package_pytorch1_0/build.sh +++ b/PWCNet/correlation_package_pytorch1_0/build.sh @@ -3,6 +3,7 @@ echo "Need pytorch>=1.0.0" source activate pytorch1.0.0 +export PYTHONPATH=$PYTHONPATH:$(pwd)/../../my_package rm -rf build *.egg-info dist python setup.py install diff --git a/PWCNet/correlation_package_pytorch1_0/setup.py b/PWCNet/correlation_package_pytorch1_0/setup.py index 08c7b34..fc95341 100755 --- a/PWCNet/correlation_package_pytorch1_0/setup.py +++ b/PWCNet/correlation_package_pytorch1_0/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='correlation_cuda', diff --git a/my_package/DepthFlowProjection/setup.py b/my_package/DepthFlowProjection/setup.py index 83f9121..4689fab 100755 --- a/my_package/DepthFlowProjection/setup.py +++ b/my_package/DepthFlowProjection/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='depthflowprojection_cuda', diff --git a/my_package/FilterInterpolation/setup.py b/my_package/FilterInterpolation/setup.py index b1f54e7..e178605 100755 --- a/my_package/FilterInterpolation/setup.py +++ b/my_package/FilterInterpolation/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='filterinterpolation_cuda', diff --git a/my_package/FlowProjection/setup.py b/my_package/FlowProjection/setup.py index 5fab02c..6769408 100755 --- a/my_package/FlowProjection/setup.py +++ b/my_package/FlowProjection/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='flowprojection_cuda', diff --git a/my_package/Interpolation/setup.py b/my_package/Interpolation/setup.py index 32ae93f..42c70f4 100755 --- a/my_package/Interpolation/setup.py +++ b/my_package/Interpolation/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='interpolation_cuda', diff --git a/my_package/InterpolationCh/setup.py b/my_package/InterpolationCh/setup.py index 0f0664e..d48aa74 100755 --- a/my_package/InterpolationCh/setup.py +++ b/my_package/InterpolationCh/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='interpolationch_cuda', diff --git a/my_package/MinDepthFlowProjection/setup.py b/my_package/MinDepthFlowProjection/setup.py index d88c389..4638153 100755 --- a/my_package/MinDepthFlowProjection/setup.py +++ b/my_package/MinDepthFlowProjection/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='mindepthflowprojection_cuda', diff --git a/my_package/SeparableConv/setup.py b/my_package/SeparableConv/setup.py index 31e8249..1c54a8d 100755 --- a/my_package/SeparableConv/setup.py +++ b/my_package/SeparableConv/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='separableconv_cuda', diff --git a/my_package/SeparableConvFlow/setup.py b/my_package/SeparableConvFlow/setup.py index 0b137f0..dd3433b 100755 --- a/my_package/SeparableConvFlow/setup.py +++ b/my_package/SeparableConvFlow/setup.py @@ -7,14 +7,7 @@ cxx_args = ['-std=c++11'] -nvcc_args = [ - '-gencode', 'arch=compute_50,code=sm_50', - '-gencode', 'arch=compute_52,code=sm_52', - '-gencode', 'arch=compute_60,code=sm_60', - '-gencode', 'arch=compute_61,code=sm_61' - # '-gencode', 'arch=compute_70,code=sm_70', - # '-gencode', 'arch=compute_70,code=compute_70' -] +from nvcc_args import nvcc_args setup( name='separableconvflow_cuda', diff --git a/my_package/build.sh b/my_package/build.sh index 04a45da..30fe202 100755 --- a/my_package/build.sh +++ b/my_package/build.sh @@ -3,6 +3,8 @@ echo "Need pytorch>=1.0.0" source activate pytorch1.0.0 +export PYTHONPATH=$PYTHONPATH:$(pwd) + cd MinDepthFlowProjection rm -rf build *.egg-info dist python setup.py install diff --git a/my_package/nvcc_args.py b/my_package/nvcc_args.py new file mode 100644 index 0000000..82f0a01 --- /dev/null +++ b/my_package/nvcc_args.py @@ -0,0 +1,46 @@ +# References: https://developer.nvidia.com/cuda-gpus +nvcc_args = [ + # Tesla: K80, K80 + # Quadro: (None) + # NVIDIA NVS: (None) + # Jetson: (None) + '-gencode', 'arch=compute_37,code=sm_37', + + # Tesla: (None) + # Quadro: K1200, K620, M1200, M520, M5000M, M4000M, M3000M, M2000M, M1000M, K620M, M600M, M500M + # NVIDIA NVS: 810 + # GeForce / Titan: GTX 750 Ti, GTX 750, GTX 960M, GTX 950M, 940M, 930M, GTX 860M, GTX 850M, 840M, 830M + # Jetson: (None) + '-gencode', 'arch=compute_50,code=sm_50', + + # Tesla: M60, M40 + # Quadro: M6000 24GB, M6000, M5000, M4000, M2000, M5500M, M2200, M620 + # NVIDIA NVS: (None) + # GeForce / Titan: GTX TITAN X, GTX 980 Ti, GTX 980, GTX 970, GTX 960, GTX 950, GTX 980, GTX 980M, GTX 970M, GTX 965M, 910M + # Jetson: (None) + '-gencode', 'arch=compute_52,code=sm_52', # , + + # Tesla: P100 + # Quadro: GP100 + # NVIDIA: NVS: (None) + # GeForce / Titan: (None) + # Jetson: (None) + '-gencode', 'arch=compute_60,code=sm_60', + + # Tesla: P40, P4 + # Quadro: P6000, P5000, P4000, P2200, P2000, P1000, P620, P600, P400, P620, P520, P5200, P4200, P3200, P5000, P4000, P3000, P2000, P1000, P600, P500 + # NVIDIA NVS: (None) + # GeForce / Titan: TITAN Xp, TITAN X, GTX 1080 Ti, GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1080, GTX 1070, GTX 1060 + # Jetson: (None) + '-gencode', 'arch=compute_61,code=sm_61', + + # Tesla: T4 + # Quadro: RTX 8000, RTX 6000, RTX 5000, RTX 4000, RTX 5000, RTX 4000, RTX 3000, T2000, T1000 + # NVIDIA NVS: (None) + # GeForce / Titan: TITAN RTX, RTX 2080 Ti, RTX 2080, RTX 2070, RTX 2060, RTX 2080, RTX 2070, RTX 2060 + # Jetson: (None) + '-gencode', 'arch=compute_75,code=sm_75' + + # '-gencode', 'arch=compute_70,code=sm_70', + # '-gencode', 'arch=compute_70,code=compute_70' +] \ No newline at end of file From f9073d9f42dd863a9cd150de8c263398a7093fbf Mon Sep 17 00:00:00 2001 From: Alpha Date: Sun, 7 Jun 2020 11:13:02 -0400 Subject: [PATCH 2/3] Supressing compiler warnings --- PWCNet/correlation_package_pytorch1_0/setup.py | 4 +--- my_package/DepthFlowProjection/setup.py | 4 +--- my_package/FilterInterpolation/setup.py | 4 +--- my_package/FlowProjection/setup.py | 4 +--- my_package/Interpolation/setup.py | 4 +--- my_package/InterpolationCh/setup.py | 4 +--- my_package/MinDepthFlowProjection/setup.py | 4 +--- my_package/SeparableConv/setup.py | 4 +--- my_package/SeparableConvFlow/setup.py | 4 +--- my_package/{nvcc_args.py => compiler_args.py} | 8 ++++++-- 10 files changed, 15 insertions(+), 29 deletions(-) rename my_package/{nvcc_args.py => compiler_args.py} (91%) diff --git a/PWCNet/correlation_package_pytorch1_0/setup.py b/PWCNet/correlation_package_pytorch1_0/setup.py index fc95341..bc01ef3 100755 --- a/PWCNet/correlation_package_pytorch1_0/setup.py +++ b/PWCNet/correlation_package_pytorch1_0/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='correlation_cuda', diff --git a/my_package/DepthFlowProjection/setup.py b/my_package/DepthFlowProjection/setup.py index 4689fab..04d99e7 100755 --- a/my_package/DepthFlowProjection/setup.py +++ b/my_package/DepthFlowProjection/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='depthflowprojection_cuda', diff --git a/my_package/FilterInterpolation/setup.py b/my_package/FilterInterpolation/setup.py index e178605..28a789c 100755 --- a/my_package/FilterInterpolation/setup.py +++ b/my_package/FilterInterpolation/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='filterinterpolation_cuda', diff --git a/my_package/FlowProjection/setup.py b/my_package/FlowProjection/setup.py index 6769408..7d83c4c 100755 --- a/my_package/FlowProjection/setup.py +++ b/my_package/FlowProjection/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='flowprojection_cuda', diff --git a/my_package/Interpolation/setup.py b/my_package/Interpolation/setup.py index 42c70f4..86e6b11 100755 --- a/my_package/Interpolation/setup.py +++ b/my_package/Interpolation/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='interpolation_cuda', diff --git a/my_package/InterpolationCh/setup.py b/my_package/InterpolationCh/setup.py index d48aa74..dd43125 100755 --- a/my_package/InterpolationCh/setup.py +++ b/my_package/InterpolationCh/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='interpolationch_cuda', diff --git a/my_package/MinDepthFlowProjection/setup.py b/my_package/MinDepthFlowProjection/setup.py index 4638153..5afbb9a 100755 --- a/my_package/MinDepthFlowProjection/setup.py +++ b/my_package/MinDepthFlowProjection/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='mindepthflowprojection_cuda', diff --git a/my_package/SeparableConv/setup.py b/my_package/SeparableConv/setup.py index 1c54a8d..6bfb9e2 100755 --- a/my_package/SeparableConv/setup.py +++ b/my_package/SeparableConv/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='separableconv_cuda', diff --git a/my_package/SeparableConvFlow/setup.py b/my_package/SeparableConvFlow/setup.py index dd3433b..a2c6631 100755 --- a/my_package/SeparableConvFlow/setup.py +++ b/my_package/SeparableConvFlow/setup.py @@ -5,9 +5,7 @@ from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension -cxx_args = ['-std=c++11'] - -from nvcc_args import nvcc_args +from compiler_args import nvcc_args, cxx_args setup( name='separableconvflow_cuda', diff --git a/my_package/nvcc_args.py b/my_package/compiler_args.py similarity index 91% rename from my_package/nvcc_args.py rename to my_package/compiler_args.py index 82f0a01..0b571b6 100644 --- a/my_package/nvcc_args.py +++ b/my_package/compiler_args.py @@ -39,8 +39,12 @@ # NVIDIA NVS: (None) # GeForce / Titan: TITAN RTX, RTX 2080 Ti, RTX 2080, RTX 2070, RTX 2060, RTX 2080, RTX 2070, RTX 2060 # Jetson: (None) - '-gencode', 'arch=compute_75,code=sm_75' + '-gencode', 'arch=compute_75,code=sm_75', # '-gencode', 'arch=compute_70,code=sm_70', # '-gencode', 'arch=compute_70,code=compute_70' -] \ No newline at end of file + + '-w' # Ignore compiler warnings. +] + +cxx_args = ['-std=c++11', '-w'] \ No newline at end of file From e70d6d59f77a0fc3243e6ce012a3531fc339c498 Mon Sep 17 00:00:00 2001 From: Alpha Date: Sun, 7 Jun 2020 13:43:19 -0400 Subject: [PATCH 3/3] Updated documentation - Updated documentation inside and outside of Colab file. - Removed references to any shared Colab file, to avoid outdated versions out there. The one in the `master` branch of this repo should be the canonical one. - Added versioning to the file itself, so we can easily tell when someone is using an old version of the file. - Added markdown input for configuration --- Colab_DAIN.ipynb | 120 +++++++++++++++++------------------- README.md | 10 ++- my_package/compiler_args.py | 2 +- 3 files changed, 67 insertions(+), 65 deletions(-) diff --git a/Colab_DAIN.ipynb b/Colab_DAIN.ipynb index e210073..1b309b3 100644 --- a/Colab_DAIN.ipynb +++ b/Colab_DAIN.ipynb @@ -33,16 +33,16 @@ "colab_type": "text" }, "source": [ - "Credits to original Colab file: \n", - "https://github.com/baowenbo/DAIN/issues/44\n", + "*DAIN Colab, v1.4.0*\n", "\n", - "My fork:\n", - "https://github.com/styler00dollar/DAIN\n", + "Based on the [original Colab file](https://github.com/baowenbo/DAIN/issues/44) by btahir. \n", "\n", - "Enhancement by [Styler00Dollar](https://github.com/styler00dollar) aka \"sudo rm -rf / --no-preserve-root#8353\" on discord and [Alpha](https://github.com/AlphaGit). Please do not run this command in your linux terminal. It's rather meant as a joke.\n", + "Enhancements by [Styler00Dollar](https://github.com/styler00dollar) aka \"sudo rm -rf / --no-preserve-root#8353\" on discord and [Alpha](https://github.com/AlphaGit), (Alpha#6137 on Discord). Please do not run this command in your linux terminal. It's rather meant as a joke.\n", + "\n", + "[Styler00Dollar's fork](https://github.com/styler00dollar/DAIN) / [Alpha's fork](https://github.com/AlphaGit/DAIN)\n", "\n", "A simple guide:\n", - "- Upload the ` .ipynb` file to your Google Colab.\n", + "- Upload this ` .ipynb` file to your Google Colab.\n", "- Create a folder inside of Google Drive named \"DAIN\"\n", "- Change the configurations in the next cell\n", "- Run cells one by one\n", @@ -52,7 +52,7 @@ "- Adding configuration to select speed\n", "- Detect scenes to avoid interpolating scene-changes\n", "- Auto-resume\n", - "- Copy `start_frame` - `end_frame` audio from original input to final output" + "- Copy `start_frame` - `end_frame` audio from original input to final output\n" ] }, { @@ -63,51 +63,49 @@ "colab": {} }, "source": [ - "################# Configurations ############################\n", + "################# Required Configurations ############################\n", "\n", - "# Use the values in here to configure what you'd like DAIN to do.\n", + "#@markdown # Required Configuration\n", + "#@markdown Use the values in here to configure what you'd like DAIN to do.\n", "\n", - "# Input file: Path (relative to the root of your Google Drive) to the input file.\n", - "# For instance, if you save your \"example.mkv\" file in your Google Drive, inside a \"videos\" folder, the path would be:\n", - "# videos/example.mkv. Currenly videos and gifs are supported.\n", - "INPUT_FILEPATH = \"DAIN/input.mp4\"\n", + "#@markdown ## Input file\n", + "#@markdown Path (relative to the root of your Google Drive) to the input file. For instance, if you save your `example.mkv` file in your Google Drive, inside a `videos` folder, the path would be: `videos/example.mkv`. Currenly videos and gifs are supported.\n", + "INPUT_FILEPATH = \"DAIN/input.mp4\" #@param{type:\"string\"}\n", "\n", - "# Output file path: path (relative to the root of your Google Drive) for the output file. It will also determine the\n", - "# filetype in the destination. MP4 is recommended.\n", - "OUTPUT_FILE_PATH = \"DAIN/output.mp4\"\n", + "#@markdown ## Output file\n", + "#@markdown Output file path: path (relative to the root of your Google Drive) for the output file. It will also determine the filetype in the destination. `.mp4` is recommended for video input, `.gif` for gif inputs.\n", + "OUTPUT_FILE_PATH = \"DAIN/output.mp4\" #@param{type:\"string\"}\n", "\n", "################# Optional configurations ############################\n", "\n", - "# Target FPS = how many frames per second should the result have. This will determine how many intermediate images are\n", - "# interpolated.\n", - "TARGET_FPS = 60\n", - "\n", - "# Frame input directly\n", - "# Use a path that is in your GDrive if you already have the list of frames in the format 00001.png, 00002.png, etc.\n", - "# Your GDrive is located at `/content/gdrive/My Drive/`\n", - "FRAME_INPUT_DIR = '/content/DAIN/input_frames'\n", - "\n", - "# Frame output directory\n", - "# Use a location in your GDrive if you want the generated frames stored to your Google Drive.\n", - "# Your GDrive is located at `/content/gdrive/My Drive/DAIN/tmp`\n", - "FRAME_OUTPUT_DIR = '/content/DAIN/output_frames'\n", - "\n", - "# Seamless playback\n", - "# Creates a seamless loop by using the first frame as last one as well. Set this to True this if loop is intended.\n", - "SEAMLESS = False\n", - "\n", - "# Resize hotfix\n", - "# DAIN frames are a bit \"shifted / smaller\" compared to original input frames. This can partly be mitigated with resizing\n", - "# DAIN frames to the resolution +2px and cropping the result to the original resoultion with the starting point (1,1).\n", - "# Without this fix, DAIN tends to make \"vibrating\" output and it is pretty noticible with static elements like text.\n", - "# This hotfix tries to make such effects less visible for a smoother video playback. I do not know what DAINAPP\n", - "# uses as a fix for this problem, but the original does show such behaviour with the default test images. More advanced\n", - "# users can change the interpolation method. The methods cv2.INTER_CUBIC and cv2.INTER_LANCZOS4 are recommended.\n", - "# The current default value is cv2.INTER_LANCZOS4.\n", - "RESIZE_HOTFIX = True\n", - "\n", - "# Auto-delete output PNG dir after ffmpeg video creation.\n", - "AUTO_REMOVE = True" + "#@markdown # Optional Configuration\n", + "#@markdown Parameters below can be left with their defaults, but feel free to adapt them to your needs.\n", + "\n", + "#@markdown ## Target FPS\n", + "#@markdown how many frames per second should the result have. This will determine how many intermediate images are interpolated.\n", + "TARGET_FPS = 60 #@param{type:\"number\"}\n", + "\n", + "#@markdown ## Frame input directory\n", + "#@markdown A path, relative to your GDrive root, where you already have the list of frames in the format 00001.png, 00002.png, etc.\n", + "FRAME_INPUT_DIR = '/content/DAIN/input_frames' #@param{type:\"string\"}\n", + "\n", + "#@markdown ## Frame output directory\n", + "#@markdown A path, relative to your GDrive root, where you want the generated frame.\n", + "FRAME_OUTPUT_DIR = '/content/DAIN/output_frames' #@param{type:\"string\"}\n", + "\n", + "#@markdown ## Seamless playback\n", + "#@markdown Creates a seamless loop by using the first frame as last one as well. Set this to True this if loop is intended.\n", + "SEAMLESS = False #@param{type:\"boolean\"}\n", + "\n", + "#@markdown ## Resize hotfix\n", + "#@markdown DAIN frames are a bit \"shifted / smaller\" compared to original input frames. This can partly be mitigated with resizing DAIN frames to the resolution +2px and cropping the result to the original resoultion with the starting point (1,1). Without this fix, DAIN tends to make \"vibrating\" output and it is pretty noticible with static elements like text.\n", + "#@markdown\n", + "#@markdown This hotfix tries to make such effects less visible for a smoother video playback. I do not know what DAINAPP uses as a fix for this problem, but the original does show such behaviour with the default test images. More advanced users can change the interpolation method. The methods cv2.INTER_CUBIC and cv2.INTER_LANCZOS4 are recommended. The current default value is cv2.INTER_LANCZOS4.\n", + "RESIZE_HOTFIX = True #@param{type:\"boolean\"}\n", + "\n", + "#@markdown ## Auto-remove PNG directory\n", + "#@markdown Auto-delete output PNG dir after ffmpeg video creation. Set this to `False` if you want to keep the PNG files.\n", + "AUTO_REMOVE = True #@param{type:\"boolean\"}" ], "execution_count": 0, "outputs": [] @@ -384,9 +382,7 @@ "source": [ "# Create video\n", "%cd {FRAME_OUTPUT_DIR}\n", - "%shell ffmpeg -y -r {TARGET_FPS} -f image2 -pattern_type glob -i '*.png' '/content/gdrive/My Drive/{OUTPUT_FILE_PATH}'\n", - "if(AUTO_REMOVE==True):\n", - " !rm -rf {FRAME_OUTPUT_DIR}/*" + "%shell ffmpeg -y -r {TARGET_FPS} -f image2 -pattern_type glob -i '*.png' '/content/gdrive/My Drive/{OUTPUT_FILE_PATH}'" ], "execution_count": 0, "outputs": [] @@ -394,20 +390,13 @@ { "cell_type": "code", "metadata": { - "id": "uCBHIXNN-JYu", + "id": "UF5TEo5N374o", "colab_type": "code", "colab": {} }, "source": [ - "# [Experimental] Create video with sound\n", - "# Only run this, if the original had sound.\n", - "%cd {FRAME_OUTPUT_DIR}\n", - "%shell ffmpeg -i '/content/DAIN/{filename}' -acodec copy output-audio.aac\n", - "%shell ffmpeg -y -r {TARGET_FPS} -f image2 -pattern_type glob -i '*.png' -i output-audio.aac -shortest '/content/gdrive/My Drive/{OUTPUT_FILE_PATH}'\n", - "\n", - "if (AUTO_REMOVE):\n", - " !rm -rf {FRAME_OUTPUT_DIR}/*\n", - " !rm -rf output-audio.aac" + "if(AUTO_REMOVE):\n", + " !rm -rf {FRAME_OUTPUT_DIR}/*" ], "execution_count": 0, "outputs": [] @@ -415,13 +404,20 @@ { "cell_type": "code", "metadata": { - "id": "8tTXpWkRBm8T", + "id": "uCBHIXNN-JYu", "colab_type": "code", "colab": {} }, "source": [ - "# Manually removing output PNG dir (before working with another file)\n", - "!rm -rf {FRAME_OUTPUT_DIR}/*" + "# [Experimental] Create video with sound\n", + "# Only run this, if the original had sound.\n", + "%cd {FRAME_OUTPUT_DIR}\n", + "%shell ffmpeg -i '/content/DAIN/{filename}' -acodec copy output-audio.aac\n", + "%shell ffmpeg -y -r {TARGET_FPS} -f image2 -pattern_type glob -i '*.png' -i output-audio.aac -shortest '/content/gdrive/My Drive/{OUTPUT_FILE_PATH}'\n", + "\n", + "if (AUTO_REMOVE):\n", + " !rm -rf {FRAME_OUTPUT_DIR}/*\n", + " !rm -rf output-audio.aac" ], "execution_count": 0, "outputs": [] diff --git a/README.md b/README.md index 35f3d2f..580db8f 100644 --- a/README.md +++ b/README.md @@ -229,9 +229,15 @@ Then test the new model by executing: This is a modification of DAIN that allows the usage of Google Colab and is able to do a full demo interpolation from a source video to a target video. Original Notebook File by btahir can be found [here](https://github.com/baowenbo/DAIN/issues/44). -This is a modification by [Styler00Dollar](https://github.com/styler00dollar) and [Alpha](https://github.com/AlphaGit). -Simply upload the `Colab_DAIN.ipynb` file to your Google Drive or use this [link](https://colab.research.google.com/drive/1gzsfDV_MIdehr7Y8ZzWjTuW-mMZRP4Vy). +To use the Colab, follow these steps: + +- Download the `Colab_DAIN.ipynb` file ([link](https://raw.githubusercontent.com/baowenbo/DAIN/master/Colab_DAIN.ipynb)). +- Visit Google Colaboratory ([link](https://colab.research.google.com/)) +- Select the "Upload" option, and upload the `.ipynb` file +- Start running the cells one by one, following the instructions. + +Colab file authors: [Styler00Dollar](https://github.com/styler00dollar) and [Alpha](https://github.com/AlphaGit). ### Contact [Wenbo Bao](mailto:bwb0813@gmail.com); [Wei-Sheng (Jason) Lai](mailto:phoenix104104@gmail.com) diff --git a/my_package/compiler_args.py b/my_package/compiler_args.py index 0b571b6..7451c0c 100644 --- a/my_package/compiler_args.py +++ b/my_package/compiler_args.py @@ -18,7 +18,7 @@ # NVIDIA NVS: (None) # GeForce / Titan: GTX TITAN X, GTX 980 Ti, GTX 980, GTX 970, GTX 960, GTX 950, GTX 980, GTX 980M, GTX 970M, GTX 965M, 910M # Jetson: (None) - '-gencode', 'arch=compute_52,code=sm_52', # , + '-gencode', 'arch=compute_52,code=sm_52', # Tesla: P100 # Quadro: GP100