load saved model

34

from keras.models import load_model
model = load_model('my_model.h5')
#Now you can predict results for a new entry image.

from keras.preprocessing import image

test_image = image.load_img(imagePath, target_size = (64, 64)) 
test_image = image.img_to_array(test_image)
test_image = np.expand_dims(test_image, axis = 0)

#predict the result
result = model.predict(test_image)
# compile the model in order to make predictions
model.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])

Comments

Submit
0 Comments