Book Image

Hands-On Neural Networks with TensorFlow 2.0

By : Paolo Galeone
Book Image

Hands-On Neural Networks with TensorFlow 2.0

By: Paolo Galeone

Overview of this book

TensorFlow, the most popular and widely used machine learning framework, has made it possible for almost anyone to develop machine learning solutions with ease. With TensorFlow (TF) 2.0, you'll explore a revamped framework structure, offering a wide variety of new features aimed at improving productivity and ease of use for developers. This book covers machine learning with a focus on developing neural network-based solutions. You'll start by getting familiar with the concepts and techniques required to build solutions to deep learning problems. As you advance, you’ll learn how to create classifiers, build object detection and semantic segmentation networks, train generative models, and speed up the development process using TF 2.0 tools such as TensorFlow Datasets and TensorFlow Hub. By the end of this TensorFlow book, you'll be ready to solve any machine learning problem by developing solutions using TF 2.0 and putting them into production.
Table of Contents (15 chapters)
Free Chapter
1
Section 1: Neural Network Fundamentals
4
Section 2: TensorFlow Fundamentals
8
Section 3: The Application of Neural Networks

Exercises

Please go through the following exercises and answer all questions carefully. This is the only way (by making exercises, via trial and error, and with a lot of struggle) you will be able to master the framework and become an expert:

  1. Define a classifier using the Sequential, Functional, and Subclassing APIs so that you can classify the fashion-MNIST dataset.
  2. Train the model using the Keras model's built-in methods and measure the prediction accuracy.
  3. Write a class that accepts a Keras model in its constructor and that it trains and evaluates.
    The API should work as follows:
# Define your model
trainer = Trainer(model)
# Get features and labels as numpy arrays (explore the dataset available in the keras module)
trainer.train(features, labels)
# measure the accuracy
trainer.evaluate(test_features, test_labels)
  1. Accelerate the training method using the @tf.function annotation...