neural-styleは画像をDeep Learningでピカソ風にしたりとかのやつ。 Torch7,loadcaffeが必要だ。
th
コマンドはTorch7のコマンドだ。
インストール
人工知能で画像合成させる「ostagram」実行環境の作り方 - Hacking My Way 〜 itogのhack日記 が参考になる。 しかし、間違っているw
git clone https://github.com/torch/distro.git --recursive torch
のようにtorch
フォルダを指定するのがいい。
recursive
はサブモジュールもインストールするオプション。
CUDAのインストールしてないときに、
th neural_style.lua -style_image <image.jpg> -content_image <image.jpg>
を実行するときに
Error when running without CUDA: No LuaRocks module found for cutorch
エラーが出る。
ここ見ると分かるようにGPUを外すオプション-gpu -1
。
th neural_style.lua -style_image examples/inputs/picasso_selfport1907.jpg -content_image examples/inputs/brad_pitt.jpg -gpu -1
ちなみに、style_image
は画風の参考にさせる画像、content_image
は元絵。
僕はピカソの自画像を画風にブラッドピットを元絵にした。(今後githubから消されるかも?)
neural-style
フォルダ内で実行した。