Skip to content

What are GANs and how do they work, those neural networks capable of creating the faces of people that do not exist

27 mayo, 2021

The advances in artificial intelligence they are becoming more and more impressive and at the same time disturbing. At the end of 2018 we told you about a neural network that was generating the faces of people that do not exist and the results were really impressive.

Right now it is easier than ever for an algorithm to create people’s faces that are not real, and what makes this feat possible are the so-called Generative Adversary Networks (GAN), in Spanish “Antagonistic generative networks“Two artificial intelligence systems that can interact with each other to generate something completely new.

OpenAI claims to have developed an algorithm so powerful that it will not release it because of

From identification to creation

Ma18 Iangoodfellow3a

Artificial intelligence has been used for a long time to identify things, a simple example of this is how Google Photos can know which objects and which people appear in your images and even classify them. But from there to creating completely new objects or people, there is a stretch.

For both tasks you have to train the algorithms and show them many things, millions of things. Thanks to machine learning the algorithm can analyze that data and learn from it to make predictions or suggestions.

GANs give machines a kind of sense of imagination to be able to create something new from scratch

But identifying something is not as complicated as creating it, “it is much easier to identify a Monet than to paint one” explains expert Jonathan Hui. GANs are about creating, and this is much more difficult than other fields of machine learning.

Neural networks seek to mimic the functioning of the human brain, but something that they had not been able to imitate until now is the imagination. This is where antagonistic generative networks come in, they give machines a kind of sense of imagination. How? Making two systems compete.

Google has created a free online course to learn about artificial intelligence and machine learning

Two neural networks playing cat and mouse

The main goal of GANs is to generate data from scratch. For this, the GANs use two neural networks and face them against each other. The first network is the “generator” and the second is the “discriminator”.

Both networks were trained with the same data set, but the first one should try to create variations of the data that it has already seen, in the case of the faces of people that do not exist, you must create variations of the faces you have already seen.

The discriminatory network must identify if that face you are seeing is part of the original training or if it is a false face that the generative network created. The more you do it, the better the generative network becomes creating and the discriminating network becomes more difficult to detect if the face is false.

The generating network needs the discriminator to know how to create an imitation so realistic that the second one cannot distinguish from a real image

A generating network alone would create only random noise, the concept is that the discriminating network acts as a guide on which images to create and helps the generative network to learn the aspects that comprise a real image.

The model trains both networks and faces them in stiff competition to improve themselves. Eventually, the discriminator will be able to identify the smallest difference between what is real and what was generated, and the generative network will be able to create images that the discriminator cannot distinguish.

So we end up with examples like those on the web “this person does not exist” (this person does not exist). Or projects like Cycle GAN capable of replicating the style of famous painters, or generate zebras from horses.

A human beats IBM's artificial intelligence in a "debate" very close

They are not perfect, they have great potential and they are also dangerous

Photo2painting CycleGAN

Until now, GANs have been used mainly in images, but also with music, but if you ask our colleague Santi, he never wants to listen to the songs capable of generating the AI ​​until now.

Its potential is enormous, for companies like NVIDIA, these neural networks can help give video games more realism or create 3D modeling applications with great results. But there is many scientific and engineering areas where they could be used to optimize something. GANs that predict how particles would behave, or GANs that generate fake patient records that are as good as the real thing at analyzing how a drug works.

But since there is potential for good, there is one for evil. Do you have a machine designed to create counterfeits, a generator of lies, false news, a perfect tool for political manipulation or defamation.

An example of this is in the ‘Deepfakes’, which range from porn videos starring famous faces, to a video of Obama saying things he never said, or to Steve Buscemi’s face on Jennifer Lawrence’s body. They all have an impressive realism that shows how easy it is today to get someone to say anything, and how difficult it will be for people to distinguish what is real.

This person does not exist The system is not perfect, but it is on the way.

The imagination capacity that GANs have is still limited, in addition to calibrating the duel between the two neural networks can be complicated, if the discriminator can be easily fooled, what the generative network produces will not be realistic.

But, the concept of GANs was born only in 2014 and at the beginning they were barely capable of generating images with a maximum of 1024 pixels. It’s probably a matter of only time, when giants like Google and Facebook are also developing their own algorithms and improving the technique.

Cover image | COGAN