Mini Digits Generator
Blends ten font-rendered digits into 28×28 images, using the input and output shape of a GAN generator.
Not a trained GAN. There is no discriminator and no training. The weights are set by hand. The page shows how a generator maps a random vector to an image; the image is a weighted blend of the digits 0–9 drawn in a monospace font.
How it works
| Step | What the code does |
|---|---|
| Random vector | 10 numbers in [-1, 1] from a seeded random generator (Mulberry32). Same seed, same images. |
| Mixing layer | A fixed 10×10 weight matrix plus bias turns the vector into 10 scores, one per digit. |
| Temperature | Scores are divided by the temperature, then passed through softmax. The result is 10 weights that sum to 1. |
| Digit images | Each digit 0–9 is drawn once in IBM Plex Mono on a 28×28 canvas. |
| Output | Each pixel is the weighted sum of the ten digit images, shown as grayscale. |
Controls
- Seed: picks the random vectors. Each seed gives 9 images.
- Temperature: low values push the weights toward one digit (cleaner images). High values spread them out (blurrier blends).
- Generate batch: adds 1 to the seed.
- Randomize seed: picks a random seed.
- Coefficient readout: the 10 digit weights for each image.
Demo
0.75
Coefficient readout
Notes
- The digit images are drawn in the browser, so no image files are downloaded.
- All math uses typed arrays in plain JavaScript.
- A trained GAN would learn its weights from real handwriting (for example MNIST). This page does not.