Skip to content

cluoma/nn_c2_widget

Repository files navigation

MNIST Neural Network Widgets

This repo is for a pair of web component widgets. Both are based around training a neural network on the MNIST dataset. They allow users to draw a digit and have the neural network predict what they drew.

Both widgets run completely client-side using either straightforward matrix calculations or TensorFlow.js.

Alt text

Multilayer Perceptron Network

widget/

The nn_c2.c file contains code to train a fully connected NN model using only basic linear algebra.

It outputs 6 CSV files with the weights and biases of the trained model. Combine these into a single JSON using the to_json.R script.

The feedforward calculations are recreated in the widget using Math.js and the trained model parameters.

Convolutional Network

widget_conv/

The convolutional network is trained using Keras and is contained in the mnist_conv_train.py script. The model output is stored in tfmodels/ using TensorFlow.js so that it is ready for use in the widget.

The widget uses TensorFlow.js to load the trained model and do the predictions.

Acknowledgements

About

A repository for MNIST drawing web component widgets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published