Skip to content

Instantly share code, notes, and snippets.

View Thimira's full-sized avatar

Thimira Amaratunga Thimira

View GitHub Profile
@Thimira
Thimira / resnet50_predict.py
Created September 3, 2017 08:35
How to use the ResNet50 model from Keras Applications trained on ImageNet to make a prediction on an image.
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input, decode_predictions
import numpy as np
model = ResNet50(weights='imagenet')
img_path = 'Data/Jellyfish.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)