Evaluation model performance on test data

It's time now for the final test, where we literally test the performance of our models by making predictions on our test dataset. Let's load up and prepare our test dataset first before we try making predictions:

IMG_DIM = (150, 150) test_files = glob.glob('test_data/*') test_imgs = [img_to_array(load_img(img, target_size=IMG_DIM))                          for img in test_files] test_imgs = np.array(test_imgs) test_labels = [fn.split('/')[1].split('.')[0].strip() for fn in test_files] test_labels_enc = class2num_label_transformer(test_labels) test_imgs_scaled = test_imgs.astype('float32') test_imgs_scaled /= 255 print('Test dataset shape:', test_imgs.shape) Test dataset shape: (1000, 150, 150, 3)

Now that we have our scaled ...

Get Hands-On Transfer Learning with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.