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)
.split_by_rand_pct()
.label_from_df(label_delim=’ ')
.databunch())

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.
Regards
Bhawna

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

Screenshot%20from%202019-03-19%2018-37-47

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!
Bhawna

1 Like