The splitfolders.ratio function takes two arguments: input_directory, the location of the dataset, and output_directory, the output location. The first argument is the location of the dataset, and the second argument is the location of the output. The splitfolders.ratio function calculates the ratio of the number of files in the input_directory to the number of files in the output_directory. The function then sets the ratio to the first argument (in this case, .7) plus the second argument (.2), and sets the group_prefix to None. If the input_directory does not exist, the splitfolders.ratio function creates it. If the output_directory does not exist, the splitfolders.ratio function creates it and sets the move parameter to True.
pip install split-folder
import splitfolders
splitfolders.ratio("{input_directory}", # The location of dataset
output="{output_directory}", # The output location
seed=42, # The number of seed
ratio=(.7, .2, .1), # The ratio of splited dataset
group_prefix=None, # If your dataset contains more than one file like ".jpg", ".pdf", etc
move=False # If you choose to move, turn this into True