vinvino02 / GLPDepth

GLPDepth PyTorch Implementation: Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepth
191 stars 44 forks source link

TypeError: only integer scalar arrays can be converted to a scalar index while python ../code/utils/extract_official_train_test_set_from_mat.py nyu_depth_v2_labeled.mat splits.mat ./nyu_depth_v2/official_splits/ #29

Open premchedella opened 1 year ago

premchedella commented 1 year ago

When I ran the following python ../code/utils/extract_official_train_test_set_from_mat.py nyu_depth_v2_labeled.mat splits.mat ./nyu_depth_v2/official_splits/

Got the follwoing:

795 training images
654 test images
reading nyu_depth_v2_labeled.mat
<HDF5 dataset "sceneTypes": shape (1, 1449), type "|O">
Traceback (most recent call last):
  File "../code/utils/extract_official_train_test_set_from_mat.py", line 88, in <module>
    scenes = [u''.join(chr(c) for c in h5_file[obj_ref]) for obj_ref in h5_file['sceneTypes'][0]]
  File "../code/utils/extract_official_train_test_set_from_mat.py", line 88, in <listcomp>
    scenes = [u''.join(chr(c) for c in h5_file[obj_ref]) for obj_ref in h5_file['sceneTypes'][0]]
  File "../code/utils/extract_official_train_test_set_from_mat.py", line 88, in <genexpr>
    scenes = [u''.join(chr(c) for c in h5_file[obj_ref]) for obj_ref in h5_file['sceneTypes'][0]]
TypeError: only integer scalar arrays can be converted to a scalar index

Any clue to how to resolve this error.

premchedella commented 1 year ago

I was able to resolve the TypeError: only integer scalar arrays can be converted to a scalar index. Following is the change

scenes = [u''.join(chr(c) for c in h5_file[obj_ref]) for obj_ref in h5_file['sceneTypes'][0]] to scenes = [u''.join(chr(c[0]) for c in h5_file[obj_ref]) for obj_ref in h5_file['sceneTypes'][0]]