← Back to the collection
LEARNING / 2023 / EXPERIMENTAL PROTOTYPE

Looking inside a forward pass.

ANN Visualizer

A browser experiment that connects neural-network training to a spatial view of inputs, hidden layers, and predictions.

MEDIUM
  • JavaScript
BUILT WITH
  • React
  • TensorFlow.js
  • Three.js
  • Web Workers
ACCESS

Private source · project overview

A freshly trained ANN classifies handwritten MNIST digits while the camera moves around its input, hidden layers, and labeled outputs
Fresh local run · 35 seconds · actual input digits and predictions, with an orbiting camera.Open film ↗
01

Bring the hidden layers into view

A 784-input network feeds two 16-unit hidden layers and ten output classes. The scene represents inputs and neurons spatially, while animation highlights information moving through the network.

02

Separate learning from rendering

A Web Worker runs TensorFlow.js training in batches and sends activation information, loss, accuracy, and the input label back to the interface. The scene consumes these messages to animate the prediction.

SYSTEM SKETCH / CONCEPTUAL OVERVIEW
MNIST → TRAINING WORKER → ACTIVATIONS
              │                 │
         loss / accuracy        ▼
              └───────── 3D NETWORK VIEW
A reading of the architecture, not an application screenshot.
SYSTEM MAP / MESSAGE SEQUENCE / COMPONENTS

Training and drawing live on opposite sides of a message.

NeuralNetwork → worker.js: postMessage(train / predict). worker.js → 784 → 16 → 16 → 10: batch / predict. 784 → 16 → 16 → 10 → animatePrediction: activation data. animatePrediction → processAnimationPackage: postMessage to main thread. processAnimationPackage → useFrame / animations: animation state.1234501 / MAIN THREADNeuralNetworkTrain / predict actionsWeb Worker message handler02 / WORKER THREADworker.jsLoad MNIST examplesTensorFlow.js model.fit()03 / MODEL784 → 16 → 16 → 10Hidden activationsOutput prediction04 / MESSAGEanimatePredictionInput pixels + digit labelActivations + loss / accuracy05 / SCENE STATEprocessAnimationPackageInput colours / hidden layersPrediction and metric readouts06 / RENDER LOOPuseFrame / animationsAnimate forward passThree.js meshes + camera
  1. 01 / main thread

    NeuralNetwork

    Train / predict actions

    Web Worker message handler

    • postMessage(train / predict) → 2. worker.js
  2. 02 / worker thread

    worker.js

    Load MNIST examples

    TensorFlow.js model.fit()

    • batch / predict → 3. 784 → 16 → 16 → 10
  3. 03 / model

    784 → 16 → 16 → 10

    Hidden activations

    Output prediction

    • activation data → 4. animatePrediction
  4. 04 / message

    animatePrediction

    Input pixels + digit label

    Activations + loss / accuracy

    • postMessage to main thread → 5. processAnimationPackage
  5. 05 / scene state

    processAnimationPackage

    Input colours / hidden layers

    Prediction and metric readouts

    • animation state → 6. useFrame / animations
  6. 06 / render loop

    useFrame / animations

    Animate forward pass

    Three.js meshes + camera

    1. 1NeuralNetwork worker.jspostMessage(train / predict)
    2. 2worker.js 784 → 16 → 16 → 10batch / predict
    3. 3784 → 16 → 16 → 10 animatePredictionactivation data
    4. 4animatePrediction processAnimationPackagepostMessage to main thread
    5. 5processAnimationPackage useFrame / animationsanimation state
    The film’s readable input/prediction overlay uses the same activation package as the scene. Training batch accuracy is not an overall held-out accuracy score.
    Read from the implementation
    • components/NeuralNetwork.js
    • workers/worker.js
    • ML Files/mnist_data.js
    • helperFunctions/networkAnimations.js
    03

    A fresh run, with readable results

    This film reruns the original network with 300 training batches of 64 examples, two epochs per batch, and shows consecutive held-out predictions from later in the run. A capture-only readout displays the actual input pixels, digit label, and model prediction. The camera moves while each result remains visible. Batch accuracy is a training metric, not a claim about overall test accuracy. Camera framing, visual density, and result hold time were adjusted in an isolated copy; the model architecture is unchanged.

    CONTINUE EXPLORING

    UDP Messenger →

    A desktop chat experiment with direct messages, group broadcast, and retrieval of stored conversations.

    2021
    • Java