XP: 0
Part A · Module 1

A Picture Becomes Numbers

The single most important idea in all of AI: computers can't see pictures, words, or sound — only numbers. So the very first step is always turning your data into a list of numbers. Let's watch it happen.
The big idea

Why everything must become numbers

A neural network is, at its heart, a giant math machine. It multiplies and adds numbers — that's all it can do. It has no eyes and no concept of "a picture of a 7." So before a network can learn anything from an image, we must translate that image into the only language it understands: a list of numbers.

Real-world analogy

Think of a piano roll — the paper strip that plays a player-piano. The music isn't "in" the paper; it's encoded as a pattern of holes the machine reads as numbers. Your handwritten digit is the music; the list of numbers is the piano roll. Same information, a form the machine can actually process.

This list of numbers has a name you'll hear constantly: a vector (also called an embedding). It's just a one-dimensional array — a row of numbers. Whether it's an image, a word, or a sound, the first job is always the same: turn it into a vector.

The technique

Flattening a 28×28 image into a 784-vector

Our example is a hand-drawn digit on a 28×28 pixel black-and-white canvas (this is the famous MNIST format). That's a grid — two dimensions. But a vector is a single row — one dimension. So we flatten the grid: read it row by row and lay all the pixels out in one long line.

The math

28 rows × 28 columns = 784 pixels. So every image becomes a vector with exactly 784 numbers. Each number is between 0.0 (pure black, empty) and 1.0 (pure white, fully drawn) — representing that pixel's darkness.

If we label the grid with columns A, B, C… and rows 1, 2, 3…, flattening reads across the first row, then the second, and so on:

# flatten the 28×28 grid, row by row, into one line:
vector = [ A1, A2, A3, … A28,   B1, B2, … B28,   C1, … ] # length = 784

Here's a tiny 3-pixel example so the 0-to-1 darkness scale feels concrete:

0.0
0.4
0.7
1.0
← darker pixel = higher number
🎮 Playground

Draw a digit — watch it become numbers

Draw any number (0–9) in the black box. In real time, watch it get downscaled to the 28×28 grid, and see the actual 784-number vector it produces. Hover over any grid cell to see that exact pixel's value. This is literally what the network receives as input.

Draw → Grid → Vector
Draw with your mouse (or finger). Everything updates live.
brush
hover a grid cell →
shape: (784,) non-zero: 0 max: 0.00 mean: 0.00
the raw 784-vector (first 200 shown):
What you're seeing

Your 280×280 drawing gets shrunk to 28×28 (that's why one grid cell covers many of your pixels). Each cell's brightness becomes one number in the vector. An empty image is 784 zeros; a drawn digit lights up maybe 100–150 of them. The network never "sees" your digit — it only ever sees these 784 numbers.

🎯 Check your understanding

Quick challenge

1. A 28×28 image flattens into a vector of how many numbers?
2. What does a value of 1.0 in the vector mean?
3. Why do we flatten the 2D grid into a 1D vector at all?
Takeaway

What you learned

Computers only understand numbers. Any input — an image, a word, a sound — must first become a vector (a flat list of numbers), also called an embedding. A 28×28 image flattens into a 784-vector, each value from 0 (black) to 1 (white). This vector is the only thing the neural network ever sees.

Next up → Module 2: The neuron & the network. Now that we have 784 input numbers, what happens to them? They flow into layers of "neurons." We'll see what a neuron actually is and how a value travels through the network.