def predict(model, img):
#Flatten it
image = np.array(img).flatten()
# float32
image = image.astype('float32')
# normalize it
image = image / 255
# reshape for NN
rimage = image.reshape(1, img_rows, img_colms,img_channels)
# Now feed it to the NN, to fetch the predictions
clas = model.predict(rimage)
#prob_array = model.predict_proba(rimage)
return clas
评论列表
文章目录