These are the steps to do inside split_data
:
- For each file in source directory, if the file is of length 0, report the file as being skipped else add it to
all_files
. - Once you have valid images files, shuffle and split into training and test sets.
- Copy training and testing files to respective directories.
Please pay attention to indentation. You are doing steps 2 and 3 from inside step 1, which is incorrect.