TensorFlow技术帖

fast-style-transfer 初探

2019-01-15  本文已影响1人  k1ic

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

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 &

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使用情况

nvidia-smi

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

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

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 &

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 &

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

三、渲染视频

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使用情况

渲染结果

四、错误处理

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

2.缺libx264编码库

安装之:

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

上一篇 下一篇

猜你喜欢

热点阅读