Name 'ImageFileList' is not defined in fastai version 1.0.24

Hi,

I’m getting the following error when I’m trying to use ImageFileList

name 'ImageFileList' is not defined

Has this class been removed?

4 Likes

Its now called ImageItemList and extends ItemList instead of InputList

You can find examples for use of the new class in:

tests/test_vision_data_block.py

You can also create a data bunch for multiclass classification like this now (yey):

data = ImageDataBunch.from_df(PATH, df_labels, folder='train', suffix='.jpg', fn_col=0, label_col=1, sep=' ', ds_tfms=tfms, size=224)

Then if you want to make sure your target has multi class labels

type(data.train_ds.y)

2 Likes

Just want to put this out there, in case future readers bump into this issue.

ImageFileList is now called ImageItemList everywhere. I think it was working fine from Oct 30 to before Nov 13.

  • vision/data.py:
    class ImageFileList(InputList): :arrow_right: class ImageItemList(ItemList):
  • you’ll need to make that change in any notebooks that you’ve created too. Example from lesson3-planet.ipynb:
    src = (ImageFileList.from_folder(path)) :arrow_right: src = (ImageItemList.from_folder(path))

Unfortunately, we cannot edit the lesson video to reflect this change. If you are typing the code by following the video like I do, do note of this breaking changes (huge refactor of the data block API). I believe this change was released in fastai version 1.0.24 as you mentioned:

GitHub PR of this change

Datablock refactor

1 Like

seems it now change to ImageList

data = (ImageList.from_folder(path)
        .split_by_folder(train='train', valid='valid')
        .label_from_folder()
        .transform(get_transforms(do_flip=False),size=224)
        .databunch()
        .normalize() )
4 Likes