Multi-label prediction: error specifying label_delim

Hello there!

I’m trying to use fast.ai for multi-label prediction from images using CNNs. The prediction task is essentially the same as in Lesson 3: Planet, but the dataset is my own and quite different.

I have a dataframe with filename and label information, and my folder with images.
Screenshot_2019-12-29%20Google%20Colaboratory

I can load the images and do the train-validation split perfectly fine.

np.random.seed(42)
data = ImageList.from_df(df, path=PNG_path, suffix=".png").split_by_rand_pct(0.25)

Then I try to add labels, which separated by a space in case there is more than one.

data = data.label_from_df(label_delim=' ')

However, this command does not work and gives the following error message: TypeError: init() got an unexpected keyword argument 'label_delim’

I have the same issue as here: https://forums.fast.ai/t/lesson-3-planet-label-delim-issue/36851. But I’m running version 1.0.59 on Google Colab, so updating should not be an issue.

Thanks for help. Here’s a screenshot of the whole thing:

Hi there,

Thanks for linking me… I should post solution to my post… Have you tried use key word sep instead of label_delim?

I think somewhere from 1.0.5x, the key word is sep = ’ ’ instead of label_delim = ’ '.

Best,

Thanks for your reply.

Unfortunately, sep = ' ' doesn’t work for me either, gives me the same error:
TypeError: __init__() got an unexpected keyword argument 'sep'

I wasn’t able to make it work, in the end I had to use a different library. :frowning:

Well, I just tested on Kaggle kernels, label_delim has no issue

Version: 1.0.59
Dataset: Planet_tiny

code to reproduce:

path = untar_data(URLs.PLANET_TINY)

data = (ImageList
            .from_csv(path,'labels.csv',folder='train',suffix='.jpg')
            .split_by_rand_pct()
            .label_from_df(cols='tags',label_delim=' ')
   )

Hope this clarifies the doubts.

Best,