TensorFlow.js puts machine learning in the browser

The WebGL-accelerated library works with the Node.js server-side JavaScript runtime, but isn’t on par with Tensorflow’s Python API

TensorFlow.js puts machine learning in the browser

Google’s TensorFlow open source machine learning library has been extended to JavaScript with Tensorflow.js, a JavaScript library for deploying machine learning models in the browser.

A WebGL-accelerated library, Tensorflow.js also works with the Node.js server-side JavaScript runtime and is part of the TensorFlow ecosystem.  With machine learning directly in the browser, there is no need for drivers; developers can just run code.

The project, which features an ecosystem of JavaScript tools, evolved from the Deeplearn.js library for browser-based machine learning; Deeplearn.js is now known as Tensorflow.js Core.

TensorFlow.js APIs can be used to build models using the low-level JavaScript linear algebra library or the higher-level layers API. TensorFlow.js model converters can run existing models in the browser or under Node.js. Existing models can be retrained using sensor data connected to the browser.

A tensor serves as the central unit of data. Also, a high-level, Keras-inspired API is included for building neural networks.

But TensorFlow.js is not the only JavaScript library built for neural networking; TensorFire, built by MIT students, executes neural networks in a webpage.

Tensorflow.js has an API similar to Tensorflow’s Python API. But the JavaScript API does yet not support all the functionality of the Python API. Builders of Tensorflow.js pledge to achieve parity where it makes sense but want to provide an idiomatic JavaScript API. TensorFlow with WebGL also runs at 50 to 60 percent the speed of the TensorFlow Python API usedwith the AVX library.

Planned enhancements for TensorFlow.js include:

  • A visualization library to perform quick visualizations of the model and data.
  • Performance improvements in the browser.
  • WebGL optimization.
  • A browser- and Node-specific data API.
  • Cloud integration on the Node.js side, including serverless-type integration points.
  • Better async support with the libuv asynchronous I/O library.

Where to download TensorFlow.js

You can download TensorFlow.js from GitHub.

Copyright © 2018 IDG Communications, Inc.