Plotting and visualizing images from the directory
This section will describe how to read and visualize the downloaded images before they are preprocessed and fed into the neural network for training. This is an important step in this chapter because the images need to be visualized to get a better understanding of the image sizes so they can be accurately cropped to omit the background and preserve only the necessary facial features.
Getting ready
Before beginning, complete the initial setup of importing the necessary libraries and functions as well as setting the path of the working directory.
How to do it...
The steps are as follows:
- Download the necessary libraries using the following lines of code. The output must result in a line that says
Using TensorFlow backend
, as shown in the screenshot that follows:
%matplotlib inline from os import listdir from os.path import isfile, join import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np from keras.models import Sequential...