r/learnmachinelearning • u/herbal1st • 17h ago
Interactive Neural Network Playground in Pygame & pure NumPy — live activation graph, 10 architectures, and GIF interpolation
2
Upvotes
r/learnmachinelearning • u/herbal1st • 17h ago
1
u/herbal1st 17h ago
What is happening here?
Instead of storing pixels like a normal image file, this small neural network is learning a math formula that predicts the color
(R, G, B)for any(x, y)coordinate—and(x, y, time)for animated GIFs.What you're seeing on screen:
A quick note on image/GIF sharpness:
The reconstructions have a slightly soft, painterly look rather than 100% razor-sharp pixel accuracy. That's an intentional tradeoff: the network is kept tiny (only ~4k–22k weights depending on the mode and preset) so it runs smoothly in real time on a CPU in pure NumPy without a GPU. Packing a full 13-frame animation into ~22,000 numbers pushes that tiny capacity pretty hard, so there's plenty of room to experiment with bigger layers, longer training, or different activation combos like
SIN(SIREN).Under the hood:
pygame-ce) for the UI, live activation visualizer, and GIF decoding.1–0to swap between 10 network architectures,Tabto toggle Fourier coordinate encoding (notice howRAWmode at0:32can only draw smooth color gradients!), and the arrow keys to cycle each layer's activation function live.Source Code (Source-Available / Non-Commercial EULA): github.com
Happy to answer any questions about how the math or Pygame UI works!