Skip to content

Instantly share code, notes, and snippets.

@kentsommer
Created March 21, 2017 01:14
Show Gist options
  • Save kentsommer/48e43bf7badd7243849d01ba1e76e3cf to your computer and use it in GitHub Desktop.
Save kentsommer/48e43bf7badd7243849d01ba1e76e3cf to your computer and use it in GitHub Desktop.
classification test
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))
@preet01
Copy link

preet01 commented May 29, 2018

Install the latest keras version. The problem is solved over there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment