I just finished using the wildfire model and I am trying to use it. I have been using the trained model together with the training images so there shouldn’t be any difficulty. The problem is that the following code appears to predict fire, no matter what image I put into it. Where am I going wrong?
from PIL import Image import numpy as np from tensorflow import keras #Loads the model path_to_model = "d:/Perceptilabs/Exported Models/Wildfires/Model 3" model = keras.models.load_model(path_to_model) #Load an image; requires (1, 250, 250, 3) image = Image.open("C:/Users/USER/Desktop/abc195.jpg") image = np.expand_dims(image, axis=0) #Makes a prediction prediction1 = model(image) print('The prediction is ',(np.asarray(prediction1['labels'])))
The prediction is [b’fire’]
Thanks in advance for any help.