Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Introduction to TensorFlow.js by building a web app that is able to recognize hand drawn digits in a Canvas element.

In this introduction we will:

  1. Create a simple TensorFlow.js project.
  2. Load a subset of the MNIST digit dataset.
  3. Create a model that is able to predict the numeric value of a handwritten digit.
  4. Train the model.
  5. Allow users to draw digits using the Canvas.
  6. Use our model to recognize user drawn digits.

Slides and Presentation

This project was created for the Fullstack meetup in NYC on June 14th, 2018. You can find the companion slides here.

The presentation given at the meetup is on YouTube here. Apologies in advance for the bad audio.


The following resources were used to create this project:

  • TensorFlow.js MNIST Tutorial: Steps to build and train the DNN to recognize digits. NOTE that we were heavily inspired by this tutorial, but did not exactly follow it.
  • MNIST Digits: Subset of the MNIST dataset for easy consumption within JavaScript.
  • MNIST Digits data loader: To be used with the tool above for generating larger MNIST data subsets.

Further Work

If you would like to experiment further, I challenge you to improve the performance of the model by modifying the hyperparameters (e.g. structure, learning rate, etc...) of the neural network or training the model over a larger MNIST subset.


Simple introduction to TensorFlow.js using the MNIST dataset.




No releases published


No packages published