jfilter / split-folders

🗂 Split folders with files (i.e. images) into training, validation and test (dataset) folders
MIT License
414 stars 72 forks source link

group_by_prefix function finding multiple matches #39

Open yogiderek opened 2 years ago

yogiderek commented 2 years ago

I have a dataset with images in this format, image_1.png, image _2.png,.... image_130.png, ...., image_1301.png, image_1302.png, .... and my label files follow the same convention.

When I use group_prefix = 2, I get an error message to say it has found multiple matches for image_130.png. I am not a python expert but looking at your group_by_prefix function in splitfolders/split.py on line 190 it is checking to see if the file name startswith instead of checking for an exact match on the file name before the file extension. So for image_130.png, the function is going to find a match for image_130.png, image_1300,png, image_1301.png etc.