Chapter 15. An Introduction to TensorFlow.js

In addition to TensorFlow Lite, which enables running on native mobile or embedded systems, the TensorFlow ecosystem also includes TensorFlow.js, which lets you develop ML models using the popular JavaScript language to use directly in the browser, or on a backend with Node.js. It allows you to train new models as well as running inference on them, and includes tools that let you convert your Python-based models into JavaScript-compatible ones. In this chapter you’ll get an introduction to how TensorFlow.js fits into the overall ecosystem and a tour of its architecture, and you’ll learn how to build your own models using a free, open source IDE that integrates with your browser.

What Is TensorFlow.js?

The TensorFlow ecosystem is summarized in Figure 15-1. It comprises a suite of tools for training models, a repository for preexisting models and layers, and a set of technologies that allow you to deploy models for your end users to take advantage of.

Like TensorFlow Lite (Chapters 1214) and TensorFlow Serving (Chapter 19), TensorFlow.js mostly lives on the right side of this diagram, because while it’s primarily intended as a runtime for models, it can also be used for training models and should be considered a first-class language alongside Python and Swift for this task. TensorFlow.js can be run in the browser or on backends like Node.js, but for the purposes of this book we’ll focus primarily on the browser.

Figure 15-1. The TensorFlow ...

Get AI and Machine Learning for Coders now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.