I am working on an image dataset that has 12 classes.
Therefore, I have split the dataset manually (by hand) into three subfolders i.e. train, valid, and test in 70%, 15%,
and 15%
respectively. However, I want to split them by code for train, valid, and test 70%, 15%,
and 15%
and transfer them to the subfolder in a train, valid, and test folder
#--------------------------------------------------Train--------------------------------
train = ImageDataGenerator()
train_generator = tf.keras.preprocessing.image.ImageDataGenerator(rescale= 1./255, rotation_range=90, width_shift_range=0.1,height_shift_range=0.1, shear_range=0.2, zoom_range=0.2,
horizontal_flip=True, fill_mode="nearest")
train_data = train_generator.flow_from_directory(directory="/content/dataset/train",target_size=IMAGE_SHAPE , color_mode="rgb" , class_mode='categorical', batch_size=BATCH_SIZE , shuffle = True )
#--------------------------------------------------valid-------------------------------
valid = ImageDataGenerator()
validation_generator = tf.keras.preprocessing.image.ImageDataGenerator(rescale=1./255)
valid_data = validation_generator.flow_from_directory(directory="/content/dataset/validation", target_size=IMAGE_SHAPE , color_mode="rgb" , class_mode='categorical' , batch_size=BATCH_SIZE , shuffle = True )
#--------------------------------------------------Test---------------------------------------------
test = ImageDataGenerator()
test_generator = tf.keras.preprocessing.image.ImageDataGenerator(rescale=1./255)
test_data = test_generator.flow_from_directory(directory="/content/dataset/test",target_size=IMAGE_SHAPE , color_mode="rgb" , class_mode='categorical' , batch_size=1 , shuffle = False )
test_data.reset()
It is possible to write the code for spiting them send it to the 3 several folders?