Hello, I am trying to run the resnet model on custom images (transfer learning).
My directory tree looks like this:
train
class1
image1
image2
….
class2
image1
image2
…
val
class1
image1
image2
….
class2
image1
image2
…
And I created the tensorflow datasets like this:
train_ds = tf.keras.preprocessing.image_dataset_from_directory( “train”, labels=’inferred’, label_mode=’int’, image_size=(img_height, img_width), batch_size=batch_size)
val_ds = tf.keras.preprocessing.image_dataset_from_directory( “val”, labels=’inferred’, label_mode=’int’, image_size=(img_height, img_width), batch_size=batch_size)
Then I try to display the images for reference, running:
import matplotlib.pyplot as plt
class_names = val_ds.class_names
plt.figure(figsize=(10, 10)) for images, labels in val_ds.take(1): for i in range(30): ax = plt.subplot(5, 7, i + 1) plt.imshow(images[i].numpy().astype(“uint8”)) plt.title(class_names[labels[i]]) plt.axis(“off”)
But with val_ds, I get the error “Input is empty”, while with train_ds it actually shows the images. Anyone knows a possible reason why behind it? The dataset I am using is here – https://github.com/xuequanlu/I-Nema – and I have converted all the .tif images to .jpg.
Thanks in advance!
EDIT: here is the error log : https://pastecode.io/s/82hk68ar
submitted by /u/quaranprove
[visit reddit] [comments]