Help Understanding ImageList.from_df and DataBunch.from_df

I have a Pandas data frame in the form
path label
/research/myFolder/img1.png 0
/research/myFolder/img2.png 1
/research/myFolder/img3.png 0
/research/myFolder/img4.png 1
/research/myFolder/img5.png 1

and am having trouble understanding how to use DataBunch.from_df and ImageList.from_df to process my data.

I am using fastai version ‘1.0.61’.

Any help you can provide would be greatly appreciated :slight_smile:

Fastai has a datablock API, that we can use to manage each step of the data creation process. In that, you first create a list of your data(images), using ImageList class, then split the data, then label the data, then add transforms, and so on, and then finally create a databunch. A databunch is basically a class that stores the training and validation datasets in the form of dataloaders(something that can feed the data to the GPU in batches conveniently).
Anyways, all these details aside, fastai also provides a method to directly create a default databunch, in which you need not go through all the steps i mentioned above. Its a default, factory method, so to say - less flexible, but convenient in many cases.
So there it is. You might want to use the general API usually. Only when you are looking for a quick way to get the databunch, you may use the factory method. Hope this helps. Cheers!