I have a CNN built in Keras. I have saved it and am now using the
model.predict() function to make predictions from it. Whenever I run the following code,
def prediction(path): import keras from keras.preprocessing.image import load_img, img_to_array from keras.models import load_model import PIL import numpy as np img = load_img(path) img = img.resize((224, 224)) img = img_to_array(img) img = img.reshape( -1,224, 224,3) model = load_model('model1.h5') pred = model.predict(img) return pred print(prediction('/path/to/image/')
I get an output like this:
[[7.578206e-37 1.000000e+00 0.000000e+00 0.000000e+00]]
I am doing transfer learning using resnet50 with imagenet weights and here is the
I have 4 classes. How do I find out where each prediction belongs?
I have looked here as well but it doesn't seem to help me.