gans有什么用_用gans将真实照片转换成艺术品

gans有什么用

创造力:独特的人类 (Creativity: Uniquely Human)

Art — the ability to create something original, to use one’s unbounded creativity and imagination — it’s something that we humans like to believe is unique to us. After all, no other animal or computer thus far has come close to matching the artistic skill of humans when it comes to realistic paintings.

艺术-创造原创物,运用无限的创造力和想象力的能力-我们人类喜欢相信的东西对我们来说是独一无二的。 毕竟,在写实绘画方面,到目前为止,还没有其他动物或计算机能够与人类的艺术技能相提并论。

Image for post
Source 资源

Even with the recent advances in AI, computers still struggled with being creative. They were good at computing, classifying, and performing programmed tasks, but they could never really match the level of creativity humans had. Human creativity was assuredly unique and one of its kind… That is until generative adversarial networks were conceived. In 2014, the original paper on GANs proposed a new system of estimating generative models — models which could create— using two models.

即使AI有了最近的进步,计算机仍在努力发挥创造力。 他们擅长计算,分类和执行编程的任务,但是它们永远无法真正达到人类的创造力水平。 人类的创造力肯定是独特的,并且是人类创造力的一种。直到创造出对抗性的对抗网络。 2014年,有关GAN的原始论文提出了一种使用两个模型估算生成模型(可以创建的模型)的新系统。

猫与老鼠的永恒游戏 (An Eternal Game of Cat and Mouse)

A GAN consists of two models, a generative model G and a discriminative model D as well as a real data set. You can think of G as a counterfeiter, trying to make money that is more and more like real money and D as a cop, trying to differentiate whether the money is real or counterfeit. The real data set acts as a reference for the cop to compare with the output of the counterfeiter.

GAN包含两个模型:生成模型G和判别模型D以及真实数据集。 您可以将G视为伪造商 ,试图赚钱的钱越来越像真钱,而将D当作警察 ,试图区分钱是真钱还是伪造。 真实数据集用作警察与假冒者的输出进行比较的参考。

Image for post
Source 资源

In the beginning, the counterfeiter is going to suck, because he has no idea how to actually make the money look like real money, but after every instance of the cop determining the fake money, he gets better and learns from his mistakes. Keep in mind too, the discriminator is also getting incrementally better at differentiating real and fake currency — he’s becoming a better cop. This cycle continues over and over until the generator is so good at creating data that looks like the training data even the discriminator can’t tell.

刚开始时,造假者会很烂,因为他不知道如何使钱看起来像真钱,但是在每次警察确定假钱后,他都会变得更好,并从错误中吸取教训。 还要记住,鉴别者在区分真实货币和假货币方面也越来越好-他正在成为一个更好的警察。 这个循环不断重复,直到生成器非常擅长创建看起来像训练数据的数据,甚至辨别器也无法分辨。

使用循环GAN进行图像-图像转换 (Image-Image Translation with Cycle GANs)

The classic GAN architecture is good when it comes to creating new, similar-looking data but it doesn’t work so well when trying to alter an existing image. Moreover, traditional approaches to image-image translation required datasets with paired examples.

在创建外观相似的新数据时,经典的GAN架构非常有用,但是在尝试更改现有图像时,效果并不理想。 此外,用于图像-图像翻译的传统方法需要具有成对示例的数据集。

Image for post
Source 资源

These paired examples are data points that are directly related — they show the original image and the desired modification to it. For instance, the training dataset would need to contain the same landscape during winter and summer. However, these datasets are challenging and difficult to prepare — sometimes even impossible, as is the case with art. There just is no photographic equivalent of the Mona Lisa or other great artworks.

这些成对的示例是直接相关的数据点-它们显示了原始图像及其所需的修改。 例如,训练数据集在冬季和夏季必须包含相同的景观。 但是,这些数据集具有挑战性且难以准备-有时甚至是不可能的,就像艺术一样。 莫娜·丽莎(Mona Lisa)或其他伟大的艺术品在摄影上没有什么可比的。

To combat this, we use a Cycle GAN. This is a special type of generative adversarial network that has an extension to the GAN architecture: cycle consistency. This is the notion that an image output by the first generator could be used as the input to a second generator and the output of the second generator should match the original image — undoing what the first generator did to the original image.

为了解决这个问题,我们使用Cycle GAN。 这是一种生成对抗网络的特殊类型,它是GAN体系结构的扩展: 循环一致性 。 这是第一个生成器输出的图像可用作第二个生成器的输入,而第二个生成器的输出应与原始图像匹配的概念-撤消第一个生成器对原始图像所做的操作。

Image for post
Source 资源

Think about it like this: You’re using Google Translate to translate something from English to Spanish. You then open a new tab and copy-paste the Spanish back into Google Translate, where it translates it to English. At the end of all t his, you would expect the original sentence again. This is the principle of a Cycle GAN, and it acts as an additional loss to measure the difference between the generated output of the second generator and the original image, without the need for paired examples.

这样思考:您正在使用Google翻译将某些内容从英语翻译为西班牙语。 然后,您打开一个新标签,然后将西班牙语复制粘贴回Google Translate,然后将其翻译为英语。 最后,您将再次期待原始句子。 这是Cycle GAN的原理,它是额外的损耗,可用于测量第二个生成器的输出与原始图像之间的差异, 无需配对示例。

用于样式转换的Cycle GAN架构 (The Cycle GAN Architecture for Style Transfer)

Here’s how the Cycle GAN would work if our model was training to create images in the style of French artist Cézanne’s.

如果我们的模型正在接受法国艺术家塞尚(Cézanne's)风格的图像训练,则这就是Cycle GAN的工作原理。

数据集 (Datasets)

  • Dataset 1: Real photos

    数据集1 :真实照片

  • Dataset 2: Artworks by Cézanne

    数据集2 :塞尚的作品

生成对抗网络 (Generative Adversarial Networks)

  • GAN 1: Translates real photos (dataset 1) into artworks in the style of Cézanne (dataset 2)

    GAN 1 :将真实照片(数据集1)转换为塞尚风格(数据集2)的艺术品

  • GAN 2: Translates artworks in the style of Cézanne (dataset 2) into real photos (dataset 1)

    GAN 2 :将塞尚风格的艺术品(数据集2)转换为真实照片(数据集1)

正向循环一致性损失 (Forward Cycle Consistency Loss)

  • Input real photo (collection 1) to GAN 1

    将真实照片(集合1)输入到GAN 1
  • Output photo of Cézanne-styled artwork from GAN 1

    GAN 1中塞尚风格的艺术品的输出照片
  • Input photo of Cézanne-styled artwork generated by GAN 1 to GAN 2

    GAN 1到GAN 2生成的塞尚风格艺术品的输入照片
  • Output real photo from GAN 2

    从GAN 2输出真实照片
  • Compare real photo (collection 1) to real photo outputted from GAN 2 using discriminator

    使用鉴别器将真实照片(集合1)与从GAN 2输出的真实照片进行比较

向后循环一致性损失 (Backward Cycle Consistency Loss)

  • Input photo of Cézanne artwork (collection 2) to GAN 2

    将塞尚艺术品(收藏2)的照片输入到GAN 2
  • Output real photo from GAN 2

    从GAN 2输出真实照片
  • Input real photo generated by GAN 2 to GAN 1

    将GAN 2生成的真实照片输入GAN 1
  • Output Cézanne-styled artwork from GAN 1

    从GAN 1输出塞尚风格的艺术品
  • Compare original Cézanne artwork (collection 2) to Cézanne-styled artwork from GAN 1 using discriminator

    使用判别器将塞尚的原始艺术品(集合2)与GAN 1中的塞尚风格的艺术品进行比较

By minimizing these two losses, our model will eventually learn how to transform real photos into artworks in the style of Cézanne — and since we have not just one but two GANs, we can also turn original artworks from Cézanne into real photos. If we wanted our model to transform our photos into another artist’s style, we would simply need to replace the Cézanne artworks in dataset 2 to artworks from another artist, say Van Gogh or Picasso.

通过最大程度地减少这两个损失,我们的模型最终将学习如何将真实照片转换为塞尚风格的艺术品-由于我们不仅拥有两个GAN,而且还可以将塞尚的原始艺术品变为真实照片。 如果我们希望我们的模型将照片转换成另一位艺术家的风格,我们只需要将数据集2中的塞尚作品替换为另一位艺术家的作品,例如梵高或毕加索。

Really — what we’re capable of doing with GANs is just nuts. I mean even for a human, it is quite a daunting task to try and imitate an artist’s style given a photo for inspiration. Some people dedicate their entire lives to this work, yet for a GAN, they can apply any trained style to any picture in minutes. Nuts!

真的-我们是能够与甘斯做的仅仅是坚果 。 我的意思是,即使对于人类来说,尝试模仿一张照片中的艺术家的风格也是一项艰巨的任务。 有些人毕生致力于这项工作,但对于GAN,他们可以在几分钟内将任何训练有素的样式应用于任何图片。 坚果!

结果 (The Results)

Image for post
Source 资源

创意计算的未来 (The Future of Creative Computing)

Although calling them masterpieces might be a stretch, there’s no doubt that artificial intelligence is quickly catching up to humans in terms of something we thought was once secure — artistic talent and creativity. I only explained one application of GANs which I find personally to be fascinating, but GANs are now being used in a myriad of ways, from generating realistic faces to increasing the quality of images — and at the heart of it all, just a game between a con and a cop.

尽管称它们为杰作可能有些费劲,但毫无疑问,人工智能正在Swift地赶上人类,这是我们曾经认为很安全的东西-艺术才华和创造力。 我只是解释了我个人认为很有趣的GAN应用程序,但是GAN现在以各种各样的方式使用,从生成逼真的面Kong到提高图像质量,而从根本上讲,这只是一场博弈骗局和警察。

Hey! Thanks for making it to the end! I’m Freeman, an Innovator at TKS (The Knowledge Society) and I’m super passionate about breaking down and solving the world’s biggest problems.

嘿! 感谢您的努力! 我是Freeman,TKS(知识社会)的创新者,我非常热衷于分解并解决世界上最大的问题。

LinkedIn: https://www.linkedin.com/in/freeman-jiang-50b325190/

领英https : //www.linkedin.com/in/freeman-jiang-50b325190/

Email: freeman.jiang.ca@gmail.com

电子邮件: freeman.jiang.ca@gmail.com

Website: freemanjiang.com

网站: freemanjiang.com

翻译自: https://towardsdatascience.com/transforming-real-photos-into-master-artworks-with-gans-7b859a43e6ea

gans有什么用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值