Learn how GANs work and what they’re used for, and explore examples in this beginner-friendly guide.
![[Featured Image] A machine learning engineer in a gray shirt sits with their back to their desk and speaks with co-workers.](https://d3njjcbhbojbot.cloudfront.net/api/utilities/v1/imageproxy/https://images.ctfassets.net/wp1lcwdav1p1/4hu4tGtTUtCi0LPME4qND4/a0c4d0fb477ce7e346e4af19cae2ecd7/1P2A9692.jpeg?w=1500&h=680&q=60&fit=fill&f=faces&fm=jpg&fl=progressive&auto=format%2Ccompress&dpr=1&w=1000)
A generative adversarial network (GAN) is a type of machine learning model designed to imitate the structure and function of a human brain.
Two types of neural networks, generators and discriminators, make up a generative model.
Three advantages of GANs include learning from unlabeled data, identifying anomalies in the modeled data, and creating realistic data samples.
You can think of an artificial neural network (ANN) as a structure designed to imitate the functions of a human brain.
Learn more about GANs, including how generative models function, types of GAN models, and the pros and cons of this technology. If you’re ready to enhance your skill set in this field, enroll in the Deep Learning Specialization offered by DeepLearning.AI. In as little as three months, you can learn about artificial neural networks, PyTorch, computer vision, performance tuning, and more.
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 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: 10 Machine Learning Algorithms to Know
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 data set 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 in details to 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. |
| GANs have the ability to create realistic data samples. | GANs suffer from mode collapse, or learning to produce only one output due to their high plausibility and ability to trick the discriminator. |
Subscribe to our weekly LinkedIn newsletter, Career Chat, for industry updates, tips, and trends. Then, explore free machine learning resources to optimize your professional growth:
Watch on YouTube: Machine Learning in Real Life: From Spotify to Healthcare
Earn a credential: 6 Machine Learning Certificates + How to Choose the Right One for You
Explore a path: Machine Learning Career Paths: Explore Roles & Specializations
Whether you want to develop a new skill, get comfortable with an in-demand technology, or advance your abilities, keep growing with a Coursera Plus subscription. You’ll get access to over 10,000 flexible courses.
SEO Content Manager I
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.