Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
Last active September 24, 2018 04:24
Show Gist options
  • Save n1ckfg/6cbe3c08d58600766f1f875c7eb73b2c to your computer and use it in GitHub Desktop.
Save n1ckfg/6cbe3c08d58600766f1f875c7eb73b2c to your computer and use it in GitHub Desktop.

SETUP for FAST-ARTISTIC-VIDEOS on Ubuntu 16.04 / 180923 https://github.com/manuelruder/fast-artistic-videos

  1. Follow the artistic-videos setup at: https://gist.github.com/n1ckfg/b7b3edd820f3e0060310322cf3e71d5f

  2. Install these luarocks packages:

luarocks install torch
luarocks install nn
luarocks install image
luarocks install lua-cjson
luarocks install cutorch
  1. You also need these packages, but they should have already been installed for artistic-videos:
luarocks install cudnn
luarocks install cunn
  1. Compile this local luarocks package:
cd stnbhwd
luarocks make stnbdhw-scm-1.rockspec
  1. Download the models:
bash models/download_models.sh
  1. For optical flow, you can copy over the deepflow binaries from artistic-videos (which are CPU-based and slow).

  2. Or you can get flownet (which is GPU-based and fast): https://github.com/lmb-freiburg/flownet2

  3. Download flownet's models:

bash models/download-models.sh
  1. Copy Makefile.config.example to Makefile.config

  2. Make these changes in the makefile: BVLC/caffe#2347

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
USE_CUDNN := 1
  1. Add these symlinks: BVLC/caffe#4333
cd /usr/lib/x86_64-linux-gnu
sudo ln -s libhdf5_serial.so.10.1.0 libhdf5.so
sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so
  1. Return to your flownet directory and compile caffe:
make -j 5 all tools pycaffe
make distribute
  1. Run the flownet setup script.
source set-env.sh 
  1. install flownet python dependencies.
cd flownet2/distribute/python
sudo pip install -r requirements.txt
  1. Return to fast-artistic-videos and replace the text in partially-completed run-flownet-multiple.sh
FLOWNET="$HOME/GitHub/ML/flownet2"

export CAFFE_BIN="$FLOWNET/build/tools/caffe.bin"
export PYTHONPATH=$PYTHONPATH:$FLOWNET/distribute/python/
export LD_LIBRARY_PATH=$FLOWNET/distribute/lib:$LD_LIBRARY_PATH

chmod +x "$FLOWNET/scripts/run-flownet-many.py"
"$FLOWNET/scripts/run-flownet-many.py" "$FLOWNET/models/FlowNet2/FlowNet2_weights.caffemodel.h5" "$FLOWNET/models/FlowNet2/FlowNet2_deploy.prototxt.template" $1 --gpu ${2:-0}
  1. Optional, for stylizing 360 videos, you need Facebook's Transform360 ffmpeg plugin: https://github.com/facebook/transform360 and the VR models:
bash download_models_vr.sh
  1. Go!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment