Hello Everyone,
I am trying to create a custom data loader for “.npy” files. Here is what the data loader looks like:
def open_npy(fn):
x = np.load(str(fn))
return vision.Image(torch.Tensor(x))
class NpyItemList(vision.ImageList):
def open(self, fn): return open_npy(fn)
class NpyNpyList(NpyItemList):
_label_cls = NpyItemList
def get_y_fn(x):
parent = 'train' if 'train' in str(x) else 'valid'
fn = data_dir/'t1'/parent/f'{str(x.stem)}.npy'
return fn
idb = (NpyNpyList.from_folder(data_dir/'low_res', extensions=('.npy'))
.split_by_folder()
.label_from_func(get_y_fn)
.databunch(bs=2))
When I try to run the learning rate finder, I get the following error:
RuntimeError: Expected 5-dimensional input for 5-dimensional weight 64 1 9 9, but got 4-dimensional input of size [2, 64, 64, 64] instead
What could be the cause of this error?
Thanks,
Kishan