Sir , i can not thank u enough for U help , it worked perfeclty.
knowing that i had to tweak the ‘PAT’ argument a bit , i used this one ,
pat = r’([\w\s.-]).[jpg]’
I also have the same problem
From /content/data/apples_1.jpg
/content/data/apples_2.png
/content/data/tomatoes_3.jpg
/content/data/tomatoes_4.jpg
I have been trying to extract “apples” and “tomatoes” with pat = r"/([^/]+)\d+.jpg$", but this doest seem to work. When I run the line data = ImageDataBunch.from_name_re(path_img, fnamess, pat,
ds_tfms=get_transforms(),
size=224, bs=bs )
I get the error : "Failed to find "re.compile(’/([^/]+)\d+.jpg$’)" in “/content/data/apples_30.jpeg”
Can somebody please help me out to find RE that works for .jpg and .png as well.