Lesson 3 planet notebook: can't call label_from_df(sep=' ')

When I run the foll. code

np.random.seed(42)
src = (ImageItemList.from_csv(path, ‘train_v2.csv’, folder=‘train-jpg’, suffix=’.jpg’)
.random_split_by_pct(0.2)
.label_from_df(sep=’ '))

The error is
NameError: name ‘ImageItemList’ is not defined

I assume ImageItemList has been changed to ImageList. I tried with ImageList,:

src = (ImageList.from_csv(path, ‘train_v2.csv’, folder=‘train-jpg’, suffix=’.jpg’)
.split_by_rand_pct(0.2)
.label_from_df(sep=’ '))

Now the error is with label_from_df(sep=’ ')
It says:
TypeError: init() got an unexpected keyword argument 'sep’

The same error has occurred.
But I solved this problem.

You can run this code:

np.random.seed(42)
src = (ImageList.from_csv(path, ‘train_v2.csv’, folder=‘train-jpg’, suffix=’.jpg’)
.random_split_by_pct(0.2)
.label_from_df(label_delim=’ '))

reference: https://github.com/fastai/course-v3/blob/master/nbs/dl1/lesson3-planet.ipynb

2 Likes

Thank u i was looking that :slight_smile: :slight_smile: