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()
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.
Let me know any more questions