load saved model

Solutions on MaxInterview for load saved model by the best coders in the world

showing results for - "load saved model"
Abia
13 Jan 2018
1from keras.models import load_model
2model = load_model('my_model.h5')
3
Lilou
27 Jan 2020
1# compile the model in order to make predictions
2model.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
3
Paloma
11 Jul 2020
1#Now you can predict results for a new entry image.
2
3from keras.preprocessing import image
4
5test_image = image.load_img(imagePath, target_size = (64, 64)) 
6test_image = image.img_to_array(test_image)
7test_image = np.expand_dims(test_image, axis = 0)
8
9#predict the result
10result = model.predict(test_image)
11