Number Predictor using Tensorflow.js and MNIST dataset
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
public
src
.gitignore
.prettierrc
LICENSE
README.md
images.d.ts
package.json
tsconfig.json
tsconfig.prod.json
tsconfig.test.json
tslint.json
yarn.lock

README.md

Number Predictor using Tensorflow.js

Demo

A simple number predictor demo built using a Tensorflow.js model trained on the MNIST dataset.

Pre-trained Model

The pre-trained model used by default was trained locally on a Mac machine using Keras and then converted to a Tensorflow.js format.

Browser Trained Model

The local model is trained locally in-browser using Tensorflow.js.

Model Architecture

A Convolutional Neural Network (CNN) with 5 layers, 1 input 3 hidden and 1 for output. See code for more on activation function and other info on the model.

General Architecture

  1. Load the MNIST dataset if training the model in the browser.
  2. Load the pre-trained model or the browser trained model.
  3. Take the input from the canvas element and do some processing to the pixels.
  4. Take the input and run it throw the trained model.
  5. Take the predictions and determine which one has the higher probability.
  6. Display the highest predicted number.