ItemList not ready yet?

Hello,

I wanted to take a Subset of a Dataset to train with less images by using the convenience functions in ItemList (specifically, MultiCategoryList , because I’m training with the planet dataset) but even following the documentation, I am getting some seemingly straightforward errors:

all_items = (ImageItemList.from_csv(path=Path(DATA_DIR), csv_name='train_v2.csv', suffix='.jpg', folder='train-jpg'))
items = all_items.random_split_by_pct(0.1).lists[1]
items = items.label_from_df(sep=' ')
data = items.databunch()

and I’m getting the error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-85-73d5cac79037> in <module>
----> 1 data = items.databunch()

~/anaconda3/envs/fastai/lib/python3.7/site-packages/fastai/data_block.py in __getattr__(self, k)
    409     def __getattr__(self,k:str)->Any:
    410         res = getattr(self.x, k, None)
--> 411         return res if res is not None else getattr(self.y, k)
    412 
    413     def __getitem__(self,idxs:Union[int,np.ndarray])->'LabelList':

AttributeError: 'MultiCategoryList' object has no attribute 'databunch'

I assume the development of ItemList is not done yet? If so, what would be the current fastai way to do this?

Nevermind, it was my bad. I used:

items = (ImageItemList.from_csv(Path(DATA_DIR), 'train_v2.csv', suffix='.jpg', folder='train-jpg')
                          .random_split_by_pct(0.2).lists[1]
                          .random_split_by_pct(0.2)
                          .label_from_df(sep=' '))
data = (items.databunch()
                 .normalize(imagenet_stats))
2 Likes