Created
February 13, 2018 18:33
-
-
Save daniellerch/02979def8d10bd239b475f921418271e to your computer and use it in GitHub Desktop.
Keras/InceptionResNetV2
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
from keras.applications.inception_resnet_v2 import InceptionResNetV2 | |
from keras.preprocessing import image | |
from keras.applications.inception_resnet_v2 import preprocess_input, decode_predictions | |
import numpy as np | |
model = InceptionResNetV2(weights='imagenet') | |
img_path = 'aguila.jpg' | |
img = image.load_img(img_path, target_size=(224, 224)) | |
x = image.img_to_array(img) | |
x = np.expand_dims(x, axis=0) | |
x = preprocess_input(x) | |
preds = model.predict(x) | |
print 'Prediction:', decode_predictions(preds, top=1)[0][0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment