a guest Mar 20th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- 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))
RAW Paste Data