So I have a dataset where the structure is similar to this :
The following is the structure of the CSV file:
- So you can see, the path is not specified in the csv file because of which when I try using ImageDataBunch.from_csv(…) or ImageDataBunch.from_df(…) it fails. The exact error message is
There is no such path /home/user/Dev/dataset/n0
- If I use ImageDataBunch.from_folder(…) it works perfectly but I end up having classes as n0, n1, n2 whereas I actually want the classes Apple, Orange, Banana
- Of course, I can go and rename the folders and get it done, but downside is if there are too many folders it will be tedious to manually rename them; again I can write a code snippet that can take all the classes in a list and automate the process of renaming.
- Another alternative is to modify the labels.csv file itself which can point correctly to the folders; but then that approach requires the classes to be present directly under dataset folder and not be broken into train and validation from before, right?
Now that I have explained myself clearly, what I want to do is load the classes inside the train and valid folder but rename the classes to the more readable ones from the labels.csv file and if anyone can suggest something, it will be very useful for me (and others I guess).