I stored a model using model.save('model') after this tutorial:
https://towardsdatascience.com/keras-transfer-learning-for-beginners-6c9b8b7143e
The labels are taken from the directory itself. Now I would like to load it and do a prediction on an image using the following code:
import numpy as np
import tensorflow as tf
from tensorflow import keras
from keras.preprocessing import image
new_model = keras.models.load_model('./model/')
# Check its architecture
new_model.summary()
with image.load_img('testpics/mypic.jpg') as img: # , target_size=(32,32))
img = image.img_to_array(img)
img = img.reshape((1,) + img.shape)
# img = img/255
# img = img.reshape(-1,784)
img_class=new_model.predict(img)
prediction = img_class[0]
classname = img_class[0]
print("Class: ",classname)
Sadly the output is just
Class: [1.3706615e-03 2.9885881e-03 1.6783881e-03 3.0293325e-03 2.9168031e-03 7.2344812e-04 2.0196944e-06 2.0119224e-02 2.2996603e-04 1.1960276e-05 3.0794670e-04 6.0808496e-05 1.4892215e-05 1.5410941e-02 1.2452166e-04 8.2580920e-09 2.4049083e-02 3.1140331e-05 7.4609083e-01 1.5793210e-01 2.4283256e-03 1.5755130e-04 2.4227127e-03 2.2325735e-07 7.2101393e-06 7.6298704e-03 2.0922457e-04 1.2269774e-03 5.5882465e-06 2.4516811e-04 8.5745640e-03]
And I cannot figure out how to reload the labels... could someone help me out here :/?
