赞
踩
大家好,我是WintoMT。前些天在家看论文发现一篇好玩的论文,名为《Stylized Neural Painting》,文章介绍了一种算法,该算法不仅可以根据给定的图片用油画笔、水彩笔和记号笔画画,还可以根据颜色和纹理进行风格迁移。本文将围绕这篇论文简单介绍一下其创作思路,并在结尾处教大家利用作者的代码画出属于自己的油画。
1、效果展示
论文提出了一种图像到绘画的翻译方法,这一方法能生成样式可控、生动逼真的绘画作品。与之前用逐像素预测的方法来进行图像与图像的转换不同,作者在向量化的环境中处理这种艺术创作过程,通过产生一系列可实际用于笔画的有意义的笔画参数,从而能做到一笔一画的进行图画生成。
在上图中,作者展示了通过算法生成的一些风格化的绘画。从整体视觉外观和局部纹理保真度的角度来看,原画与生成的画之间具有极高的相似性。同时在(d)中,作者还展示了一些通过我们的方法生成的卡通人物的高度抽象的纸带艺术。你能猜出他们是谁吗?
另外这套算法还可以根据颜色和纹理进行风格迁移。
完整的绘画过程可以看下面的视频:
2、使用教程
这里展示用论文中提到的算法进行油画创作。
下载代码及权重文件
这里给出github地址:https://github.com/jiupinjia/stylized-neural-painting。
当然为了下载方便我们也将代码打包有需要的可以关注微信公众号回复【油画】即可下载。
打开Requirements.txt安装依赖包
绘画
渐进渲染
python demo_prog.py --img_path ./test_images/apple.jpg --canvas_color 'white' --max_m_strokes 500 --max_divide 5 --renderer oilpaintbrush --renderer_checkpoint_dir checkpoints_G_oilpaintbrush --net_G zou-fusion-net
使用轻量级渲染器进行渐进式渲染(使用更低的GPU内存消耗和更快的速度)
python demo_prog.py --img_path ./test_images/apple.jpg --canvas_color 'white' --max_m_strokes 500 --max_divide 5 --renderer oilpaintbrush --renderer_checkpoint_dir checkpoints_G_oilpaintbrush_light --net_G zou-fusion-net-light
直接从mxm图像网格渲染
python demo.py --img_path ./test_images/apple.jpg --canvas_color 'white' --max_m_strokes 500 --m_grid 5 --renderer oilpaintbrush --renderer_checkpoint_dir checkpoints_G_oilpaintbrush --net_G zou-fusion-net
这里对里面参数进行解释:
img_path:要输入的图片路径
canvas_color:画板背景颜色
max_m_strokes:笔画大小
max_divide:作品最后的精细程度
renderer:作品风格,可选参数有watercolor、markerpen、oilpaintbrush、rectangle。
renderer_checkpoint_dir:权重文件的路径
重新训练
当然还可以选择画笔类型并从头开始训练笔划渲染器。唯一要做的是运行以下通用命令。在训练期间,地面真相笔画是即时生成的,因此您无需下载任何外部数据集。
python train_imitator.py --renderer oilpaintbrush --net_G zou-fusion-net --checkpoint_dir ./checkpoints_G --vis_dir val_out --max_num_epochs 400 --lr 2e-4 --batch_size 64
3、参考链接
https://github.com/jiupinjia/stylized-neural-painting
https://arxiv.org/abs/2011.08114
https://jiupinjia.github.io/neuralpainter/
https://blog.csdn.net/csdnsevenn/article/details/110211295?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.control&dist_request_id=ca8b49cf-7df8-4156-bd28-e81a3d16f3ef&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.control
欢迎关注我们的微信公众号ChallengeHub,第一时间掌握竞赛信息!!!!
想和各位大佬一起学习可以扫描下方二维码添加群管理员加入ChallengeHub粉丝群。
也欢迎各位加入我们qq群一起讨论学习。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。