Using datablock api to create databunch

Hello everyone
I am creating a databunch using Image List. Following is the code. Please help me identify where am I going wrong?
data = (ImageList.from_df(df1, path)
.label_from_df(label_delim=’ ')

This is the glimpse of the dataframe(df1)

and these are the contents of path.

I am getting an error that “argument 1 must be an iterator”

Please help.

First, try adding each item individually. E.g.

data = ImageList.
data = data.split_by_rand_pct()…

Can you tell me which specifically fails?

1 Like

Hi @muellerzr

it fails at label_from_df(label_delim=' ')

Are you sure that there is a space between what you want your labels to be? In the df?

1 Like


Sorry, I uploaded a different screenshot of dataframe’s image. Please see this.

Can you try label_from_df(sep=' ') ? Athough, I’m not too sure that’s the error though. Also try from_csv instead of from_df. Even I used to struggle with creating data bunches when I was getting started. Keep playing around with the data block api and reading other people’s notebooks to get a good idea about it.
Check this notebook of mine if it helps.

1 Like

Hi @dipam7 I am still struggling with the same error. But I will get through it soon. I tried from_csv too but failed. Also the keyword sep has been updated to label_delim
Thank you for responding. Cheers!

1 Like