Google is committed to advancing racial equity for Black communities. See how.

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 程式庫的主要作者群所著,針對在瀏覽器或節點上以 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 中執行 (其為代管筆記本環境,無須進行任何設定)。請按一下 [Run in 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.