ビデオを名画風に変換するartistic-videosを試すために環境を構築してみました。
artistic-videosは、以下の論文のTorch実装です。
Manuel Ruder, Alexey Dosovitskiy, Thomas Brox, “Artistic style transfer for videos”
また、以下の記事のneural-styleをベースにしています。
artistic-videosの環境構築
Torchは、NVIDIAのMachine LearningリポジトリでUbuntu 14.04にインストールしたTorch(torch7-nv)を使用します。
あらかじめ作成しておいたgithubディレクトリに移動し、GitHubのartistic-videos(https://github.com/manuelruder/artistic-videos)をcloneします。
$ cd ~/github $ git clone https://github.com/manuelruder/artistic-videos $ cd artistic-videos
GitHubのREADME.mdでは少し分かりにくいのですが、artistic-videosディレクトリにDeepFlowとDeepMatchingを準備する必要があります。
DeepFlow(deepflow2-static)の準備のために、以下のコマンドを実行します。
$ wget http://pascal.inrialpes.fr/data2/deepmatching/files/DeepFlow_release2.0.tar.gz $ tar xf DeepFlow_release2.0.tar.gz $ cp DeepFlow_release2.0/deepflow2-static .
同様に、DeepMatching(deepmatching-static)の準備のために、以下のコマンドを実行します。
$ wget http://lear.inrialpes.fr/src/deepmatching/code/deepmatching_1.2.2.zip $ unzip deepmatching_1.2.2.zip $ cp deepmatching_1.2.2_c++/deepmatching-static .
次に、モデルの準備を行います。
neural-styleの環境構築済の場合、モデルはダウンロード済のため、以下のコマンドでシンボリックリンクを張っておきます。
$ cd models $ ln -s ~/github/neural-style/models/VGG_ILSVRC_19_layers_deploy.prototxt VGG_ILSVRC_19_layers_deploy.prototxt $ ln -s ~/github/neural-style/models/vgg_normalised.caffemodel vgg_normalised.caffemodel $ ln -s ~/github/neural-style/models/VGG_ILSVRC_19_layers.caffemodel VGG_ILSVRC_19_layers.caffemodel
新規にモデルをダウンロードする場合、download_models.shを実行します。
$ sh models/download_models.sh
まとめ
ビデオを名画風に変換するartistic-videosを試すための環境を構築しました。