在 jupyter notebook 中运行 Roboflow 图像分类的代码时,我和我的团队不断收到相同的错误。
如果有人可以帮助我们更好地理解这个错误的含义以及为什么我们不断得到它,那将不胜感激!
这是代码:
data = ImageDataLoaders.from_folder(path, size=220, num_workers=4).normalize(imagenet_stats)
这是错误:
AttributeError Traceback (most recent call last)
/var/folders/mf/sm4q6hh96j5bq3f327w8px0m0000gn/T/ipykernel_42187/1206335196.py in <module>
----> 1 data = ImageDataLoaders.from_folder(path, size=220, num_workers=4).normalize(imagenet_stats)
~/opt/anaconda3/envs/pytorch1/lib/python3.7/site-packages/fastcore/basics.py in __getattr__(self, k)
387 if self._component_attr_filter(k):
388 attr = getattr(self,self._default,None)
--> 389 if attr is not None: return getattr(attr,k)
390 raise AttributeError(k)
391 def __dir__(self): return custom_dir(self,self._dir())
~/opt/anaconda3/envs/pytorch1/lib/python3.7/site-packages/fastcore/basics.py in __getattr__(self, k)
387 if self._component_attr_filter(k):
388 attr = getattr(self,self._default,None)
--> 389 if attr is not None: return getattr(attr,k)
390 raise AttributeError(k)
391 def __dir__(self): return custom_dir(self,self._dir())
~/opt/anaconda3/envs/pytorch1/lib/python3.7/site-packages/fastai/data/core.py in __getattr__(self, k)
333 return res if is_indexer(it) else list(zip(*res))
334
--> 335 def __getattr__(self,k): return gather_attrs(self, k, 'tls')
336 def __dir__(self): return super().__dir__() + gather_attr_names(self, 'tls')
337 def __len__(self): return len(self.tls[0])
~/opt/anaconda3/envs/pytorch1/lib/python3.7/site-packages/fastcore/transform.py in gather_attrs(o, k, nm)
163 att = getattr(o,nm)
164 res = [t for t in att.attrgot(k) if t is not None]
--> 165 if not res: raise AttributeError(k)
166 return res[0] if len(res)==1 else L(res)
167
AttributeError: normalize```