This repository contains a set of examples implemented in TensorFlow.js.
Each example directory is standalone so the directory can be copied to another project.
Example name | Demo link | Input data type | Task type | Model type | Training | Inference | API type | Save-load operations |
---|---|---|---|---|---|---|---|---|
addition-rnn | ๐ | Text | Sequence-to-sequence | RNN: SimpleRNN, GRU and LSTM | Browser | Browser | Layers | |
baseball-node | Numeric | Multiclass classification | Multilayer perceptron | Node.js | Node.js | Layers | ||
boston-housing | ๐ | Numeric | Regression | Multilayer perceptron | Browser | Browser | Layers | |
cart-pole | ๐ | Reinforcement learning | Policy gradient | Browser | Browser | Layers | IndexedDB | |
custom-layer | ๐ | (Illustrates how to define and use a custom Layer subtype) | Browser | Layers | ||||
iris | ๐ | Numeric | Multiclass classification | Multilayer perceptron | Browser | Browser | Layers | |
lstm-text-generation | ๐ | Text | Sequence-to-prediction | RNN: LSTM | Browser | Browser | Layers | IndexedDB |
mnist | ๐ | Image | Multiclass classification | Convolutional neural network | Browser | Browser | Layers | |
mnist-acgan | ๐ | Image | Generative Adversarial Network (GAN) | Convolutional neural network; GAN | Node.js | Browser | Layers | Saving to filesystem from Node.js and loading it in the browser |
mnist-core | ๐ | Image | Multiclass classification | Convolutional neural network | Browser | Browser | Core (Ops) | |
mnist-node | Image | Multiclass classification | Convolutional neural network | Node.js | Node.js | Layers | Saving to filesystem | |
mnist-transfer-cnn | ๐ | Image | Multiclass classification (transfer learning) | Convolutional neural network | Browser | Browser | Layers | Loading pretrained model |
mobilenet | ๐ | Image | Multiclass classification | Convolutional neural network | Browser | Layers | Loading pretrained model | |
polynomial-regression | ๐ | Numeric | Regression | Shallow neural network | Browser | Browser | Layers | |
polynomial-regression-core | ๐ | Numeric | Regression | Shallow neural network | Browser | Browser | Core (Ops) | |
sentiment | ๐ | Text | Sequence-to-regression | LSTM, 1D convnet | Browser | Layers | Loading model converted from Keras | |
simple-object-detection | ๐ | Image | Object detection | Convolutional neural network (transfer learning) | Node.js | Browser | Layers | Save a trained model from tfjs-node and load it in the browser |
translation | ๐ | Text | Sequence-to-sequence | LSTM encoder and decoder | Browser | Layers | Loading model converted from Keras | |
tsne-mnist-canvas | Dimension reduction and data visualization | tSNE | Browser | Browser | Core (Ops) | |||
webcam-transfer-learning | ๐ | Image | Multiclass classification (transfer learning) | Convolutional neural network | Browser | Browser | Layers | Loading pretrained model |
website-phishing | ๐ | Numeric | Binary classification | Multilayer perceptron | Browser | Browser | Layers |
Except for getting_started
, all the examples require the following dependencies to be installed.
cd
into the directory
If you are using yarn
:
cd mnist-core
yarn
yarn watch
If you are using npm
:
cd mnist-core
npm install
npm run watch
The convention is that each example contains two scripts:
-
yarn watch
ornpm run watch
: starts a local development HTTP server which watches the filesystem for changes so you can edit the code (JS or HTML) and see changes when you refresh the page immediately. -
yarn build
ornpm run build
: generates adist/
folder which contains the build artifacts and can be used for deployment.
If you want to contribute an example, please reach out to us on Github issues before sending us a pull request as we are trying to keep this set of examples small and highly curated.