ImageList not defined in fastai v2

I am working on a Jupyter notebook that has the most recent package installed.

fastbook.version = 0.0.16
fastai.version = 2.1.15

I am trying to create a simple ImageList item using the .from_df function that points to a df with 2 columns. The first column is the path to the image and the second column contains label id for that image. However, I get the NameError: name ‘ImageList’ is not defined.

Now, I know there are several threads that address this issue in the past. But none of the solutions apply today. The past solutions were to switch from “ImageItemList” to “ImageList”, but neither work for me.

I’m also confused that in the fastai1 docs, in the core folder there is documentation for data_block that covers the ItemList class, but in the fastai2 docs, I can’t find the ItemList class, or any similar new class.

Code Snippet:
image_data = (ImageList.from_df(df)
.transform(tfms, size=128))

NameError: name ‘ImageList’ is not defined

Also, running just “ItemList()” gives me the same error (ItemList not defined)

I would appreciate any help or guidance!

  • John

For additional context, I’m trying to follow the process laid out in this article. I want to incorporate image metadata into the FC layer of the CNN, so I need to create a databunch that contains both image and tabular data.

That article was written in fastai version 1. You should pip install fastai==1.0.61

I’ll give it a try, but was hoping to use the current version. Do you know if there is any way to create a databunch with both image and tabular data using the most updated API?

@jetcalz07 Were you able to find how to translate v1 code into v2?