fastai/courses

Raise an error if test_name='test' but the test folder is empty or doesn't exist.

Closed this issue · 1 comments

When you define the data object and do provide test_name='test'

data = ImageClassifierData.from_csv(PATH, folder='train', csv_fname=f'{PATH}labels.csv',
                                    tfms=tfms, val_idxs=get_cv_idxs(n=4750), test_name='test', bs=12)

But, the test folder is empty or doesn't exist, this assignment results in the following error:
image
image

The function read_dir() in dataset.py is used to read the test. The function already contains a TODO: warn or error if no files are found?

read_dir() is only used to read the test data folder.

image

image

The function gets called only when test_name is True. I think this should raise a FileNotFoundError is it returns an empty list. Something like the following:

image

That way the error message would be more explicit.

raise RuntimeError("{} doesn't exist.".format(d))
RuntimeError: /Users/sangramsing/data/cmu_arctic/cmu_us_clb_arctic/wav doesn't exist.