Hello, running the head-pose notebook, without any modification, in the part of the data object creation:
data = (ImageItemList.from_folder(path)
.split_by_valid_func(lambda o: o.parent.name=='13')
.label_from_func(get_ctr, label_cls=PointsItemList)
.transform(get_transforms(), tfm_y=True, size=(120,160))
.databunch().normalize(imagenet_stats)
)
I got the following error:
ValueError Traceback (most recent call last)
<ipython-input-12-7a03611beb5d> in <module>
1 data = (ImageItemList.from_folder(path)
2 .split_by_valid_func(lambda o: o.parent.name=='13')
----> 3 .label_from_func(get_ctr, label_cls=PointsItemList)
4 .transform(get_transforms(), tfm_y=True, size=(120,160))
5 .databunch().normalize(imagenet_stats)
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in _inner(*args, **kwargs)
294 self.valid = fv(*args, **kwargs)
295 self.__class__ = LabelLists
--> 296 self.process()
297 return self
298 return _inner
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in process(self)
330 def process(self):
331 xp,yp = self.get_processors()
--> 332 for i,ds in enumerate(self.lists): ds.process(xp, yp, filter_missing_y=i==0)
333 return self
334
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in process(self, xp, yp, filter_missing_y)
392 def process(self, xp=None, yp=None, filter_missing_y:bool=False):
393 "Launch the preprocessing on `xp` and `yp`."
--> 394 self.y.process(yp)
395 if filter_missing_y and (getattr(self.x, 'filter_missing_y', None)):
396 filt = array([o is None for o in self.y])
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in process(self, processor)
46 if processor is not None: self.processor = processor
47 self.processor = listify(self.processor)
---> 48 for p in self.processor: p.process(self)
49 return self
50
/opt/anaconda3/lib/python3.6/site-packages/fastai/data_block.py in process(self, ds)
20 def __init__(self, ds:Collection=None): self.ref_ds = ds
21 def process_one(self, item:Any): return item
---> 22 def process(self, ds:Collection): ds.items = array([self.process_one(item) for item in ds.items])
23
24 class ItemList():
/opt/anaconda3/lib/python3.6/site-packages/fastai/core.py in array(a, *args, **kwargs)
218 "Same as `np.array` but also handles generators"
219 if not isinstance(a, collections.Sized): a = list(a)
--> 220 return np.array(a, *args, **kwargs)
221
222 class Category(ItemBase):
`ValueError: only one element tensors can be converted to Python scalars`
I guess is due to the get_ctr
function which returns a tensor with 2 components. How could could be managed? Or should I update any library?