Created
March 21, 2017 01:14
-
-
Save kentsommer/48e43bf7badd7243849d01ba1e76e3cf to your computer and use it in GitHub Desktop.
classification test
This file contains 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_v3 import * | |
from keras.preprocessing import image | |
from keras.applications.imagenet_utils import decode_predictions | |
from keras import backend as K | |
import numpy as np | |
model = InceptionV3(weights='imagenet') | |
img_path = 'apple.jpg' | |
img = image.load_img(img_path, target_size=(299, 299)) | |
x = image.img_to_array(img) | |
x = np.expand_dims(x, axis=0) | |
x = preprocess_input(x) | |
preds = model.predict(x) | |
print('Predicted:', decode_predictions(preds)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install the latest keras version. The problem is solved over there