Need help on Stanford Cars dataset [ fastai v3 ]

I am trying to work through lesson 1 using Stanford cars dataset. It has 3 folders
PosixPath(’/home/paperspace/.fastai/data/stanford-cars/cars_test’),
PosixPath(’/home/paperspace/.fastai/data/stanford-cars/cars_train’),
PosixPath(’/home/paperspace/.fastai/data/stanford-cars/cars_annos.mat’). Can anyone please help me bringing it in the form ImageDataBunch would work.

I have not worked with the dataset but use this general guideline.

Load the .mat file

from scipy.io import loadmat
annot = loadmat('cars_annot.mat')

Now get all the labels that you want for your case and store them in a pandas dataframe following the guidelines for label_from_df in which you store the path to the image and class for that image.

After this store it as csv file and you are good to go. To split your dataset use the split_from_df.

data = (ImageList.from_csv('annot.csv')
                           .split_from_df()
                           .label_from_df())

This is a general guideline, modify according to your need.

Can you please explain what Path(’ ') here is?
I’m not sure what library that is from.
Thanks!

.fastai is a hidden folder in your home directory (which is /home/ubuntu). When you download datasets using fastai it stores them in the data folder in the hidden .fastai folder.

To view the folder you can toggle the option show hidden files (it is in top right corner menu).

Its from Python library. You can type doc(Path) and it will point you to the documentation.

from pathlib import Path