Reputation: 4564
I am in full and bad surprise. Same program everything is perfect. I just slept and opened the Google colab today to run the program. This is my first ever deep learning program. It ran perfectly yesterday. But when I run today, it is giving a weird error. Need help. Why it is giving such error? How to solve it? Google colab screenshot:
Code:
#Step3: test_img_path: Location of the image we want the model to predict
test_img = image.load_img(test_img_path,target_size=(224,224))
#Step4: Deep learning models expect a batch of images represented by array
# At this stage we will have a processed image of size 224x224x3.
# Convert it to a batch of images denoted by nx224x224x3 where n denotes total images
# In this case, n=1
test_img_array = image.img_to_array(test_img)
# Convert the array to a batch
test_img_batch = np.expand_dims(test_img_array,axis=0)
#Step5: At the data level, an original image data is stored in the in terms of the pixels.
# Now, normalizing the image
nor_testimg = preprocess_input(test_img_batch)
#Step6: Import the model and input our test image
# Model here means, it is already trained by someone else and I don't have to do it again
# Moreover, they made their hardwork or trained model freely available to every on on the keras, we just download it
model = tf.keras.applications.resnet50.ResNet50()
#Step7: Lets see how and what the model would predict
predict_testimg = model.predict(nor_testimg)
# Decode the predictions
print(decode_predictions(predict_testimg,top=3)[0])
In the above code, tf.keras.applications.resnet50.ResNet50()
is the one causing the problem when I run it today. The same program ran successfully yesterday. Now, if I remove end brackets tf.keras.applications.resnet50.ResNet50
, it runs perfectly but raised an error in the next line of the code.
Upvotes: 0
Views: 245
Reputation: 1205
The issue is not with you and it lies in Keras as its trying to decode a string with utf 8. If I can get some more part of it might be able to help then
Upvotes: 1