Examples built with TensorFlow.js
Clone or download
caisq [simple-object-detection] Add training script: train.js (#171)
* [simple-object-detection] Add training script: train.js
Latest commit 39ef844 Nov 9, 2018
Permalink
Failed to load latest commit information.
.vscode snapshot Mar 7, 2018
addition-rnn Refresh look and feel of examples: addition-rnn, cart-pole and mnist (#… Nov 6, 2018
baseball-node Bump node examples to tfjs-node 0.1.20 (#172) Nov 9, 2018
boston-housing Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
cart-pole Refresh look and feel of examples: addition-rnn, cart-pole and mnist (#… Nov 6, 2018
custom-layer Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
getting-started Update the getting started example to actually log the values from th… Oct 26, 2018
iris Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
lstm-text-generation Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
mnist-core Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
mnist-node Bump node examples to tfjs-node 0.1.20 (#172) Nov 9, 2018
mnist-transfer-cnn Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
mnist Refresh look and feel of examples: addition-rnn, cart-pole and mnist (#… Nov 6, 2018
mobilenet Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
polynomial-regression-core Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
polynomial-regression Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
sentiment Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
shared Refresh look and feel of examples: addition-rnn, cart-pole and mnist (#… Nov 6, 2018
simple-object-detection [simple-object-detection] Add training script: train.js (#171) Nov 9, 2018
translation Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
tsne-mnist-canvas Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
webcam-transfer-learning [webcam-transfer-learning] Rename some variables for clarity (#167) Oct 31, 2018
website-phishing Upgrade tfjs version: 0.13.2 --> 0.13.3 (#166) Oct 29, 2018
.gitignore Add yalc.lock to .gitignore (#139) Sep 20, 2018
CONTRIBUTING.md snapshot Mar 7, 2018
LICENSE snapshot Mar 7, 2018
README.md Fix typos in README.md (#168) Oct 29, 2018
deploy.sh Move Python scripts for building examples into tfjs-examples (#38) Mar 30, 2018
update-tfjs-version Add script for automatic updating @tensorflow/tfjs version of examples ( Oct 13, 2018
yarn.lock Support user-supplied text data; configurable text data urls; (#115) Jul 22, 2018

README.md

TensorFlow.js Examples

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.

Overview of Examples

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 Sequent-to-prediction RNN: LSTM Browser Browser Layers IndexedDB
mnist 🔗 Image Multiclass classification Convolutional neural network Browser Browser Layers
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
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

Dependencies

Except for getting_started, all the examples require the following dependencies to be installed.

How to build an example

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

Details

The convention is that each example contains two scripts:

  • yarn watch or npm 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 or npm run build: generates a dist/ folder which contains the build artifacts and can be used for deployment.

Contributing

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.