MAC chainer-fast-neuralstyle 实时风格转换


寒老师:"Neural style有点烂大街了,大家试试实时风格转化吧"
恩,笔者再试一试...
1.Paper
Paper出处:http://arxiv.org/abs/1603.08155

2.下载代码和风格模型
git clone --recursive https://github.com/yusuketomot ... style
git clone --recursive https://github.com/gafr/chaine ... odels #其他友人训练更多 style model,将model拷到chainer-fast-neuralstyle里面

3.安装依赖
cd chainer-fast-neuralstyle
sudo pip install chainer

4.下载model和training data (不想训练model的同学可忽略此步骤)
下载VGG_ILSVRC_16_layers.caffemodel
sh setup_model.sh
http://mscoco.org/dataset/#download #可以下载训练图片 http://msvocds.blob.core.windo ... 4.zip #文件大小12.6个G

5.训练(不想训练model的同学可忽略此步骤,笔者也没有生成自己的style model)
python train.py -s <style_image_path> -d <training_dataset_path> -g <use_gpu ? gpu_id : -1>
python train.py -s yourStyle.jpg -d ./train2014 -g 0 #应该是这样的,没尝试过

6.生成风格图

input.jpg:输入图片; ModelName.model:自己选择model3; output.jpg:输出的图片

python generate.py sample_images/input.jpg -m models/ModelName.model -o sample_images/output.jpg

10.效果
以下是12个model生成的样例
july1.jpg july12.jpg july2.jpg july3.jpg july5.jpg july4.jpg july9.jpg july11.jpg july10.jpg july7.jpg july8.jpg july6.jpg
已邀请:

微信用户315480

赞同来自:


运行会报如下错误。。。求大神解决
Traceback (most recent call last):
File "/Users/mac/Desktop/chainer-fast-neuralstyle-master/generate.py", line 45, in <module>
y = model(x)
File "/Users/mac/Desktop/chainer-fast-neuralstyle-master/net.py", line 55, in __call__
h = self.b1(F.elu(self.c1(x)), test=test)
File "/usr/local/lib/python3.6/site-packages/chainer/links/normalization/batch_normalization.py", line 117, in __call__
kwargs, test='test argument is not supported anymore. '
File "/usr/local/lib/python3.6/site-packages/chainer/utils/argument.py", line 4, in check_unexpected_kwargs
raise ValueError(message)
ValueError: test argument is not supported anymore. Use chainer.using_config

要回复问题请先登录注册