Let's assume we have have two txt-files (train split and validation split) with filenames.
Now we want to use a tf.keras.preprocessing.image.ImageDataGenerator. In case of random split based on folder structure (each per class) the generator would be build like that.
TRAINING_DATA_DIR = str(data_root)
datagen_kwargs = dict(rescale=1. / 255, validation_split=0.2) # rescale and split
valid_datagen = tf.keras.preprocessing.image.ImageDataGenerator(**datagen_kwargs)
valid_generator = valid_datagen.flow_from_directory(
TRAINING_DATA_DIR,
subset="validation",
shuffle=True,
target_size=IMAGE_SHAPE)
But what about building the generation based on the two txt-files containing image names os the splits.
I found out that besides the flow_from_directory function there is a from_dataframe function but it still doesn't give an answer on the problem.
Any ideas are highly appreciated
Thanks