The following section contains some information and advice to facilitate the reading of this book and to help readers benefit from its supplementary materials.
To get the most out of this book
Download and run the example code files
Practice makes perfect. Therefore, this book not only provides in-depth explanations of TensorFlow 2 and state-of-the-art computer-vision methods, but it also comes with a number of practical examples and complete implementations for each chapter.
Download the code files
You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packt.com.
- Select the Support tab.
- Click on Code Downloads.
- Enter the name of the book in the Search box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Computer-Vision-with-TensorFlow-2. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing. Check them out!
Study and run the experiments
Jupyter Notebook (https://jupyter.org) is an open source web application for creating and sharing Python scripts, along with textual information, visual results, equations, and more. We will call Jupyter notebooks the documents provided with the book, containing detailed code, expected results, and supplementary explanations. Each Jupyter notebook is dedicated to a concrete computer vision task. For example, one notebook explains how to train a CNN to detect animals in images, while another details all the steps to build a recognition system for self-driving cars, and so on.
As we will see in this section, these documents can either be studied directly, or they can be used as code recipes to run and reproduce the experiments presented in the book.
Study the Jupyter notebooks online
If you simply want to go through the code and results provided, you can directly access them online in the book's GitHub repository. Indeed, GitHub is able to render Jupyter notebooks and to display them as static web pages.
However, the GitHub viewer ignores some style formatting and interactive content. For the best online viewing experience, we recommend using instead Jupyter nbviewer (https://nbviewer.jupyter.org), an official web platform you can use to read Jupyter notebooks uploaded online. This website can be queried to render notebooks stored in GitHub repositories. Therefore, the Jupyter notebooks provided can also be read at the following address: https://nbviewer.jupyter.org/github/PacktPublishing/Hands-On-Computer-Vision-with-TensorFlow-2.
Run the Jupyter notebooks on your machine
To read or run these documents on your machine, you should first install Jupyter Notebook. For those who already use Anaconda (https://www.anaconda.com) to manage and deploy their Python environments (as we will recommend in this book), Jupyter Notebook should be directly available (as it is installed with Anaconda). For those using other Python distributions and those not familiar with Jupyter Notebook, we recommend having a look at the documentation, which provides installation instructions and tutorials (https://jupyter.org/documentation).
Once Jupyter Notebook is installed on your machine, navigate to the directory containing the book's code files, open a terminal, and execute the following command:
$ jupyter notebook
The web interface should open in your default browser. From there, you should be able to navigate the directory and open the Jupyter notebooks provided, either to read, execute, or edit them.
Run the Jupyter notebooks in Google Colab
For those who wish to run the Jupyter notebooks themselves—or play with new experiments—but do not have access to a powerful enough machine, we recommend using Google Colab, also named Colaboratory (https://colab.research.google.com). It is a cloud-based Jupyter environment, provided by Google, for people to run compute-intensive scripts on powerful machines. You will find more details regarding this service in the GitHub repository.
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781788830645_ColorImages.pdf.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, folder names, filenames, file extensions, pathnames, dummy URLs, and user input. Here is an example: "The .fit() method of the Model object starts the training procedure."
A block of code is set as follows:
import tensorflow as tf
x1 = tf.constant([[0, 1], [2, 3]])
x2 = tf.constant(10)
x = x1 * x2
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
neural_network = tf.keras.Sequential(
[tf.keras.layers.Dense(64),
tf.keras.layers.Dense(10, activation="softmax")])
Any command-line input or output is written as follows:
$ tensorboard --logdir ./logs
Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "You can observe the performance of your solution on the Scalars page of TensorBoard."