November 16, 2019 Last updated November 16th, 2019 84 Reads share

What are Generative Adversarial Networks (and Why you Should Care)

What are Generative Adversarial NetworksImage Credit:

It’s amazing that it only takes a team of Python developers and some of its standard libraries to create one of the most impressive technologies around. We are talking about Generative Adversarial Networks (GAN), of course, and if you don’t know what that means or haven’t heard about them as of now, don’t worry.

That’s because GANs are a fairly new invention. Introduced in theory by a team of researchers at the University of Montreal in 2014, it was referred to as “the most interesting idea in the last 10 years in machine learning.” That, naturally, is saying a lot, especially because machine learning in particular and artificial intelligence, in general, are fostering some revolutionary changes across a lot of fields and industries.

So what makes GANs so appealing? Why are people talking about it as one of the technologies with the greatest potential? And how can it be that it only takes a small team of Python development services to come up with such a network? Let’s review some of the basics and see why you should care about GANs.

What is GAN?

It’d be great to have a clear and simple definition you could understand right away. But to truly grasp the power of GANs, you need to know about some key concepts first. So, let’s see a GAN definition and then explain what it all means.

A GAN is a way to approach generative modeling using deep learning methods, especially convolutional neural networks.

That sounds lovely but – what is generative modeling? It is a specific task used in machine learning that involves the identification of patterns in large data series and a learning process that stems from it. In that way, a system tasked with generative modeling will take a look at input data to detect certain regularities and learn how to produce it by itself.

The idea is that the system learns the patterns in such fine detail that is then capable of creating patterns on its own that can’t be easily discerned from the “real” patterns.

Now that we got that out of the way, it’s time to take a look into what’s a convolution neural network (CNN). Without getting too much into it, it’s enough for us to say that a CNN is a class of deep neural network that has been frequently applied to visual imagery.

Finally, you might have another doubt: why the adversarial in GAN’s name? That’s mainly related to the architecture of the networks. A GAN is usually comprised of two nets that are pitted against each other as if they were adversaries. We’ll see why this happens below, so don’t worry about it now.

So, by combining those definitions, you should start to see what a GAN is in a clearer way. It basically is a different way of identifying patterns from data sets to be able to replicate them so they can look like the real thing. Since convolution neural networks are so advanced, most works with GANs use them to generate image-related applications.

How does GAN work?

Though the complex algorithms that Python development teams base their GANs on are really something, their novel approach to generative model is what makes this technology so interesting. That’s because the interrelation between the two neural networks of a GAN is deceptively simple, even when being the result of complicated work.

Here’s how a GAN works. One of its neural networks is called the generator. That’s because it’s capable of creating new data from a real data set that serves as its input. In other words, this is the part of the system that identifies patterns to learn how to craft them.

The generator’s “adversary” is another neural network, called the discriminator. This is the part that’s responsible for analyzing data that comes from the generator to determine whether it’s genuine or fake.

Maybe an example can help you better understand the underlying mechanism of a GAN. Let’s say that the generator is fed with passport photos and tasked with the generation of new ones depending on the patterns it finds there. Thus, the generator will analyze the whole dataset to find what defines those photos. It will certainly look at the eyes, the noses, the hairstyles, the mouths, and so on. After that, it will try to assemble new photos.

Those photos are then sent to the discriminator, whose job is to flag the fake ones and let the real ones through. The overall goal of the system is pretty straightforward. The generator will try to refine its fake creations to fool the discriminator, while the discriminator will try to become increasingly better at spotting the fakes—even when the telling signs are extremely subtle.

The GAN becomes more sophisticated the more this process goes on. That’s because the discriminator is in a feedback loop with real images (or data) while the generator is in a feedback loop with the discriminator. This last thing is key for the generator, as the neural network analyzes the fake images to define why they couldn’t pass as real photos (or data).

Why should you care about GANs?

So far, you might believe that GANs is a sophisticated and complex toy with which data researchers and Python development outsourcing teams play around. However, there are several uses in which GANs can benefit you and even some uses that are controversial enough for you to take this technology seriously.

Take what the fashion industry is doing with GANs. Maybe the name Lil Miquela rings a bell, maybe not. A quick Google search might lead you to learn that she is an Instagram influencer. However, there’s something distinctive about her—she was made through a GAN. Though the first of her kind, digital supermodels are becoming a thing now, which allows fashion brands to “craft” people through a GAN that closely resembles their target audience tastes.

This reduces the costs of hiring supermodels while also providing the possibilities for brands to come up with all sorts of campaigns without the need for lengthy photoshoots.

The video games industry, for its part, is using GANs to improve old games and make them look sharper, renewed and with higher quality. Titles like Final Fantasy IX, Resident Evil REmake HD Remaster, and Max Payne are all great examples of a GAN at work.

There are a lot of other uses. GANs have been used to demonstrate the impact of climate change on specific houses or neighborhoods. They have also been the basis for the generation of new molecules for protein targets. GANs are also useful for improving astronomical images. In the future, they could also be used to create better facial composites of criminals and missing people or to augment street art imagery.

There are, however, some uses that are raising concern among specialists. The main one: deepfakes. Perhaps you’ve heard about this. Under that name hides a disturbing use of GANs, where the system is used to create fake pornography or fake videos that can serve as the base for fake news. This is very troubling as the results can look very real for human eyes. So, the fake material can be used to harm a person’s reputation or to incriminate them in certain crimes.

Naturally, GANs can also be used to counter the rise of these malicious applications. By using known deep fakes and feeding them to a discriminator, we can have more sophisticated systems capable of aiding us in the prevention of fake video and image distribution.

Some final thoughts

GANs are just another example of the power and potential found in machine learning and artificial intelligence. These neural networks can come up with realistic images and can be used to upsample the quality of older images for a variety of purposes. As mentioned, several industries are already using GANs to come up with new products, and marketing techniques.

Only time will tell how much of the perceived potential of GANs will finally come to fruition. Yet, we have to remain vigilant of its development, as GANs can also be used for malicious purposes that can fool people that don’t even know about the existence of this technology. Fortunately, we can use GANs themselves to police the results and the content that’s going around.

Finally, you should keep paying attention to this technology, as it can go beyond the image world into other realms. Of course, we’re getting ahead of ourselves but that’s because it is hard not to. With technology as exciting as generative adversarial networks, it’s impossible to not imagine the years to come.

Santiago Alonso

Santiago Alonso

Read Full Bio