Hi there! I am trying to use ImageDataBunch loading from a dataframe for a regression task but I get:
TypeError: __init__() got an unexpected keyword argument 'label_delim'
This is in a clean environment with fastai==1.0.46 and pandas==0.24.1.
You can repoduce by running:
labels = np.ones(10)
fn = [str(i) for i in range(10)]
df = pd.DataFrame(data={'name':fn, 'label': labels})
data = ImageDataBunch.from_df('', df, label_col='label', fn_col='name')
This code works (returns pathing error since images in path do not exist) if labels are cast as int but then the learner becomes a classifier. Any float columns passed to the label_col returns the same error, so it is not possible to use .from_df with ImageDataBunch for regression.
I am having the same problem. I am trying to do a regression task (input data is images and labels are floats) using a csv file that relates the image file name to the label. I tried ImageDataBunch.from_csv and I tried importing the csv as a dataframe and ImageDataBunch.from_df.
As you pointed out, I can’t use DataBunch for regression with floats so I tried it with ImageList as suggested by Yin Huang. However, I get:
relating to the .from_df(). I even tried adding an after_open arguement (with a function that does nothing) but I got the exact same error. I also tried importing the data as a PointsItemList as suggested in https://docs.fast.ai/tutorial.inference.html#A-regression-example
but I get the same TypeError saying that I’m missing a required keyword-only argument of "after_open’
Has anyone else encountered this or know what I should do?
p.s. I’m running fastai 1.0.51 using a Jupyter Notebook through Gradient on PaperSpace