source99
(Matthew Rosenthal)
November 13, 2018, 12:51am
1
Hi,
I have a dataframe that has a list of filenames and a target column but I can’t seem to figure out how to use label_from_df.
Is the filename in the df supposed to have the full path or just the path after the “path”?
Is the filename in the df supposed to have the filename extension or just the part without the extension (“suffix”)?
Can label_from_df be used for regression or only for classification?
This is my df:
this is how i am trying to call label_from_df:
path = Path(‘/home/matt/Dropbox (Centosette)/transfer/regression/test1/images’)
data = (ImageFileList.from_folder(path)
.label_from_df(df, ‘filename’, ‘y_coordinate’)
)
source99
(Matthew Rosenthal)
November 15, 2018, 4:57am
2
It’s a good thing no one answered this yesterday cuz however its supposed to be used its changed since then!
source99
(Matthew Rosenthal)
November 15, 2018, 5:37am
3
I’m making some progress with this code:
data = (ImageItemList.from_df(df, path, col='filename', suffix=".png")
.random_split_by_pct()
.label_from_df('y_coordinate')
.databunch()
)
my dataframe has 2 columns. 1 named filename and 1 named y_coordinate with my regression target.
2 Likes
sam2
(Sam)
November 15, 2018, 6:11pm
4
@source99 , AFAIK label_from_df is meant for classification
source99
(Matthew Rosenthal)
November 15, 2018, 6:12pm
5
I was able to get it working with regression because my target column is type float.
sam2
(Sam)
November 15, 2018, 6:20pm
6
@source , Ah! good to know!! Thanks for sharing
I hope that in docs.fast.ai they clean up terminology label/class/category and now target