I tried installing Pytorch and then torchvision and then fastai developer version.
Tested importing torch and torchvision and then ran the Lesson 1 notebook.
But it fails in this method.
‘’‘data = ImageDataBunch.from_name_re(path_img, fnames, pat, ds_tfms=get_transforms(), size=224)
data.normalize(imagenet_stats)’’’
In one thread found putting no_worker=0 in windows works, so i changed the above as.
data = ImageDataBunch.from_name_re(path_img, fnames, pat, ds_tfms=get_transforms(), size=224,num_workers=0)
But the error remains same…Please find the message below.
AttributeError Traceback (most recent call last)
in
----> 1 data = ImageDataBunch.from_name_re(path_img, fnames, pat, ds_tfms=get_transforms(), size=224,num_workers=0)
2 data.normalize(imagenet_stats)
D:\MyWork\Document\GitHub\course-v3\nbs\dl1\fastai\vision\data.py in from_name_re(cls, path, fnames, pat, valid_pct, test, **kwargs)
330 pat = re.compile(pat)
331 def _get_label(fn): return pat.search(str(fn)).group(1)
–> 332 return cls.from_name_func(path, fnames, _get_label, valid_pct=valid_pct, test=test, **kwargs)
333
334 def batch_stats(self, funcs:Collection[Callable]=None)->Tensor:
D:\MyWork\Document\GitHub\course-v3\nbs\dl1\fastai\vision\data.py in from_name_func(cls, path, fnames, label_func, valid_pct, test, **kwargs)
323 @classmethod
324 def from_name_func(cls, path:PathOrStr, fnames:FilePathList, label_func:Callable, valid_pct:int=0.2, test:str=None, **kwargs):
–> 325 labels = [label_func(o) for o in fnames]
326 return cls.from_lists(path, fnames, labels, valid_pct=valid_pct, test=test, **kwargs)
327
D:\MyWork\Document\GitHub\course-v3\nbs\dl1\fastai\vision\data.py in (.0)
323 @classmethod
324 def from_name_func(cls, path:PathOrStr, fnames:FilePathList, label_func:Callable, valid_pct:int=0.2, test:str=None, **kwargs):
–> 325 labels = [label_func(o) for o in fnames]
326 return cls.from_lists(path, fnames, labels, valid_pct=valid_pct, test=test, **kwargs)
327
D:\MyWork\Document\GitHub\course-v3\nbs\dl1\fastai\vision\data.py in _get_label(fn)
329 def from_name_re(cls, path:PathOrStr, fnames:FilePathList, pat:str, valid_pct:int=0.2, test:str=None, **kwargs):
330 pat = re.compile(pat)
–> 331 def _get_label(fn): return pat.search(str(fn)).group(1)
332 return cls.from_name_func(path, fnames, _get_label, valid_pct=valid_pct, test=test, **kwargs)
333
AttributeError: ‘NoneType’ object has no attribute ‘group’