Skip to content
AI Engineering
Breakthroughs Beyond Chat

Vision and image generation

Computers learned to see around 2012. A decade later they learned to draw.

Chapter 3: Breakthroughs Beyond ChatLesson 1 of 6Level: StarterAbout 15 min
Words on this page (11)
CNN
: A network that slides small filters over an image to detect edges, shapes and objects.
neural network
: A function built from layers of simple units (neurons) whose weights are learned from data.
benchmark
: A fixed test with a score used to compare models.
diffusion model
: An image generator trained to remove noise step by step. Generation starts from pure noise.
prompt
: The input text you give a model, including instructions, examples and data.
weights
: The learned numbers that define a trained model. A model whose weights are published is called open-weight.
training
: Adjusting a model's parameters on data so its predictions improve.
deepfake
: A realistic fake image, video or voice made with AI to look like a real person or event.
loss
: A number measuring how wrong the model's output is. Training tries to reduce it.
gradient
: The direction and rate at which the loss changes when each parameter changes. Training steps against it.
gradient descent
: Repeatedly nudging parameters opposite to the gradient to reduce the loss.

Seeing

Before 2012, image recognition used hand-designed features. AlexNet, a (a network that slides small filters across an image to detect edges, then shapes, then objects), cut the ImageNet error rate sharply. Later models like ResNet passed human-level accuracy on that . Vision models now power photo search, medical imaging support, self-driving perception and document reading.

Drawing

Generative adversarial networks (GANs, 2014) pitted a generator against a critic to produce realistic images. models took over from 2020. A diffusion model is trained by adding noise to images step by step and learning to reverse it. To generate, it starts from pure noise and removes it step by step, guided by a text . DALL-E, Midjourney and Stable Diffusion (open , 2022) made this mainstream. Video models such as Sora extended the idea to moving images.

Why it matters

The same pattern of a scalable architecture, lots of data and lots of compute drove both. It also raised real questions about data rights, and provenance, which the field is still working out.

A worked example: how a filter finds a face

A small filter, say 3 by 3 pixels, slides across the image. Where the pixels look like a vertical edge the filter produces a high number. Many filters produce many maps: edges, then corners, then eyes and noses. Stack layers and the last one says "face". The network learns the filters from examples. This sliding filter is called a convolution.

A worked example: diffusion in four steps

Start with a clean photo of a dog. Add a little random noise, then more, until it is pure static. Train a network to guess the noise that was added at each step. To generate, start from static and repeatedly subtract the guessed noise, steered by your text prompt "a dog wearing a hat". After about 20 to 50 steps an image appears.

How the filters get their values

A filter is a small grid of numbers. At the start those numbers are random. The network sees a labelled photo, makes a guess and measures how wrong it was (the ). descent then nudges every filter number a little in the direction that shrinks the loss. After millions of photos, the early filters turn into edge detectors, because edges help with almost every recognition task. Nobody types them in. A 3 by 3 filter holds 9 numbers, so a layer of 32 such filters on a black-and-white image holds 9 × 32 = 288 numbers.

Why drawing takes many small steps

Removing all the noise in one jump gives a blurry average of everything the model has seen. Small steps let it commit to details gradually. Early steps tend to settle the rough layout and colors, and later steps add texture and sharp edges. A guidance setting controls how strongly your text pulls on each step. Too low and the image ignores your words. Too high and images often look harsh and overdone.

When the result is wrong

The symptom is a hand with six fingers, a sign with scrambled letters, or three apples when you asked for four. The cause is that the model learned what these things usually look like, not the rules behind them. A recognition model that only saw bright daytime photos can also fail at night, because the pixels look unlike its training data. To check whether a flaw is a model limit or bad luck, repeat the prompt with ten different random seeds (the seed fixes the starting noise). If most of the ten share the flaw, it is the model.

Try it yourself: count the apples

Open any free image generator. Ask for "a hand holding four red apples" five times. Count the fingers and the apples in each image. Then add detail ("on a white table, daylight, photo") and repeat. Counting errors are common, especially above three or four objects, and often persist while the style changes. Treat that as a sign the model copies appearance more than it counts.

Common mistake

Believing the image model understands what it draws. It captures how things usually look. That is why hands, text and counting objects were hard for early versions.

Check yourself

How does a diffusion model make an image?

What did AlexNet show?

A diffusion model draws six fingers on a hand. What is the most likely reason?

Go deeper

Spotted a mistake or something unclear? Report it on GitHub.

On this page