图像生成对抗生成网络gan
Hello there! This is my story of making a GAN that would generate images of cars, with PyTorch.
你好! 这是我用PyTorch制作可生成汽车图像的GAN的故事。
First of all, let me tell you what a GAN is — at least to what I understand what it is.
首先,让我告诉您GAN是什么-至少据我了解是什么。
A Generative Adversarial Network(GAN) is a network we use to generate something(image, sound… anything), What we challenge here is the ability of the machine to imagine something. (For the paragraph below know that a GAN has two networks: A Generator and a Discriminator.)
生成对抗网络(GAN)是我们用来生成事物(图像,声音……任何事物)的网络。我们在这里面临的挑战是机器想象事物的能力。 (对于下面的段落,知道GAN有两个网络:生成器和鉴别器。)
How do we make a machine imagine something?
我们如何使机器想象某些东西?
Let’s say we’re trying to make the machine imagine some form of data, just as usual, we’ll start with it(our generator) imagining random noise — data that doesn’t make any sense at all.
假设我们正试图使机器想象某种形式的数据,就像往常一样,我们将从它(我们的生成器)开始想象随机噪声,即完全没有意义的数据。
We then feed it to another network that is trained specifically to distinguish between fake and real data(our discriminator), this network enables us to say how fake the generated data is, knowing which we’ll update the generation process to make it more and more real over training.
然后,我们将其提供给另一个经过专门训练的网络,以区分假数据和真实数据(我们的鉴别器),该网络使我们能够说出所生成数据的伪造程度,知道我们将更新生成过程以使其更多,并在训练上更加真实。
Also note that we’ll be training our discriminator at the same time too(of course, we freeze the generator for a second), to distinguish better between real and fake images as our generator gets better.
还要注意,我们也将同时训练鉴别器(当然,我们冻结生成器一秒钟),以便在生成器变得更好时更好地区分真实图像和伪图像。
You can imagine it to be similar to two people playing a game, one person knows a target picture that the other has to draw, and the other just draws pictures, seeing the picture drawn, the first person gives the second some feedback on how close his picture looks to the target, based off which he makes changes and gets better and better towards an ideal picture.
您可以想象它类似于两个人在玩游戏,一个人知道另一个人必须绘制的目标图片,另一个人只是绘制图片,看到了绘制的图片,第一个人给出了第二个关于接近程度的反馈他的图片面向目标,在此基础上他进行了更改,并朝着理想的图片越来越好。
In the simplest terms, thats how it works.(feel free to correct me though)
用最简单的话来说就是这样(尽管可以纠正我)
我们的数据集 (Our Dataset)
I looked through kaggle for images of cars, and the dataset I found most suitable was the Stanford cars dataset.
我通过kaggle浏览了汽车图像