Commit 661c74f3 authored by mihaivanea's avatar mihaivanea
Browse files

Started learning about resnet50.

parent e35890fa
#!/vol/bitbucket/mv1315/urop/venv/bin/python3.5
import numpy as np
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input, decode_predictions
model = ResNet50(weights='imagenet')
img_path = "./tiger.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)
#decode the output into (class, description, probability)
preds = model.predict(x)
print("Predicted:", str(decode_predictions(preds, top=3)[0]))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment