FANG-MING / occupancy-for-nuscenes

3D occupancy
Apache License 2.0
348 stars 21 forks source link

" velocities = np.concatenate((velocities, np.zeros_like(velocities[:, 0:1])), axis=-1) IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed" #5

Open rockywind opened 1 year ago

rockywind commented 1 year ago

Hi, When I run the data_convert.py to generate the occupancy data, I meet the error below.

3836
3837
Traceback (most recent call last):
  File "data_converter.py", line 464, in <module>
    convert2occupy(args.dataroot, args.save_path, args.num_sweeps)
  File "data_converter.py", line 455, in convert2occupy
    generate_occupancy_data(nusc, cur_sample, num_sweeps, save_path=save_path)
  File "data_converter.py", line 338, in generate_occupancy_data
    prev_info = get_frame_info(next_frame, nusc=nusc)
  File "data_converter.py", line 93, in get_frame_info
    velocities = np.concatenate((velocities, np.zeros_like(velocities[:, 0:1])), axis=-1)
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
FANG-MING commented 1 year ago

Hi, When I run the data_convert.py to generate the occupancy data, I meet the error below.

3836
3837
Traceback (most recent call last):
  File "data_converter.py", line 464, in <module>
    convert2occupy(args.dataroot, args.save_path, args.num_sweeps)
  File "data_converter.py", line 455, in convert2occupy
    generate_occupancy_data(nusc, cur_sample, num_sweeps, save_path=save_path)
  File "data_converter.py", line 338, in generate_occupancy_data
    prev_info = get_frame_info(next_frame, nusc=nusc)
  File "data_converter.py", line 93, in get_frame_info
    velocities = np.concatenate((velocities, np.zeros_like(velocities[:, 0:1])), axis=-1)
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

You can delete this sentence, our labels has no generation velocities for the time being, which can easily be generated from the label of the box. Can you tell me about the environment you use there?

rockywind commented 1 year ago

Hi, I met another issue when I delete the sentence.

Traceback (most recent call last):
  File "data_converter.py", line 464, in <module>
    convert2occupy(args.dataroot, args.save_path, args.num_sweeps)
  File "data_converter.py", line 455, in convert2occupy
    generate_occupancy_data(nusc, cur_sample, num_sweeps, save_path=save_path)
  File "data_converter.py", line 407, in generate_occupancy_data
    intermediate_pc, intermediate_label = nonkeykeyframe_align(nusc, prev_info, cur_sample_info, 'prev', pc.points, lidar_seg)
  File "data_converter.py", line 176, in nonkeykeyframe_align
    pc, label = intermediate_keyframe_align(nusc, intermediate_frame_info, ego_frame_info, cur_sample_points, cur_sample_labels)
  File "data_converter.py", line 135, in intermediate_keyframe_align
    pcs, labels, masks = multi_apply(align_dynamic_thing, prev_frame_info['boxes'], prev_frame_info['instance_tokens'], nusc=nusc, prev_points=prev_frame_info['pc'].points, ego_frame_info=ego_frame_info)

image This is my environment.

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             5.1                       1_gnu  
absl-py                   1.4.0                    pypi_0    pypi
addict                    2.4.0                    pypi_0    pypi
anyio                     3.6.2                    pypi_0    pypi
apptools                  5.2.0                    pypi_0    pypi
argon2-cffi               21.3.0                   pypi_0    pypi
argon2-cffi-bindings      21.2.0                   pypi_0    pypi
arrow                     1.2.3                    pypi_0    pypi
asttokens                 2.2.1                    pypi_0    pypi
attrs                     22.2.0                   pypi_0    pypi
backcall                  0.2.0                    pypi_0    pypi
beautifulsoup4            4.11.2                   pypi_0    pypi
black                     23.1.0                   pypi_0    pypi
blas                      1.0                         mkl  
bleach                    6.0.0                    pypi_0    pypi
ca-certificates           2023.01.10           h06a4308_0  
cachetools                5.3.0                    pypi_0    pypi
certifi                   2022.12.7        py38h06a4308_0  
cffi                      1.15.1                   pypi_0    pypi
charset-normalizer        3.0.1                    pypi_0    pypi
click                     8.1.3                    pypi_0    pypi
colorama                  0.4.6                    pypi_0    pypi
comm                      0.1.2                    pypi_0    pypi
configargparse            1.5.3                    pypi_0    pypi
configobj                 5.0.8                    pypi_0    pypi
contourpy                 1.0.7                    pypi_0    pypi
cycler                    0.11.0                   pypi_0    pypi
dash                      2.8.1                    pypi_0    pypi
dash-core-components      2.0.0                    pypi_0    pypi
dash-html-components      2.0.0                    pypi_0    pypi
dash-table                5.0.0                    pypi_0    pypi
debugpy                   1.6.6                    pypi_0    pypi
decorator                 5.1.1                    pypi_0    pypi
defusedxml                0.7.1                    pypi_0    pypi
descartes                 1.1.0                    pypi_0    pypi
envisage                  6.1.1                    pypi_0    pypi
exceptiongroup            1.1.0                    pypi_0    pypi
executing                 1.2.0                    pypi_0    pypi
fastjsonschema            2.16.2                   pypi_0    pypi
fire                      0.5.0                    pypi_0    pypi
flake8                    6.0.0                    pypi_0    pypi
flask                     2.2.3                    pypi_0    pypi
fonttools                 4.38.0                   pypi_0    pypi
fqdn                      1.5.1                    pypi_0    pypi
google-auth               2.16.1                   pypi_0    pypi
google-auth-oauthlib      0.4.6                    pypi_0    pypi
grpcio                    1.51.1                   pypi_0    pypi
idna                      3.4                      pypi_0    pypi
imageio                   2.25.1                   pypi_0    pypi
importlib-metadata        6.0.0                    pypi_0    pypi
importlib-resources       5.12.0                   pypi_0    pypi
importlib_metadata        4.11.3               hd3eb1b0_0  
iniconfig                 2.0.0                    pypi_0    pypi
intel-openmp              2021.4.0          h06a4308_3561  
ipykernel                 6.21.2                   pypi_0    pypi
ipython                   8.10.0                   pypi_0    pypi
ipython-genutils          0.2.0                    pypi_0    pypi
ipywidgets                8.0.4                    pypi_0    pypi
isoduration               20.11.0                  pypi_0    pypi
itsdangerous              2.1.2                    pypi_0    pypi
jedi                      0.18.2                   pypi_0    pypi
jinja2                    3.1.2                    pypi_0    pypi
joblib                    1.2.0                    pypi_0    pypi
jsonpointer               2.3                      pypi_0    pypi
jsonschema                4.17.3                   pypi_0    pypi
jupyter                   1.0.0                    pypi_0    pypi
jupyter-client            8.0.3                    pypi_0    pypi
jupyter-console           6.6.1                    pypi_0    pypi
jupyter-core              5.2.0                    pypi_0    pypi
jupyter-events            0.6.3                    pypi_0    pypi
jupyter-server            2.3.0                    pypi_0    pypi
jupyter-server-terminals  0.4.4                    pypi_0    pypi
jupyterlab-pygments       0.2.2                    pypi_0    pypi
jupyterlab-widgets        3.0.5                    pypi_0    pypi
kiwisolver                1.4.4                    pypi_0    pypi
ld_impl_linux-64          2.38                 h1181459_1  
libffi                    3.4.2                h6a678d5_6  
libgcc-ng                 11.2.0               h1234567_1  
libgomp                   11.2.0               h1234567_1  
libllvm11                 11.1.0               h9e868ea_6  
libstdcxx-ng              11.2.0               h1234567_1  
llvmlite                  0.36.0                   pypi_0    pypi
lyft-dataset-sdk          0.0.8                    pypi_0    pypi
markdown                  3.4.1                    pypi_0    pypi
markdown-it-py            2.1.0                    pypi_0    pypi
markupsafe                2.1.2                    pypi_0    pypi
matplotlib                3.5.2                    pypi_0    pypi
matplotlib-inline         0.1.6                    pypi_0    pypi
mayavi                    4.8.1                    pypi_0    pypi
mccabe                    0.7.0                    pypi_0    pypi
mdurl                     0.1.2                    pypi_0    pypi
mistune                   2.0.5                    pypi_0    pypi
mkl                       2021.4.0           h06a4308_640  
mkl-service               2.4.0            py38h7f8727e_0  
mkl_fft                   1.3.1            py38hd3c417c_0  
mkl_random                1.2.2            py38h51133e4_0  
mmcls                     0.25.0                   pypi_0    pypi
mmcv-full                 1.6.2                    pypi_0    pypi
mmdet                     2.28.1                   pypi_0    pypi
mmdet3d                   1.0.0rc6                  dev_0    <develop>
mmsegmentation            0.30.0                   pypi_0    pypi
model-index               0.1.11                   pypi_0    pypi
mypy-extensions           1.0.0                    pypi_0    pypi
nbclassic                 0.5.2                    pypi_0    pypi
nbclient                  0.7.2                    pypi_0    pypi
nbconvert                 7.2.9                    pypi_0    pypi
nbformat                  5.5.0                    pypi_0    pypi
ncurses                   6.4                  h6a678d5_0  
nest-asyncio              1.5.6                    pypi_0    pypi
networkx                  2.2                      pypi_0    pypi
notebook                  6.5.2                    pypi_0    pypi
notebook-shim             0.2.2                    pypi_0    pypi
numba                     0.53.0                   pypi_0    pypi
numpy                     1.24.2                   pypi_0    pypi
numpy-base                1.23.5           py38h31eccc5_0  
nuscenes-devkit           1.1.10                   pypi_0    pypi
oauthlib                  3.2.2                    pypi_0    pypi
open3d                    0.16.0                   pypi_0    pypi
opencv-python             4.7.0.68                 pypi_0    pypi
openmim                   0.3.6                    pypi_0    pypi
openssl                   1.1.1t               h7f8727e_0  
ordered-set               4.1.0                    pypi_0    pypi
packaging                 23.0                     pypi_0    pypi
pandas                    1.5.3                    pypi_0    pypi
pandocfilters             1.5.0                    pypi_0    pypi
parso                     0.8.3                    pypi_0    pypi
pathspec                  0.11.0                   pypi_0    pypi
pexpect                   4.8.0                    pypi_0    pypi
pickle5                   0.0.11                   pypi_0    pypi
pickleshare               0.7.5                    pypi_0    pypi
pillow                    9.4.0                    pypi_0    pypi
pip                       22.3.1           py38h06a4308_0  
pkgutil-resolve-name      1.3.10                   pypi_0    pypi
platformdirs              3.0.0                    pypi_0    pypi
plotly                    5.13.0                   pypi_0    pypi
pluggy                    1.0.0                    pypi_0    pypi
plyfile                   0.7.4                    pypi_0    pypi
prettytable               3.6.0                    pypi_0    pypi
prometheus-client         0.16.0                   pypi_0    pypi
prompt-toolkit            3.0.37                   pypi_0    pypi
protobuf                  4.22.0                   pypi_0    pypi
psutil                    5.9.4                    pypi_0    pypi
ptyprocess                0.7.0                    pypi_0    pypi
pure-eval                 0.2.2                    pypi_0    pypi
pyasn1                    0.4.8                    pypi_0    pypi
pyasn1-modules            0.2.8                    pypi_0    pypi
pycocotools               2.0.6                    pypi_0    pypi
pycodestyle               2.10.0                   pypi_0    pypi
pycparser                 2.21                     pypi_0    pypi
pyface                    7.4.4                    pypi_0    pypi
pyflakes                  3.0.1                    pypi_0    pypi
pygments                  2.14.0                   pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
pyqt5                     5.15.9                   pypi_0    pypi
pyqt5-qt5                 5.15.2                   pypi_0    pypi
pyqt5-sip                 12.11.1                  pypi_0    pypi
pyquaternion              0.9.9                    pypi_0    pypi
pyrsistent                0.19.3                   pypi_0    pypi
pytest                    7.2.1                    pypi_0    pypi
python                    3.8.16               h7a1cb2a_2  
python-dateutil           2.8.2                    pypi_0    pypi
python-json-logger        2.0.7                    pypi_0    pypi
pytz                      2022.7.1                 pypi_0    pypi
pyvirtualdisplay          3.0                      pypi_0    pypi
pywavelets                1.4.1                    pypi_0    pypi
pyyaml                    6.0                      pypi_0    pypi
pyzmq                     25.0.0                   pypi_0    pypi
qtconsole                 5.4.0                    pypi_0    pypi
qtpy                      2.3.0                    pypi_0    pypi
readline                  8.2                  h5eee18b_0  
requests                  2.28.2                   pypi_0    pypi
requests-oauthlib         1.3.1                    pypi_0    pypi
rfc3339-validator         0.1.4                    pypi_0    pypi
rfc3986-validator         0.1.1                    pypi_0    pypi
rich                      13.3.1                   pypi_0    pypi
rsa                       4.9                      pypi_0    pypi
scikit-image              0.19.3                   pypi_0    pypi
scikit-learn              1.2.1                    pypi_0    pypi
scipy                     1.10.1                   pypi_0    pypi
send2trash                1.8.0                    pypi_0    pypi
setuptools                65.6.3           py38h06a4308_0  
shapely                   1.8.5                    pypi_0    pypi
six                       1.16.0             pyhd3eb1b0_1  
sniffio                   1.3.0                    pypi_0    pypi
soupsieve                 2.4                      pypi_0    pypi
sqlite                    3.40.1               h5082296_0  
stack-data                0.6.2                    pypi_0    pypi
tabulate                  0.9.0                    pypi_0    pypi
tbb                       2021.7.0             hdb19cb5_0  
tenacity                  8.2.1                    pypi_0    pypi
tensorboard               2.12.0                   pypi_0    pypi
tensorboard-data-server   0.7.0                    pypi_0    pypi
tensorboard-plugin-wit    1.8.1                    pypi_0    pypi
termcolor                 2.2.0                    pypi_0    pypi
terminado                 0.17.1                   pypi_0    pypi
terminaltables            3.1.10                   pypi_0    pypi
threadpoolctl             3.1.0                    pypi_0    pypi
tifffile                  2023.2.3                 pypi_0    pypi
tinycss2                  1.2.1                    pypi_0    pypi
tk                        8.6.12               h1ccaba5_0  
tomli                     2.0.1                    pypi_0    pypi
torch                     1.12.1+cu113             pypi_0    pypi
torchaudio                0.12.1+cu113             pypi_0    pypi
torchvision               0.13.1+cu113             pypi_0    pypi
tornado                   6.2                      pypi_0    pypi
FANG-MING commented 1 year ago

You can rewrite multi_apply into a for loop to find detailed error messages.

rockywind commented 1 year ago

Hi, I rewrited the multi_apply into a for loop, and I found that the masks , labels and pcs were null. image

FANG-MING commented 1 year ago

You can replace

 masks = np.stack(masks, axis=-1)
 masks = masks.sum(axis=-1)
 masks = ~(masks>0)

with

try:
     masks = np.stack(masks, axis=-1)
     masks = masks.sum(axis=-1)
     masks = ~(masks>0)
except:
    masks = np.ones_like(prev_frame_info['pc'].points[0, :])

And there is a bug that causes label errors at the boundaries of individual categories, maybe you can save the points before voxel_down_sample().

rockywind commented 1 year ago

Thanks, I have a try!