Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. from keras.applications.inception_v3 import *
  2. from keras.preprocessing import image
  3. from keras.applications.imagenet_utils import decode_predictions
  4. from keras import backend as K
  5. import numpy as np
  6.  
  7. model = InceptionV3(weights='imagenet')
  8.  
  9. img_path = 'apple.jpg'
  10. img = image.load_img(img_path, target_size=(299, 299))
  11. x = image.img_to_array(img)
  12. x = np.expand_dims(x, axis=0)
  13. x = preprocess_input(x)
  14.  
  15. preds = model.predict(x)
  16. print('Predicted:', decode_predictions(preds))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement