Learn how GANs work, what they’re used for, and explore examples in this beginner-friendly guide.
A machine learning model is a file that recognizes patterns in information. These models are trained on a set of data and guided by instructions called a machine learning algorithm. Machine learning models can be used to automate repetitive decision-making processes, sort information, create new data samples, and make predictions.
For example, suppose you want to train a home security camera to recognize certain people. You could provide the model with a training dataset consisting of pictures of your family, labeling them as non-threatening. A machine learning algorithm can instruct the camera to withhold security alerts when it detects anyone in the non-threatening data set. Now, instead of receiving security alerts for every movement detected, you’ll only receive security alerts for motion detection caused by people outside your family.
GAN stands for Generative Adversarial Network.
It’s a type of machine learning model called a neural network, specially designed to imitate the structure and function of a human brain. For this reason, neural networks in machine learning are sometimes referred to as artificial neural networks (ANNs). This technology is the basis of deep learning, a subcategory of machine learning (ML) capable of recognizing complex patterns in varying data types such as images, sounds, and text.
Learn more about real-world applications of GANs in this lecture from DeepLearning.AI's Generative Adversarial Networks (GANs) Specialization:
Neurons in your brain are cells that use chemicals and electrical signals to send information between different parts of your brain and body. Neurons in machine learning models are modules of software that send information and computations to one another.
Read more: What Is an Artificial Neural Network?
Generative models can generate new data samples by interpreting how data is placed in addition to what the data represents. In contrast, discriminative models focus on differentiating between existing data samples.
Generative models are made up of two types of neural networks:
1. Generator. Generators are convolutional neural networks (CNN), a type of deep learning algorithm that can process an input image, differentiate between the objects within it, and assign importance to each one. These degrees of importance are known as weights. A generator network aims to create outputs that could be mistaken for real data.
2. Discriminator. Discriminators are deconvolutional neural networks (DNN). These algorithms work in reverse to CNNs, aiming to identify the features of an input that were either missed by the CNN or convoluted with other signals. A discriminator network aims to identify which received output is artificial.
In the context of GANs, adversarial describes the training environment for each neural network (DNN and CNN).
During training, the generator and discriminator networks compete with one another in a bluffing game. The generator creates artificial data samples, such as fake images, to trick the discriminator into accepting them as authentic. In response, the discriminator attempts to identify which data samples are real images and which are not. They practice this game over and over, each one improving at their role each time.
Suppose you provided this line of characters to a discriminative model and a generative model:
^ ⌄ ^ ⌄ ^ ⌄
A generative model can predict how likely it is for a downward arrow to appear next in line. A discriminative model can decide which symbols are upward-facing and which are downward-facing. While the generative model also recognizes which arrows are facing in which direction, it takes its analysis further by assigning a probability to a sequence of symbols. Discriminative models instead focus on how likely the labels “upward” and “downward” are to apply to each symbol.
Researchers are still identifying new use cases for GANs and improving upon existing GAN techniques. Here are a couple of examples of different types of GANs:
CycleGAN. Cycle generative adversarial networks focus on image-to-image translations. The training dataset consists of two unpaired sets of data or groups of images with no labels or correspondences. The CycleGAN uses this information to learn how to transform images from one set into images that could pass for belonging to the other set. For example, suppose you provided a CycleGAN with two sets of images: one depicting house cats and one depicting tigers. The output might look like a realistic image of a house cat with tiger stripes. Or, the inverse might depict a house-cat-sized tiger.
Super-resolution GANs. SRGANs are trained to increase image resolution by filling details into blurry areas of an image. They accomplish this using perceptual loss function, a technique that measures the difference between the high-level perceptual features of two images. This technique allows for a low-resolution image to be upscaled to a high-resolution image.
Advantages of GANs | Disadvantages of GANs |
---|---|
GANs are considered unsupervised learning models, continuing to train themselves after the initial input and capable of learning from unlabeled data. | They can be difficult to train due to the need for large, varied, and advanced data sets. |
GANs are capable of identifying anomalies based on measurements that indicate how well the generator and discriminator are able to model the data. | It can be challenging to evaluate results depending on the complexity of a given task. |
Ability to create realistic data samples | GANs suffer from mode collapse, or learning to produce only one output due to its high plausibility and ability to trick the discriminator. |
If you’re new to machine learning, consider getting started with a beginner-friendly online course.
You can learn to build and train machine learning models in just two months with the Machine Learning Specialization offered by Stanford University and DeepLearning.AI.
If you’re already familiar with machine learning models and want to learn more about GANs, you might prefer an intermediate-level program like the Generative Adversarial Networks (GANs) Specialization offered by DeepLearning.AI. You’ll build a better understanding of GAN components, compare generative models, and build your own basic GANs using PyTorch.
Writer
Jessica is a technical writer who specializes in computer science and information technology. Equipp...
This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.