Thanks for you reply!
In the tabular example they don’t seem to import a csv. My ground truths are in a csv form.
When I run:
data = ImageDataBunch.from_folder(’./tmp’,ds_tfms = tfms, valid=‘test’, size=sz,bs=bs)
learn.data.valid_dl = data.valid_dl
log_preds, y = learn.TTA(ds_type=DatasetType.Valid)
I get:
IndexError: index 0 is out of bounds for axis 0 with size 0
I thought .valid was used for the validation and not the test phase.
The other thing I tried was to split my image in their respective class folder (0,1,2,3,4).
And think of the validation set as a test set we use to grade our model. Fast.AI will always (atleast right now) have an unlabeled test set. So we can get around this by overloading the validation set with our own test set, then we can call get_preds(), validate(), etc as we would. But unless we store that validation dataloader, we have lost it.
Let’s break it down. So instead of ImageDataBunch, let’s take a step back and go from an ImageList.from_df.
So we’ll start by using pandas to read our dataframe, df = pd.read_csv('mydf').
Now all a databunch is really doing is a series of steps:
Open our data
Split it
Label it
Separate them into batches and wrap into a databunch object.
So we can do the following:
il = ImageList.from_df(df, path, cols, folder).split_none()
Where path is our path to the folder, cols is what column our filename is located at with folder in front of them. We also choose to split_none() as we want it to just be one set.
ll = il.label_from_df(cols='mylabel')
Where ‘mylabel’ is whatever name your column has for it.
Finally we can do:
data = ll.databunch()
And now to get those predictions and accuracy, we go to our Learner we already created originally and have already trained:
learn.data.valid_dl = data.train_dl
learn.validate() or learn.get_preds()
and we can run either or of validate or get_preds on the validation set.
You can call either one of the items we generated above to ensure that everything is functioning properly in our databunch creation, make sure everything is labeled properly, etc.