0%

Given the demand for AI and the ubiquity of JavaScript, TensorFlow.js was inevitable. With this Google framework, seasoned AI veterans and web developers alike can help propel the future of AI-driven websites. In this guide, author Gant Laborde (Google Developer Expert in machine learning and the web) provides a hands-on end-to-end approach to TensorFlow.js fundamentals for a broad technical audience that includes data scientists, engineers, web developers, students, and researchers.

You'll begin by working through some basic examples in TensorFlow.js before diving deeper into neural network architectures, DataFrames, TensorFlow Hub, model conversion, transfer learning, and more. Once you finish this book, you'll know how to build and deploy production-readydeep learning systems with TensorFlow.js.

  • Explore tensors, the most fundamental structure of machine learning
  • Convert data into tensors and back with a real-world example
  • Combine AI with the web using TensorFlow.js
  • Use resources to convert, train, and manage machine learning data
  • Build and train your own training models from scratch

Table of Contents

  1. Foreword
  2. Preface
    1. Let’s Do This
    2. Why TensorFlow.js?
    3. Who Should Read This Book?
    4. Book Overview
    5. The Chapters
    6. The Takeaway
    7. Conventions Used in This Book
    8. Using Code Examples
    9. O’Reilly Online Learning
    10. How to Contact Us
    11. Acknowledgments
  3. 1. AI Is Magic
    1. The Path of AI in JavaScript
    2. What Is Intelligence?
    3. The History of AI
    4. The Neural Network
    5. Today’s AI
    6. Why TensorFlow.js?
    7. Significant Support
    8. Online Ready
    9. Offline Ready
    10. Privacy
    11. Diversity
    12. Types of Machine Learning
    13. Quick Definition: Supervised Learning
    14. Quick Definition: Unsupervised Learning
    15. Quick Definition: Semisupervised Learning
    16. Quick Definition: Reinforcement Learning
    17. Information Overload
    18. AI Is Everywhere
    19. A Tour of What Frameworks Provide
    20. What Is a Model?
    21. In This Book
    22. Associated Code
    23. Chapter Sections
    24. Common AI/ML Terminology
    25. Chapter Review
    26. Review Questions
  4. 2. Introducing TensorFlow.js
    1. Hello, TensorFlow.js
    2. Leveraging TensorFlow.js
    3. Let’s Get TensorFlow.js Ready
    4. Getting Set Up with TensorFlow.js in the Browser
    5. Using NPM
    6. Including a Script Tag
    7. Getting Set Up with TensorFlow.js Node
    8. Verifying TensorFlow.js Is Working
    9. Download and Run These Examples
    10. Let’s Use Some Real TensorFlow.js
    11. The Toxicity Classifier
    12. Loading the Model
    13. Classifying
    14. Try It Yourself
    15. Chapter Review
    16. Chapter Challenge: Truck Alert!
    17. Review Questions
  5. 3. Introducing Tensors
    1. Why Tensors?
    2. Hello, Tensors
    3. Creating Tensors
    4. Tensors for Data Exercises
    5. Tensors on Tour
    6. Tensors Provide Speed
    7. Tensors Provide Direct Access
    8. Tensors Batch Data
    9. Tensors in Memory
    10. Deallocating Tensors
    11. Automatic Tensor Cleanup
    12. Tensors Come Home
    13. Retrieving Tensor Data
    14. Tensor Manipulation
    15. Tensors and Mathematics
    16. Recommending Tensors
    17. Chapter Review
    18. Chapter Challenge: What Makes You So Special?
    19. Review Questions
  6. 4. Image Tensors
    1. Visual Tensors
    2. Quick Image Tensors
    3. JPGs and PNGs and GIFs, Oh My!
    4. Browser: Tensor to Image
    5. Browser: Image to Tensor
    6. Node: Tensor to Image
    7. Node: Image to Tensor
    8. Common Image Modifications
    9. Mirroring Image Tensors
    10. Resizing Image Tensors
    11. Cropping Image Tensors
    12. New Image Tools
    13. Chapter Review
    14. Chapter Challenge: Sorting Chaos
    15. Review Questions
  7. 5. Introducing Models
    1. Loading Models
    2. Loading Models Via Public URL
    3. Loading Models from Other Locations
    4. Our First Consumed Model
    5. Loading, Encoding, and Asking a Model
    6. Interpreting the Results
    7. Cleaning the Board After
    8. Our First TensorFlow Hub Model
    9. Exploring TFHub
    10. Wiring Up Inception v3
    11. Our First Overlayed Model
    12. The Localization Model
    13. Labeling the Detection
    14. Chapter Review
    15. Chapter Challenge: Cute Faces
    16. Review Questions
  8. 6. Advanced Models and UI
    1. MobileNet Again
    2. SSD MobileNet
    3. Bounding Outputs
    4. Reading Model Outputs
    5. Displaying All Outputs
    6. Detection Cleanup
    7. Quality Checking
    8. IoUs and NMS
    9. Adding Text Overlays
    10. Solving Low Contrast
    11. Solving Draw Order
    12. Connecting to a Webcam
    13. Moving from Image to Video
    14. Activating a Webcam
    15. Drawing Detections
    16. Chapter Review
    17. Chapter Challenge: Top Detective
    18. Review Questions
  9. 7. Model-Making Resources
    1. Out-of-Network Model Shopping
    2. Model Zoos
    3. Converting Models
    4. Your First Customized Model
    5. Meet Teachable Machine
    6. Use Teachable Machine
    7. Gathering Data and Training
    8. Verifying the Model
    9. Machine Learning Gotchas
    10. Small Amounts of Data
    11. Poor Data
    12. Data Bias
    13. Overfitting
    14. Underfitting
    15. Datasets Shopping
    16. The Popular Datasets
    17. Chapter Review
    18. Chapter Challenge: R.I.P. You Will Be MNIST
    19. Review Questions
  10. 8. Training Models
    1. Training 101
    2. Data Prep
    3. Design a Model
    4. Identify Learning Metrics
    5. Task the Model with Training
    6. Put It All Together
    7. Nonlinear Training 101
    8. Gathering the Data
    9. Adding Activations to Neurons
    10. Watching Training
    11. Improving Training
    12. Chapter Review
    13. Chapter Challenge: The Model Architect
    14. Review Questions
  11. 9. Classification Models and Data Analysis
    1. Classification Models
    2. The Titanic
    3. Titanic Dataset
    4. Danfo.js
    5. Preparing for the Titanic
    6. Training on Titanic Data
    7. Feature Engineering
    8. Dnotebook
    9. Titanic Visuals
    10. Creating Features (aka Preprocessing)
    11. Feature Engineered Training Results
    12. Reviewing Results
    13. Chapter Review
    14. Chapter Challenge: Ship Happens
    15. Review Questions
  12. 10. Image Training
    1. Understanding Convolutions
    2. Convolutions Quick Summary
    3. Adding Convolution Layers
    4. Understanding Max Pooling
    5. Max Pooling Quick Summary
    6. Adding Max Pooling Layers
    7. Training Image Classification
    8. Handling Image Data
    9. The Sorting Hat
    10. Getting Started
    11. Converting Folders of Images
    12. The CNN Model
    13. Training and Saving
    14. Testing the Model
    15. Building a Sketchpad
    16. Reading the Sketchpad
    17. Chapter Review
    18. Chapter Challenge: Saving the Magic
    19. Review Questions
  13. 11. Transfer Learning
    1. How Does Transfer Learning Work?
    2. Transfer Learning Neural Networks
    3. Easy MobileNet Transfer Learning
    4. TensorFlow Hub Check, Mate!
    5. Utilizing Layers Models for Transfer Learning
    6. Shaving Layers on MobileNet
    7. Layers Feature Model
    8. A Unified Model
    9. No Training Needed
    10. Easy KNN: Bunnies Versus Sports Cars
    11. Chapter Review
    12. Chapter Challenge: Warp-Speed Learning
    13. Review Questions
  14. 12. Dicify: Capstone Project
    1. A Dicey Challenge
    2. The Plan
    3. The Data
    4. The Training
    5. The Website
    6. Generating Training Data
    7. Training
    8. The Site Interface
    9. Cut into Dice
    10. Reconstruct the Image
    11. Chapter Review
    12. Chapter Challenge: Easy as 01, 10, 11
    13. Review Questions
  15. Afterword
    1. Social
    2. More Books
    3. Other Options
    4. More TensorFlow.js Code
    5. Thanks
  16. A. Chapter Review Answers
    1. Chapter 1: AI Is Magic
    2. Chapter 2: Introducing TensorFlow.js
    3. Chapter 3: Introducing Tensors
    4. Chapter 4: Image Tensors
    5. Chapter 5: Introducing Models
    6. Chapter 6: Advanced Models and UI
    7. Chapter 7: Model-Making Resources
    8. Chapter 8: Training Models
    9. Chapter 9: Classification Models and Data Analysis
    10. Chapter 10: Image Training
    11. Chapter 11: Transfer Learning
    12. Chapter 12: Dicify: Capstone Project
  17. B. Chapter Challenge Answers
    1. Chapter 2: Truck Alert!
    2. Chapter 3: What Makes You So Special?
    3. Chapter 4: Sorting Chaos
    4. Chapter 5: Cute Faces
    5. Chapter 6: Top Detective
    6. Chapter 7: R.I.P. You will be MNIST
    7. Chapter 8: The Model Architect
    8. Chapter 9: Ship Happens
    9. Chapter 10: Saving the Magic
    10. Chapter 11: Warp-Speed Learning
    11. Chapter 12: Easy as 01, 10, 11
  18. C. Rights and Licenses
    1. Unsplash License
    2. Apache License 2.0
    3. Public Domain
    4. WTFPL
    5. Creative Commons Attribution-sharealike 4.0 International License (CC BY-SA 4.0)
    6. Creative Commons Attribution 4.0 International License (CC BY 4.0)
    7. Gant Laborde and O’Reilly
    8. TensorFlow and TensorFlow.js Logos
  19. Index
18.218.184.214