facebookresearch / co3d

Tooling for the Common Objects In 3D dataset.
Other
921 stars 71 forks source link

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (489786,) + inhomogeneous part. #60

Closed pira998 closed 1 year ago

pira998 commented 1 year ago

I was trying to load the frame_annotations.jgz of the apple category by using this method load_dataclass_jgzip(f"{self.dataset_root}/apple/frame_annotations.jgz", List[FrameAnnotation] ) in the https://github.com/facebookresearch/co3d/blob/main/co3d/dataset/data_types.py#L332 I got this error

File "/home/ubuntu/sparsefusion/utils/co3d_dataloader.py", line 295, in __init__
    self.category_frame_annotations.extend(load_dataclass_jgzip(
  File "/home/ubuntu/sparsefusion/co3d/dataset/data_types.py", line 344, in load_dataclass_jgzip
    return load_dataclass(cast(IO, f), cls, binary=True)
  File "/home/ubuntu/sparsefusion/co3d/dataset/data_types.py", line 160, in load_dataclass
    res = list(_dataclass_list_from_dict_list(asdict, cls))
  File "/home/ubuntu/sparsefusion/co3d/dataset/data_types.py", line 260, in _dataclass_list_from_dict_list
    transposed = zip(*key_lists)
  File "/home/ubuntu/sparsefusion/co3d/dataset/data_types.py", line 257, in <genexpr>
    _dataclass_list_from_dict_list([obj.get(k, default) for obj in dlist], type_)
  File "/home/ubuntu/sparsefusion/co3d/dataset/data_types.py", line 242, in _dataclass_list_from_dict_list
    vals = np.split(list(all_vals_res), indices[:-1])
  File "<__array_function__ internals>", line 200, in split
  File "/opt/conda/envs/pytorch3d/lib/python3.9/site-packages/numpy/lib/shape_base.py", line 874, in split
    return array_split(ary, indices_or_sections, axis)
  File "<__array_function__ internals>", line 200, in array_split
  File "/opt/conda/envs/pytorch3d/lib/python3.9/site-packages/numpy/lib/shape_base.py", line 786, in array_split
    sary = _nx.swapaxes(ary, axis, 0)
  File "<__array_function__ internals>", line 200, in swapaxes
  File "/opt/conda/envs/pytorch3d/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 594, in swapaxes
    return _wrapfunc(a, 'swapaxes', axis1, axis2)
  File "/opt/conda/envs/pytorch3d/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 54, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/opt/conda/envs/pytorch3d/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 43, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimension. The detected shape was (489786,) + inhomogeneous part.