TwiddleLab / Artificial Intelligence / Generative AI: Making New Things
Add Noise, Learn to Undo
What you will learn
- Forward noise buries a picture step by step: noisy = a · clean + b · noise, with a shrinking and b growing.
- Each training pair is a noisy picture plus its step number, and the noise that was added is the answer key.
- A denoiser is trained to predict the noise in a noisy picture, at every noise level.
- The noise itself is random numbers from a bell curve, the normal distribution.
How the lesson goes
Destroying a picture with noise is easy. Could a machine learn to run it backwards?
First, how fast does noise destroy it?
Add noise step by step. Find the first step where the noise part is as big as the clean part.
The formula shows how much of each is in the picture.
Order the pictures from least to most noise.
These were made at steps 0, 150, 300, 600 and 1000.
Each step shrinks the picture a little and adds a little noise, so the outline fades steadily until nothing of the critter is left.
A denoiser learns to guess the noise.
Making training data is free: take any picture, add noise, and you know exactly what you added.
Noisy = clean + noise. Find the noise in each pixel.
Drag a chip under each pixel so the sum matches the noisy value.
Subtracting the clean value from the noisy one gives the noise: 0.5 − 0.2 = 0.3, 0.6 − 0.9 = −0.3, 0.5 − 0.5 = 0, 0.3 − 0 = 0.3. A denoiser has to make this guess without seeing the clean picture.
Teach the denoiser: make training pairs, then train it.
Pick a noise step and press Make pair. When you have 3 or more, press Train.
Math: the noise is random numbers. Draw lots of them and stack them up.
Press Draw 100, then Draw 1000.
One training pair has the wrong step number. Which?
Tap it, then Check.
At step 100 the clean part is still 0.99 of the picture, so the critter is clearly visible. Picture C is almost pure speckle, which takes several hundred steps.
Speed round: read the noise level at a glance.
Tap the step each picture was made at. Get 4 of 5 before the bar runs out.
Previous lesson: GANs: Forger vs Detective · Next lesson: From Pure Noise to Picture · Part of the course: Generative AI: Making New Things
Lessons are interactive and need JavaScript. Turn it on to play them.