ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

TensorFlow for JavaScript development

Before starting on the learning materials below, you should:

  1. Be comfortable with browser programming using HTML, CSS, & JavaScript

  2. Be familiar with using the command line to run Node.js scripts

This curriculum is for people who want to:

  1. Build ML models in JavaScript

  2. Run existing models anywhere Javascript can run

  3. Deploy ML models to web browsers

TensorFlow.js lets you develop or execute ML models in JavaScript, and use ML directly in the browser client side, server side via Node.js, mobile native via React Native, desktop native via Electron, and even on IoT devices via Node.js on Raspberry Pi. To learn more about TensorFlow.js, and what can be done with it, check out this talk at Google I/O.

Step 1: Get introduced to machine learning in the browser

To get a quick introduction on basics for ML in JavaScript, watch the videos below that take you from first principles, to using existing pre-made models, and even building your own neural network for classification. You can also try the Make a smart webcam in JavaScript Codelab for an interactive walkthrough of these concepts.

Superpowers for next gen web apps: Machine Learning

This high level intro to machine learning in JavaScript is for web developers looking to take their first steps with TensorFlow.js.

开始通过 TensorFlow 使用 TensorFlow.js

该专项课程由 3 个部分组成,探讨了如何使用 TensorFlow.js 训练和执行机器学习模型,并向您展示了如何使用 JavaScript 创建直接在浏览器中执行的机器学习模型。

Make a smart webcam in JavaScript with a pre-trained model

Learn how to load and use one of the TensorFlow.js pre-trained models (COCO-SSD) and use it to recognize common objects it's been trained on.

第 2 步:更加深入地了解深度学习

To get a deeper understanding of how neural networks work, and a broader understanding of how to apply them to different problems, we have two books available.

Learning TensorFlow.js is a great place to start if you are new to Tensors and Machine Learning generally but have a good understanding of JavaScript. This book takes you all the way from the basics such as understanding how to manipulate data into Tensors, to quickly progressing to real world applications. After reading, you will understand how to load existing models, pass data to them, and interpret data that comes out.

Deep Learning with JavaScript is also a great place to start. It is accompanied by a large number of examples from GitHub so you can practice working with machine learning in JavaScript.

This book will demonstrate how to use a wide variety of neural network architectures, such as Convolutional Neural Networks, Recurrent Neural Networks, and advanced training paradigms such as reinforcement learning. It also provides clear explanations of what is actually happening with the neural network in the training process.

Learning TensorFlow.js
by Gant Laborde

A hands-on end-to-end approach to TensorFlow.js fundamentals for a broad technical audience. Once you finish this book, you'll know how to build and deploy production-ready deep learning systems with TensorFlow.js.

Deep Learning with JavaScript
by Shanqing Cai, Stanley Bileschi, Eric D. Nielsen with Francois Chollet

本书由 TensorFlow 库的主要作者编著,提供了关于在浏览器中或 Node 上使用 JavaScript 构建深度学习应用的精彩用例和深入说明。

第 3 步:使用 TensorFlow.js 进行示例练习

Practice makes perfect, and getting hands on experience is the best way to lock in the concepts. Check out the TensorFlow.js codelabs to further your knowledge with these step by step guides for common use cases:

  1. Make your very own “Teachable Machine” from a blank canvas

  2. Handwritten digit recognition with Convolutional Neural Networks

  3. Make predictions from 2D data

  4. Convert a Python SavedModel to TensorFlow.js format

  5. Use Firebase to deploy and host a TensorFlow.js model

  6. Build a comment spam detection system

  7. Retrain a comment spam detection model to handle custom edge cases

  8. Audio recognition using transfer learning

With your knowledge of neural networks, you can more easily explore the open sourced examples created by the TensorFlow team. They are all available on GitHub, so you can delve into the code and see how they work.

使用 TensorFlow.js 构建的示例

GitHub 上的代码库,包含一组在 TensorFlow.js 中实现的示例。各个示例目录相互独立,因此可以将该目录复制到其他项目。

浏览我们的教程,了解如何开始使用 TensorFlow.js

TensorFlow 教程是以 Jupyter 笔记本的形式编写而成,可直接在 Google Colab(一种无需设置的托管式笔记本环境)中运行。点击“在 Google Colab 中运行”按钮。

第 4 步:创建新项目!

Once you've tested your knowledge, and practiced with some of the TensorFlow.js examples, you should be ready to start developing your own projects. Take a look at our pretrained models, and start building an app in minutes. Or you can train your own model using data you've collected, or by using public datasets. Kaggle and Google Dataset Search are great places to find open datasets for training your model.

If you are looking for inspiration, check out our Made With TensorFlow.js show and tell episodes from people all around the world who have used TensorFlow.js in their applications.

You can also see the latest contributions from the community by searching for the #MadeWithTFJS hashtag on social media.