Hey guys! I hope you’re doing great.
I am trying to do the Food-101 challenge and facing some issues splitting the data. The data has a meta folder containing a test.txt that names the files that should be in the validation set.
It looks like this:
However, when I pass path/“meta/test.txt” as the argument, to
FileSplitter, the datablock is generated but I get an empty validation set.
I tried adding “.jpg” to each line and then running it, but that doesn’t work as well.
I also made a list of the names and then passed it to
FuncSplitter, but ¯_(ツ)_/¯.
Any idea how can I proceed?
As examples located in subdirectories with the category names. Read it using Pandas DataFrame structure and then modify so that the paths and .jpg file extensions are added. Fast AI provides a way of reading the DataFrame structure and indicating that the labels are in column 0 and the examples are in column 1.
path = untar_data(URLs.FOOD)
train_path = '/root/.fastai/data/food-101/train.txt'
test_path = '/root/.fastai/data/food-101/test.txt'
df = pd.read_csv(path, delimiter='/', header=None, names=['label', 'name'])
df['name'] = df['label'].astype(str) + "/" + df['name'].astype(str) + ".jpg"
train_df = filelist2df(train_path)
test_df = filelist2df(test_path)