Created
August 15, 2019 07:54
-
-
Save dipanjanS/ca7cbe2ca20c45cb3706d9028e21caeb 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
# get imagenet id to label name mappings | |
url = "https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json" | |
fname = shap.datasets.cache(url) | |
with open(fname) as f: | |
class_names = json.load(f) | |
# make model predictions | |
predictions = model.predict(preprocess_input(to_predict.copy())) | |
# get prediction labels | |
predicted_labels = [class_names.get(str(pred)) for pred in np.argmax(predictions, axis=1)] | |
print(predicted_labels) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment