Skip to content

KeyError when doing "2.Prepared nuScenes 3D detection data" with create_data.py #14

Open
@ArdrieuxPan

Description

@ArdrieuxPan

Environment

docker container, with image
sudo nvidia-docker run -it -p 7600:7600 -p 8022:22 --name="occnet" -v /home/apan/occnet_ws:/home/occnet_ws -it pytorch/pytorch:1.10.0-cuda11.3-cudnn8-devel /bin/bash, python==3.7

Problem

when doing step '2.Prepared nuScenes 3D detection data' with create_data.py, there would be a KeyError:

v1.0-trainval ./data/nuscenes
======
Loading NuScenes tables for version v1.0-trainval...
23 category,
8 attribute,
4 visibility,
64386 instance,
12 sensor,
10200 calibrated_sensor,
2631083 ego_pose,
68 log,
850 scene,
34149 sample,
2631083 sample_data,
1166187 sample_annotation,
4 map,
Done loading in 27.901 seconds.
======
Reverse indexing ...
Done reverse indexing in 6.5 seconds.
======
total scene num: 850
exist scene num: 850
train scene: 700, val scene: 150
[                                                  ] 0/34149, elapsed: 0s, ETA:Traceback (most recent call last):
  File "tools/create_data.py", line 249, in <module>
    max_sweeps=args.max_sweeps)
  File "tools/create_data.py", line 75, in nuscenes_data_prep
    root_path, out_dir, can_bus_root_path, info_prefix, version=version, max_sweeps=max_sweeps)
  File "/home/occnet_ws/OccNet/tools/data_converter/nuscenes_converter.py", line 93, in create_nuscenes_infos
    nusc, nusc_can_bus, train_scenes, val_scenes, test, max_sweeps=max_sweeps)
  File "/home/occnet_ws/OccNet/tools/data_converter/nuscenes_converter.py", line 237, in _fill_trainval_infos
    l2e_r = info['lidar2ego_rotation']
KeyError: 'lidar2ego_rotation'

I shift the console to path /home/occnet_ws/OccNet,while the file organized as follow:

home/occnet_ws/OccNet/data# tree -L 2
|-- can_bus
|   |-- basemap
|   |-- expansion
|   `-- prediction
|-- nuscenes
|   |-- maps
|   |-- readme.md
|   |-- samples
|   |-- sweeps
|   |-- v1.0-test
|   `-- v1.0-trainval
`-- occ_gt_release_v1_0
    |-- nuscenes_infos_temporal_train_occ_gt.pkl
    |-- nuscenes_infos_temporal_val_occ_gt.pkl
    |-- occ_gt_train.json
    |-- occ_gt_val.json
    |-- train
    `-- val

then I found 'lidar2ego_rotation' in nuscene_converter.py line 237, there is no declaration about this key:

# started from line 215

        info = {
            'lidar_path': lidar_path,
            'token': sample['token'],
            'prev': sample['prev'],
            'next': sample['next'],
            'can_bus': can_bus,
            'frame_idx': frame_idx,  # temporal related info
            'sweeps': [],
            'cams': dict(),
            'scene_token': sample['scene_token'],  # temporal related info
            'scene_name': scene_name,
            'lidar2ego_translation': cs_record['translation'],
            'ego2global_rotation': pose_record['rotation'],
            'timestamp': sample['timestamp'],
        }

        if sample['next'] == '':
            frame_idx = 0
        else:
            frame_idx += 1

        l2e_r = info['lidar2ego_rotation']
        l2e_t = info['lidar2ego_translation']
        e2g_r = info['ego2global_rotation']
        e2g_t = info['ego2global_translation']
        l2e_r_mat = Quaternion(l2e_r).rotation_matrix
        e2g_r_mat = Quaternion(e2g_r).rotation_matrix

...

`

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions