# Introduction¶

Previously in a Kaggle Kernel, I discovered the Class Activate Map (CAM) using a VVG16. In this Notebook, I'll explore the CAM of Inception V3 in the prediction of few images (including the discovery from University of Tubingen regarding the imapct of the texture on the prediction (link))

In [1]:
import numpy as np

import tensorflow as tf
from tensorflow.keras.applications.inception_v3 import decode_predictions

import matplotlib.pyplot as plt

from scipy.stats import entropy
from numpy.linalg import norm

from PIL import Image
import cv2


# Dataset preparation¶

Very simple step here. Let's load some images, resize them to 299x299 and scale them in a range of [0, 1]

In [2]:
test_image1 = Image.open("boat1.jpg")
test_image2 = Image.open("boat2.jpg")
test_image3 = Image.open("boat3.jpg")
test_image4 = Image.open("cat.jpg")
test_image5 = Image.open("voiture.jpg")
test_image6 = Image.open("voiture2.jpg")

In [3]:
test_image1 = test_image1.resize((299, 299))
test_image2 = test_image2.resize((299, 299))
test_image3 = test_image3.resize((299, 299))
test_image4 = test_image4.resize((299, 299))
test_image5 = test_image5.resize((299, 299))
test_image6 = test_image6.resize((299, 299))

In [4]:
fig, axes = plt.subplots(2, 3, figsize=(20,12))
axes[0, 0].imshow(test_image1)
axes[0, 1].imshow(test_image2)
axes[0, 2].imshow(test_image3)
axes[1, 0].imshow(test_image4)
axes[1, 1].imshow(test_image5)
axes[1, 2].imshow(test_image6)
plt.show()