def split_data(SOURCE_DIR, TRAINING_DIR, VALIDATION_DIR, SPLIT_SIZE):
“”"
Splits the data into train and test sets
Args:
SOURCE_DIR (string): directory path containing the images
TRAINING_DIR (string): directory path to be used for training
VALIDATION_DIR (string): directory path to be used for validation
SPLIT_SIZE (float): proportion of the dataset to be used for training
Returns:
None
“”"
[Code removed by Moderator]
Hello @S.Dheeraj ,
Welcome to the community!!
Kindly specify your error and don’t post your codes publicly on discourse. As per the community guidelines, learners are not supposed to post code solutions or their notebooks publicly on community.Learners can create topics or posts discussing about errors or screenshots of errors or copy pasting errors.Then, to understand the specific problem of learner, if needed, mentors ask the learners to send their notebook personally via direct message.Then mentors and learners can explain and discuss about it on community.
So send me your notebook via dm such that I can check where it went wrong.By clicking on the profile picture, you will see an option to message.There you can attach your notebook. Then we can discuss the issues here, under the topic you created.
With regards,
Nilosree Sengupta
HELLO @S.Dheeraj ,
I have gone through your notebook.
-
Under the function def split_data(SOURCE_DIR, TRAINING_DIR, VALIDATION_DIR, SPLIT_SIZE):
You just have to work with the parameters.
Don’t think about cats and dogs separately here.You don’t need to provide the paths of the parameters and split_size= 0.9 here, because in the next cell, under # Test your split_data function , directories are given and the split_size= 0.9 is taken to test your code.
Hence, remove the last few lines of code from your function def split_data. This will fix your problem.
-
Btw under the function def create_train_val_dirs(root_path):
HINT is given:
Use os.makedirs to create your directories with intermediate subdirectories
Don’t hardcode the paths. Use os.path.join to append the new directories to the root_path parameter
But you have hardcoded it. Fix this too.
WIth regards,
Nilosree Sengupta