{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Tensorflow.js\n", "\n", "In this notebooks, we build and train [a deep CNN model](https://developers.google.com/machine-learning/glossary/#convolutional_neural_network) using TensorFlow.js and visualize the predictions from the trained model on MNIST datasets.\n", "You can build and train deep neural network machine learning mode with tslab and Tensorflow.js without using Python.\n", "\n", "### Tensorflow.js references\n", "\n", "- [TensorFlow.js in Node](https://www.tensorflow.org/js/guide/nodejs)\n", "- [Get Started | Tensorflow.js](https://www.tensorflow.org/js/tutorials)\n", "\n", "### Disclaimer\n", "\n", "Don't run this notebook on mybinder.org.\n", "The training of the CNN model in this notebook is very heavy and it will not finish on mybinder.org.\n", "Please try this notebook in your local environment with enough CPU power." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "/**\n", " * Copyright 2018 Google LLC. All Rights Reserved.\n", " * Licensed under the Apache License, Version 2.0 (the \"License\");\n", " * you may not use this file except in compliance with the License.\n", " * You may obtain a copy of the License at\n", " *\n", " * http://www.apache.org/licenses/LICENSE-2.0\n", " *\n", " * Unless required by applicable law or agreed to in writing, software\n", " * distributed under the License is distributed on an \"AS IS\" BASIS,\n", " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", " * See the License for the specific language governing permissions and\n", " * limitations under the License.\n", " * =============================================================================\n", " *\n", " * This code was branched from\n", " * https://github.com/tensorflow/tfjs-examples/blob/master/mnist-node/\n", " * to demostrate Tensorflow in tslab.\n", " */\n", "\n", "import * as tf from '@tensorflow/tfjs-node'\n", "import Jimp from 'jimp';\n", "import {promisify} from 'util';\n", "import {dataset as mnist} from '../lib/mnist';\n", "import {display} from 'tslab';\n", "import * as tslab from 'tslab';" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "