'"AttributeError: normalize" Error when running Roboflow
When running the code for the Roboflow image classification in jupyter notebook, my team and I keep getting the same error.
If someone could please help us get a better understanding of what this error means and why we keep getting it that would be very much appreciated!!
This is the code:
data = ImageDataLoaders.from_folder(path, size=220, num_workers=4).normalize(imagenet_stats)
And this is the error:
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```
Solution 1:[1]
This isn't a Roboflow error response, its a Python error response which occurs when an attribute reference or assignment fails.
Example: Assigning x=10 then attempting x.append() will throw an AttributeError because the variable is an integer type it does not support the append method.
I would start by taking a look at the datatype you are attempting to normalize and see if .normalize() is supported for that datatype
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
