[Python] Using tf.keras.utils.image_dataset_from_directory mismatches labels on the images

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    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?

    Continue reading...

Compartilhe esta Página