How do machine learning GANs work?
GAN stands for generative adversarial network; a machine-learning model widely used in image and video generation.
GANs (generative adversarial networks) are clever machine learning (ML) algorithms that use neural networks (simplified computer models of the brain) in a specific way.
We call them ‘generative’ because once they have been trained on a dataset, they can generate new examples that resemble what they’ve seen. Train a generative ML algorithm on a dataset comprising millions of photos of faces and it will be able to generate new photorealistic faces.
Many ML algorithms need supervision, like teaching a student in a classroom. We must tell them what the data represents, and tell them if they get the answer right or not. GANs don’t need supervision – they teach themselves.
This kind of unsupervised machine learning is achieved because a GAN has a split personality. It uses two neural networks to compete against each other (hence the name ‘adversarial’). While one neural network looks at the training data and then tries to generate something new, the other neural network tries to discriminate between this output and the training dataset.
The first network is rewarded every time it fools the second one. The second one is rewarded every time it is not fooled. Both networks are improved, by repetition, with the aim of maximising those rewards. The resulting internal arms race causes the first network to become extremely good at generating outputs that are indistinguishable from the training set.
More like this
When we give a GAN additional information (such as ‘this image is a painting by Pollock’ or ‘this photo is shot at night’) or we augment its data by messing with it (‘here’s the image rotated 75˚’, ‘here’s the image zoomed in’) then it can do remarkable things. GANs can generate higher-resolution versions of images, or convert one into another style – or even convert day to night, or summer to winter in an image.
- Can computers learn like humans?
- What is artificial intelligence?
- How often should I reboot my computer?
- How can smart tech tackle climate change?
Asked by: Dave Holroyd, Birmingham
To submit your questions email us at firstname.lastname@example.org (don't forget to include your name and location)