Created
August 15, 2019 07:48
-
-
Save dipanjanS/fadd5c5575e541c8ea524610874a4799 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load sample images | |
X, y = shap.datasets.imagenet50() | |
# load sample cat image for test | |
IMAGE_PATH = './cat2.jpg' | |
img = keras.preprocessing.image.load_img(IMAGE_PATH, target_size=(224, 224)) | |
img = keras.preprocessing.image.img_to_array(img) | |
# select 3 other sample images for test | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
to_predict = np.array([X[28], X[35], X[46], img]) | |
fig, ax = plt.subplots(1, 4, figsize=(18, 10)) | |
ax[0].imshow(to_predict[0]/255.) | |
ax[1].imshow(to_predict[1]/255.) | |
ax[2].imshow(to_predict[2]/255.) | |
ax[3].imshow(to_predict[3]/255.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment