August 2018
Intermediate to advanced
438 pages
12h 3m
English
We will now load a sample image that is not a part of any of our datasets and try to see the predictions of our different models. I will use an image of my pet cat here, so this will be interesting! Let's load up the sample image and a few basic configurations:
# basic configurations IMG_DIM = (150, 150) input_shape = (150, 150, 3) num2class_label_transformer = lambda l: ['cat' if x == 0 else 'dog' for x in l] class2num_label_transformer = lambda l: [0 if x == 'cat' else 1 for x in l] # load sample image sample_img_path = 'my_cat.jpg' sample_img = load_img(sample_img_path, target_size=IMG_DIM) sample_img_tensor = img_to_array(sample_img) sample_img_tensor = np.expand_dims(sample_img_tensor, axis=0) ...
Read now
Unlock full access