16.03.2021 Views

Advanced Deep Learning with Keras

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 1

Installing Keras and TensorFlow

Keras is not an independent deep learning library. As shown in Figure 1.1.1, it is

built on top of another deep learning library or backend. This could be Google's

TensorFlow, MILA's Theano or Microsoft's CNTK. Support for Apache's MXNet is

nearly completed. We'll be testing examples in this book on a TensorFlow backend

using Python 3. This due to the popularity of TensorFlow, which makes it a common

backend.

We can easily switch from one back-end to another by editing the Keras

configuration file .keras/keras.json in Linux or macOS. Due to the differences

in the way low-level algorithms are implemented, networks can often have different

speeds on different backends.

On hardware, Keras runs on a CPU, GPU, and Google's TPU. In this book,

we'll be testing on a CPU and NVIDIA GPUs (Specifically, the GTX 1060 and

GTX 1080Ti models).

Figure 1.1.1: Keras is a high-level library that sits on top of other deep learning models.

Keras is supported on CPU, GPU, and TPU.

Before proceeding with the rest of the book, we need to ensure that Keras

and TensorFlow are correctly installed. There are multiple ways to perform

the installation; one example is installing using pip3:

$ sudo pip3 install tensorflow

If we have a supported NVIDIA GPU, with properly installed drivers, and

both NVIDIA's CUDA Toolkit and cuDNN Deep Neural Network library,

it is recommended that we install the GPU-enabled version since it can accelerate

both training and prediction:

$ sudo pip3 install tensorflow-gpu

[ 3 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!