How to concatenate two imagedatabunch

I am trying to train a learner where I have two datasets in two different folders and I want to use both of them to form my imagedatabunch. How can I do so?

The easiest way to do this is to just make sure the two folders are under some parent folder. If you make it such that the folder structure looks like

  • train_folder
    – train_folder_one
    – train_folder_two

And use the datablock api from_folder and pass the path ./train_folder (assuming train_folder is in the current directory) it will automatically recurse through all folders and find all files ( you might need to fiddle with the extensions argument to get only the file types you want).

Link for everything that makes this very clear: https://docs.fast.ai/data_block.html#ItemList.from_folder

1 Like

Very Helpful Post …!! dqfansurvey thanks for sharing with us.

1 Like