Evaluating our deep learning models

We will now evaluate the five different models we built so far by first testing them on a sample test image, then visualizing how a CNN model actually tries to analyze and extract features from the image, and finally by testing each model's performance on our test dataset. The code for this section is available in the Model Performance Evaluations.ipynb Jupyter Notebook in case you want to execute the code and follow along with the chapter. We have also built a nifty utility module called model_evaluation_utils, which we will be using to evaluate the performance of our deep learning models. Let's load up the following dependencies before getting started:

import glob 
import numpy as np
import matplotlib.pyplot as plt
from keras.preprocessing.image import load_img, img_to_array, array_to_img
from keras.models import load_model
import model_evaluation_utils as meu

%matplotlib inline

Once we have loaded up these dependencies, let's load up our models that we have saved so far:

basic_cnn = load_model('cats_dogs_basic_cnn.h5') 
img_aug_cnn = load_model('cats_dogs_cnn_img_aug.h5')
tl_cnn = load_model('cats_dogs_tlearn_basic_cnn.h5')
tl_img_aug_cnn = load_model('cats_dogs_tlearn_img_aug_cnn.h5') tl_img_aug_finetune_cnn =
load_model('cats_dogs_tlearn_finetune_img_aug_cnn.h5')

This helps us in retrieving all the five models we created in this chapter using various techniques and architectures.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.161.193