生成对抗网络训练_生成对抗网络

本文深入探讨了生成对抗网络(GANs)的训练过程,解释了其基本原理和工作方式,包括如何通过Python和Java实现机器学习与神经网络的结合,以进行高效的深度学习应用。
摘要由CSDN通过智能技术生成

生成对抗网络训练

Let us assume Sergio is planning his next big heist and he needs his team to travel to a foreign country. Owing to the nature of his job he has decided to generate fake passports. He doesn’t want to take any chances because he believes that the passport officer can discriminate between original and fake passports. He has decided to use his network of designers and experts to carry out his plans effectively.

让我们假设塞尔吉奥正在计划他的下一次大劫案,他需要他的团队前往国外。 由于工作性质,他决定生产假护照。 他不想冒险,因为他认为护照人员可以区分原始护照和伪造护照。 他决定利用自己的设计师和专家网络有效地执行他的计划。

Generative Adversarial Networks have two components a generator and a discriminator. Just take my words as of now :)Let's get back to Sergio's plan and problems.

塞尔吉奥护照生成器 (Sergio’s Passport Generator)

The diagram below represents Sergio’s plan of action in which a fake passport is generated by using the combined skills of the professionals.

下图显示了塞尔吉奥的行动计划,其中利用专业人员的综合技能生产了假护照。

Image for post
ML-Visuals). ML-Visuals绘制的图像 )。

If we were to generalise Sergio’s plan we can say, the diagram is a generator of fake passports. A network of professionals who essentially know the security features of a passports try to recreate a similar one by using their knowledge. In other words given a space the goal is to draw an example which resembles the original space.

如果我们概括一下塞尔吉奥的计划,可以说,该图是伪造护照的产生者。 本质上了解护照安全特性的专业人士网络试图利用他们的知识来重建相似的护照。 换句话说,给定一个空间,目标是绘制一个类似于原始空间的示例。

This is precisely what the generator component of a GAN does. It feeds upon the real world examples to observe their features and then create a new example which resembles the original examples.

这正是GAN的生成器组件所做的。 它以现实世界中的示例为例,观察它们的功能,然后创建一个类似于原始示例的新示例。

护照主任作为鉴别人员 (Passport Officer as Discriminator)

The following diagram represents the workflow of a passport officer. He checks hundreds of passports daily and Sergio wants his generated passports to be identified as the real ones.

下图显示了护照工作人员的工作流程。 他每天检查数百本护照,而塞尔吉奥(Sergio)希望将其生成的护照识别为真实护照。

Image for post
ML-Visuals). ML-Visuals拍摄的图像 )。

The passport officer resembles to the second component of GAN called as the discriminator. The job of the discriminator is classification. It identifies the real instances of data from the fake or generated instances of data.

护照人员类似于GAN的第二部分,称为鉴别器鉴别器的工作是分类。 它从伪造或生成的数据实例中识别数据的真实实例。

Under the given circumstances of counterfeiting, Sergio and the passport officer are competing against each other. Sergio wants his generated passports to be categorised as real ones, while the passport officer wants to do a good job of detecting fake passports. This makes them adversaries, hence the name adversarial network.

在伪造的特定情况下,塞尔吉奥和护照人员将相互竞争。 塞尔吉奥(Sergio)希望将其生成的护照归类为真实护照,而护照官员则希望能很好地发现假护照。 这使他们成为对手,因此命名为对抗网络

Now that we understand about the two components of a GAN let’s see how to train them to obtain a GAN.

现在,我们了解了GAN的两个组成部分,让我们看看如何训练它们以获得GAN。

把它放在一起 (Putting it Together)

鉴别训练 (Discriminator Training)

A discriminator is simply a classifier in case of a GAN which labels a given instance as either real or fake. You can use any neural network which suits your problem statement.

如果GAN将给定实例标记为真或假,则鉴别器只是分类器。 您可以使用任何适合您的问题陈述的神经网络。

When a discriminator is trained it is fed with examples from real world as positive instances and examples generated from the generator network as negative instances. While training a discriminator the generator is not trained which is to say that its weights are not changed. Simply, the generator’s output is fed to the discriminator as negative instances. If the discriminator then classifies a negative instance as positive or vice-versa it is penalised by the loss function and its weights are updated through backpropagation.

训练鉴别器时,会将来自现实世界的示例作为正面实例,并从生成器网络生成的示例作为负面实例。 在训练鉴别器时,不训练发电机,这就是说其权重没有改变。 简单来说,生成器的输出作为否定实例被馈送到鉴别器。 如果判别器然后将否定实例分类为肯定实例,反之亦然,则损失函数会对其进行惩罚,并通过反向传播更新其权重。

Image for post
ML-Visuals). ML-Visuals拍摄的图像 )。

发电机培训 (Generator Training)

We have already seen that the job of the generator is to output new data instances. Generator is simply nothing but a neural network. However, neural networks have inputs. In case of generators noise is fed to them as input and eventually it learns to generate perceptible data. For any generated image the generator is penalized if the discriminator classifies it as fake. Only the weights of generator are updated while training it.

我们已经看到生成器的工作是输出新的数据实例。 生成器只是神经网络而已。 但是,神经网络具有输入。 在发电机的情况下,噪声作为输入被馈送到发电机,并最终学会生成可感知的数据。 对于任何生成的图像,如果鉴别器将其分类为伪造,则生成器将受到处罚。 训练时仅更新发生器的权重。

Image for post
ML-Visuals). ML-Visuals拍摄的图像 )。

In practice, an iterative approach is used to train a GAN in which you switch between training the generator for one iteration and then training the discriminator for the next iteration.

在实践中,使用迭代方法来训练GAN,您可以在训练GAN的过程中进行一次迭代,然后再对鉴别器进行下一次迭代。

翻译自: https://towardsdatascience.com/generative-adversarial-network-74eef7a82117

生成对抗网络训练

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值