Created
August 15, 2019 09:17
-
-
Save dipanjanS/a9aa63c0cc322562f86aa77d52be76cf 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 imagenet id to class label mappings | |
import requests | |
response = requests.get('https://storage.googleapis.com/download.tensorflow.org/data/imagenet_class_index.json') | |
imgnet_map = response.json() | |
imgnet_map = {v[1]: k for k, v in imgnet_map.items()} | |
# make model predictions | |
img = tf.keras.applications.xception.preprocess_input(img) | |
predictions = model.predict(np.array([img])) | |
decode_predictions(predictions, top=5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment