Chinmaya Tewari
Chinmaya Tewari

Reputation: 11

Using tf.keras.utils.image_dataset_from_directory mismatches labels on the images

Here's the code

train_dset = image_dataset_from_directory(
    directory = data_path,
    batch_size = 32,
    image_size = (256,256),
    label_mode = "int",
    shuffle = True
)

in data_path, I have

-> dataset
   |-> train
       |-> cats (having only cats images)
       |-> dogs (having only dogs images)
   |-> test
       |-> cats (having only cats images)
       |-> dogs (having only dogs images)

when i keep shuffle = True, labels are also shuffled, such as dog image is assigned cat label and vice versa. How to club label and image together and then shuffle the data, without any label mismatch?

Upvotes: 0

Views: 44

Answers (0)

Related Questions