fast-style-transfer 初探

一、训练一个新的画风迁移网络

nohup python style.py –checkpoint-dir ./checkpoint/rain-princess –style ./rain-princess.jpg –test ./military_museum.jpg –test-dir ./test_images/rain-princess > style_py_stdout.log 2>&1 &

《fast-style-transfer 初探》 nohup python style.py –checkpoint-dir ./checkpoint/rain-princess –style ./rain-princess.jpg –test ./military_museum.jpg –test-dir ./test_images/rain-princess > style_py_stdout.log 2>&1 &

1.1 训练过程中GPU使用情况

《fast-style-transfer 初探》 nvidia-smi

1.2训练结束(GPU:GTX 1080 Ti,耗时7.5h)

《fast-style-transfer 初探》
《fast-style-transfer 初探》

二、评估训练好的画风迁移网络

nohup python evaluate.py –checkpoint ./checkpoint/rain-princess/ –in-path ./in-path/central_tv_tower.jpg –out-path ./out-path/ > evaluate_py.log 2>&1 &

《fast-style-transfer 初探》 nohup python evaluate.py –checkpoint ./checkpoint/rain-princess/ –in-path ./in-path/central_tv_tower.jpg –out-path ./out-path/ >> evaluate_py.log 2>&1 &
《fast-style-transfer 初探》

左侧为原图,右侧为渲染后的图,画风为 rain-princess

《fast-style-transfer 初探》

三、渲染视频

nohup python transform_video.py –checkpoint ./checkpoint/rain-princess/ –in-path ./in-path/Little_Kitten_Playing_His_Toy_Mouse.mp4 –out-path ./out-path/Little_Kitten_Playing_His_Toy_Mouse_render.mp4 –tmp-dir ./tmp-path/ > ./transform_video_py.log 2>&1 &

GPU使用情况

《fast-style-transfer 初探》

渲染结果

《fast-style-transfer 初探》

四、错误处理

1.ffmpeg 需通过conda安装,直接命令行安装不行,安装命令: conda install -c conda-forge ffmpeg

2.缺libx264编码库

《fast-style-transfer 初探》

安装之:

git clone git://git.videolan.org/x264.git

cd x264

./configure –enable-shared –enable-static –disable-asm

make && make install

Reference:

https://github.com/lengstrom/fast-style-transfer

https://my.oschina.net/michaelyuanyuan/blog/68616

https://github.com/Zulko/moviepy/issues/696

    原文作者:k1ic
    原文地址: https://www.jianshu.com/p/f81f7569fe5a
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞