Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Nov 16, 2022 · 1 comment

Comments

@premchedella
Copy link

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
Copy link
Author

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]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant