I am trying to do a last step fit with the entire training set before having the model predict the test set. I tried to simply not setting val_idxs
when calling from_csv
but when I call get_data
I get the below error.
I see in from_csv
definition the default value is None
. I have tried passing an empty numpy array and I get the same error.
IndexError Traceback (most recent call last)
<ipython-input-38-464872a660af> in <module>()
----> 1 data = get_data(sz, bs)
<ipython-input-37-7d8c25715bc7> in get_data(sz, bs)
1 def get_data(sz, bs):
2 tfms = tfms_from_model(arch, sz, aug_tfms=transforms_side_on, max_zoom=1.1)
----> 3 data = ImageClassifierData.from_csv(PATH, 'train' ,f'{PATH}labels.csv', test_name='test', val_idxs=[], suffix='.jpg', tfms=tfms, bs=bs)
4 return data if sz > 300 else data.resize(340, 'tmp')
~/fastai/courses/dl1/fastai/dataset.py in from_csv(cls, path, folder, csv_fname, bs, tfms, val_idxs, suffix, test_name, continuous, skip_header, num_workers)
348 """
349 fnames,y,classes = csv_source(folder, csv_fname, skip_header, suffix, continuous=continuous)
--> 350 ((val_fnames,trn_fnames),(val_y,trn_y)) = split_by_idx(val_idxs, np.array(fnames), y)
351
352 test_fnames = read_dir(path, test_name) if test_name else None
~/fastai/courses/dl1/fastai/dataset.py in split_by_idx(idxs, *a)
361 def split_by_idx(idxs, *a):
362 mask = np.zeros(len(a[0]),dtype=bool)
--> 363 mask[np.array(idxs)] = True
364 return [(o[mask],o[~mask]) for o in a]
IndexError: arrays used as indices must be of integer (or boolean) type