zach14c

kertas-load-save

Jun 11th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

training model
model.save('./flowers17_iv3_ft.h5')

predication:
from keras.preprocessing import image
from tensorflow import keras
from PIL import Image
import numpy as np

model = keras.models.load_model('flowers17_iv3_ft.h5')

img = Image.open('image_0946.jpg')
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
preds = model.predict(x)

Add Comment
Please, Sign In to add comment