Hello there! I am really really new to programming so I would appreciate any help on this question! I am using the tf.keras.preprocessing.image_dataset_from_directory() function to split my dataset into training, testing, and validation dataset but I am having some issues. To summarize, inside my “Dataset” folder, I have my FOUR classes of images that I want to split but when I include the directory path, it gives me files belonging to FIVE classes. It is including my “Dataset” folder as a class when really there are only FOUR classes inside my “Dataset” folder.
Here is the code for reference:
splitfolders.ratio(‘C:\Working\SCX\ALZ RESEARCH\Dataset\’, output=“output”, seed=1345, ratio=(.8, 0.1,0.1))
IMG_HEIGHT = 128
IMG_WIDTH = 128
train_ds = tf.keras.preprocessing.image_dataset_from_directory(
“./output/train”, seed=123, label_mode = “int”, image_size=(IMG_HEIGHT, IMG_WIDTH), batch_size=64)
test_ds = tf.keras.preprocessing.image_dataset_from_directory(
“./output/test”, seed=123, label_mode = “int”, image_size=(IMG_HEIGHT, IMG_WIDTH),batch_size=64)
val_ds = tf.keras.preprocessing.image_dataset_from_directory(
“./output/val”, seed=123, label_mode = “int”, image_size=(IMG_HEIGHT, IMG_WIDTH), batch_size=64)
And here is the output:
Found 5119 files belonging to 5 classes.
Found 642 files belonging to 5 classes.
Found 639 files belonging to 5 classes.
class_names = train_ds.class_names
[‘Dataset’, ‘Mild_Demented’, ‘Moderate_Demented’, ‘Non_Demented’, ‘Very_Mild_Demented’]
My apologies if my question is not formatted correctly, it’s my first time and I’m a new programmer. Any help is appreciated!