Load images with custom labels

Hi,
I have the following structure; each directory contains 6 images; the name of each directory refers to a list of 4 numeric labels that I can bring for a text file;
for example
directory name: 2kqPuht5jTg.002
labels : [0.3, 0.21, 0.8, 0.6]

12548

How can I use flow_from_directory (ImageDataGenerator) to load images with their labels?
Thank you

Hi @youb, As flow_from_directory was deprecated in the latest version of Tensorflow you can use
tf.keras.utils.image_dataset_from_directory and for labels argument you can pass values such as – If value is inferred (labels are generated from the directory structure), None (no labels), or a list/tuple of integer labels of the same size as the number of image files found in the directory. Thank You.

1 Like

The problem here, is that we don’t have a class label; the name of directory that contains images refers to a list 5 float numbers.

I don’t think if this image_dataset_from_directory will work in that case.
Thank you