I'm trying to show images from my dataset. But on imshow() function I have this error. 'Image data of dtype object cannot be converted to float'
This is my code:
val_ds = tf.keras.utils.image_dataset_from_directory(
'/media/Tesi/',
validation_split=0.2,
subset="validation",
seed=123,
image_size=(360, 360),
batch_size=18)
probability_model = tf.keras.Sequential([model,
tf.keras.layers.Softmax()])
predictions = probability_model.predict(val_ds)
predictions[0]
plt.figure(figsize=(10,10))
for i in range(25):
plt.subplot(5,5,i+1)
plt.xticks([])
plt.yticks([])
plt.grid(False)
plt.imshow(val_ds, cmap=plt.cm.binary)
plt.xlabel(class_names[predictions[i]])
plt.show()
Can I solve it? Thank you, Best regards