zhangyp15 / OccFormer

[ICCV 2023] OccFormer: Dual-path Transformer for Vision-based 3D Semantic Occupancy Prediction
https://arxiv.org/abs/2304.05316
Apache License 2.0
324 stars 22 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 (6,) + inhomogeneous part.; Different length of array problem when running first command of " Video demo" to get nuscenes_infos_temporal_val_visualize.pkl #22

Open Rango-T10000 opened 2 hours ago

Rango-T10000 commented 2 hours ago

When I try to run projects/mmdet3d_plugin/tools/prepare_video_infos.py to generate: nuscenes_infos_temporal_val_visualize.pkl

I met the problem:

Snipaste_2024-11-01_18-52-09

It shows that the element in sweep_cams has different length:

image
Rango-T10000 commented 2 hours ago

My solution is modify the code to intercept the array according to the one having shortest length. ` sweep_cams = [] sweep_tss = [] min_length = 189171

for cam_type in camera_names:
    dir = os.path.join(data_path, 'sweeps', cam_type)
    filenames = os.listdir(dir)
    files = [os.path.join(dir, fn) for fn in filenames]
    ts = [int(fn.split('__')[-1].split('.')[0]) for fn in filenames]
    idx = np.argsort(ts)
    # sweep_cams.append(np.array(files)[idx])
    # sweep_tss.append(np.array(ts)[idx])
    sweep_cams.append(np.array(files)[idx][:min_length])
    sweep_tss.append(np.array(ts)[idx][:min_length])  

`

image

After that, you can generate nuscenes_infos_temporal_val_visualize.pkl successfully.