星期四, 九月 29, 2016

艺术风格的神经网络算法实验

2015年九月的时候出现了一篇很趣的论文《A Neural Algorithm of Artistic Style》。论文中提出了一种算法,可以将一张普通的图片,转换成具有某种艺术家的风格。

用语言来描述计算流程如下:
1、首先用一个给定参数的卷积神经网络(VGG网络),将原始的内容图片和风格图片进行函数映射,这个任务不需要网络后面的全连接层,只需要中间一些卷积层的输出即可,而且将网络中的max_pool改成了avg_pool。
2、可以利用这些中间输出,将其定义为内容输出和风格输出。内容输出是网络中较上层的映射结果,而风格输出是一些较低层映射的相关矩阵,用一个Gram矩阵计算表示。
3、将内容图片加噪音,这个将做为网络的输入,将网络的输出和内容输出进行对比,计算出内容损失函数(像素值取差值,再平方和),和风格输出进行对比,计算出风格损失函数,再整合两个损失形成总损失。
4、训练目标是总损失最小化,训练参数是第3步中的输入图片,这样得到一个图片,使内容和原来的内容图片相似,而风格和风格图片一致。

内容图片如下:

风格图片如下:

初始的输入是一个内容图片加噪音:

最后结果图片如下:

参考资料:
http://arxiv.org/pdf/1508.06576v2.pdf
https://github.com/ckmarkoh/neuralart_tensorflow
具体方法如下面代码所示,

5 条评论:

  1. Listen...

    This might sound a little creepy, maybe even kind of "strange"

    BUT what if you could just hit "PLAY" and LISTEN to a short, "magical tone"...

    And magically attract MORE MONEY to your LIFE?

    And I'm talking about BIG MONEY, even MILLIONS of DOLLARS!

    Do you think it's too EASY? Think this couldn't possibly be for REAL??

    Well then, Let me tell you the news...

    Usually the greatest miracles life has to offer are also the SIMPLEST!

    In fact, I will PROVE it to you by letting you listen to a real-life "magical wealth building tone" I developed...

    And do it FREE (no strings attached).

    YOU just push "PLAY" and the money will start coming into your life. starting almost INSTANTLY.

    CLICK here NOW to enjoy the wonderful "Miracle Wealth Building TONE" - it's my gift to you!

    回复删除
  2. 如果您认为您的配偶在作弊,并且您需要聘请真正的黑客来远程监控/黑客他们的电话,恢复被盗的比特币/任何其他加密货币或在保证隐私的情况下入侵数据库,请联系easybinarysolutions@gmail.com或whatsapp: +1 3478577580,他们高效而机密。

    回复删除