Skip to content

DataLoader error #6

@juliangaal

Description

@juliangaal

Hi, I'm getting an error on my dataloader for the TINY dataset with custom root_dir:

Traceback (most recent call last):
  File "model.py", line 59, in <module>
    for i, (D, L, IDX) in enumerate(DATALOADER):
  File ".../deep-ranking/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 819, in __next__
    return self._process_data(data)
  File .../deep-ranking/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data
    data.reraise()
  File ".../deep-ranking/lib/python3.7/site-packages/torch/_utils.py", line 369, in reraise
    raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File ".../deep-ranking/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File ".../deep-ranking/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File ".../deep-ranking/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 80, in default_collate
    return [default_collate(samples) for samples in transposed]
  File ".../deep-ranking/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 80, in <listcomp>
    return [default_collate(samples) for samples in transposed]
  File "..../deep-ranking/lib/python3.7/site-packages/torch/utils/data/_utils/collate.py", line 82, in default_collate
    raise TypeError(default_collate_err_msg_format.format(elem_type))
TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found <class 'NoneType'>

the data path is correct, as the dataloader doesn't throw a 'file not found error'. Is the transformation to tensor missing perhaps? Thanks for your help

EDIT: I think this was caused by images[0],images[1],images[2],None,None in data_utils.py. Removing the Nones, I get this error in the forward function

RuntimeError: Expected 4-dimensional input for 4-dimensional weight 64 3 7, but got 3-dimensional input of size [3, 224, 224] instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions