I was delighted to get an advance copy of Gant Laborde’s “Learning TensorFlow.js” from O’Reilly and privileged to have written the foreword.
Gant has done something special with this book. In just 300 pages, he takes you end-to-end, in-depth through everything you need to know from an introduction to AI, understanding tensors, using them in the browser, deploying them, and more.
It ends with a capstone project (what a great idea, I might have to steal it for my next book!), where you can use Machine Learning to convert an image into a set of dice, like this:
How much fun is that?
I love this book because it is for a different audience than the traditional ML one. It starts with a great introduction to AI and then tells you about TensorFlow.js and how you can use it to build Machine Learning apps. Then, the mystery of Tensors is cracked open, and Gant leads you through some detailed examples of how you can convert images into Tensors for training and inference.
It guides you through the three main ways to get a working model.
Or, you can create your model from scratch, and Gant takes you through the code for defining layers, with deep neural networks to help predict numeric data (such as the famous titanic dataset) or Convolutional Neural networks for image classification.
Finally, there’s Transfer Learning, which could be the most exciting method for most developers, where you have a hybrid of both of the previous methods. You can stand on the shoulders of giants by using parts of an existing model, like Inception, but catered for your own needs.
When I started my Machine Learning journey, one frustration I had was that there was lots of material for creating models but relatively little for using them. The tutorial would end with a validation set showing how accurate the model was, and then it would move on to the next thing! I am delighted to say that this book does not fall into that pattern! So, if you want to build a browser-based app that uses a model, you’ll get lots of code showing you how!
For example, Chapter 6 shows you how to use the webcam in the browser, capturing frames and passing them to a model for classification. Chapter 10 shows you how to create a basic sketchpad for drawing images that a model can interpret.