Paul Krill
Editor at Large

TensorFlow.js puts machine learning in the browser

news
Sep 11, 20182 mins

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

artificial intelligence / machine learning
Credit: Thinkstock

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.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author