|
Deep Learning Visualizer
Interactive visualization of basic applications of deep learning
|
An interactive neural network. Paint a digit in a 28×28 grid with the mouse, press space, and the model tells you which digit it thinks you drew. Press t to train it on MNIST and watch the cost fall, then press y to measure its accuracy.
The point is to make backpropagation and weight initialization something you can poke at rather than read about. Every prediction is computed live from the pixels under your cursor.
| Input | Action |
|---|---|
| Left mouse button, drag | Paint the digit |
space | Predict the drawn digit, printed to the terminal |
r | Clear the grid |
t | Train on MNIST |
y | Report accuracy on the MNIST test set |
s | Save the current weights to data/mnist/trained.mlp |
Predictions and training progress are printed to the terminal that launched the program, not drawn in the window.
The project targets a desktop OpenGL 3.3 core profile, so it needs a GPU and driver that can provide one. It builds on macOS and Linux, and CI runs it on Ubuntu.
Building requires a C++23 compiler, CMake, and a few system libraries.
Needs Xcode or the Command Line Tools for a C++23 compiler, plus CMake.
macOS is detected automatically and the required system frameworks are linked for you. No OpenGL library needs to be installed, since the system provides it.
libwayland-dev, libxkbcommon-dev, and xorg-dev are what GLFW needs to create a window on Linux.
Clone with the submodules, since GLFW and FreeType are pulled in as git submodules and both need to be compiled before the project can link against them.
Then build the dependencies. This installs GLFW and FreeType into external/, which is where the build looks for them.
The MNIST files are already committed under data/mnist/, so there is nothing else to download.
Finally, build and run:
make produces a debug build in bin/debug/. Set BUILD_TYPE=release for an optimized build in bin/release/:
Release builds use -O3 -march=native, so they are fast but not portable between machines.
See docs/testing.md for how the suite is laid out and how to write new tests.
Doxygen writes the site to docs/html, starting at docs/html/index.html. It is also published to GitHub Pages on every push; see .github/workflows/docs.yml.
To get LSP working properly, use bear: