Skip to content

TypeError in GDSDataset #6786

Closed
Closed

Description

@KumoLiu

Describe the bug
When collate dtype, GDSDataset will cause error.

Traceback (most recent call last):
  File "/home/lab/yliu/MONAI/monai/data/utils.py", line 489, in list_data_collate
    ret[key] = collate_meta_tensor(data_for_batch)
  File "/home/lab/yliu/MONAI/monai/data/utils.py", line 460, in collate_meta_tensor
    return {k: collate_meta_tensor([d[k] for d in batch]) for k in elem_0}
  File "/home/lab/yliu/MONAI/monai/data/utils.py", line 460, in <dictcomp>
    return {k: collate_meta_tensor([d[k] for d in batch]) for k in elem_0}
  File "/home/lab/yliu/MONAI/monai/data/utils.py", line 465, in collate_meta_tensor
    return default_collate(batch)
  File "/home/lab/anaconda3/envs/gds_env/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py", line 265, in default_collate
    return collate(batch, collate_fn_map=default_collate_fn_map)
  File "/home/lab/anaconda3/envs/gds_env/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py", line 150, in 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 'numpy.dtypes.Float32DType'>

To Reproduce
run https://github.com/Project-MONAI/tutorials/blob/main/modules/GDS_dataset.ipynb

Activity

  1. added a commit that references this issue on Jul 27, 2023
    d89b457
  2. added a commit that references this issue on Jul 28, 2023
    b18b31b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions