Closed geg00 closed 5 years ago
Guess you've fixed it by now but just in case. For me it worked by changing the regex patter: from: pat = re.compile(r'/([^/]+)\d+.jpg$') to: pat = re.compile(r'\([^\]+)\d+.jpg$') (just a windows vs linux path sep)
Running: print(str(fnames[0])) re.search(r'\([^\]+)_\d+.jpg$',str(fnames[0])).group(1)
Should give you: C:\Users\USER.fastai\data\oxford-iiit-pet\images\Abyssinian_1.jpg 'Abyssinian'
pat = re.compile(r'\\([^\\]+)_\d+.jpg$') #for windows
This code seems to work on both Linux and Windows:
pat = re.compile(r'[/\\]([^/\\]+)\d+.jpg$')
Basically look for either forward or backward slash.
'1.0.35.dev0' When running lesson1-pets
c:\users\gerar\fastai\fastai\vision\data.py in _get_label(fn) 152 "Create from list of
fnames
inpath
with re expressionpat
." 153 pat = re.compile(pat) --> 154 def _get_label(fn): return pat.search(str(fn)).group(1) 155 return cls.from_name_func(path, fnames, _get_label, valid_pct=valid_pct, **kwargs) 156AttributeError: 'NoneType' object has no attribute 'group'