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

Label Conversion error of OpenLABEL to nuS #9

Open
Mike-7777777 opened this issue May 2, 2024 · 3 comments
Open

Label Conversion error of OpenLABEL to nuS #9

Mike-7777777 opened this issue May 2, 2024 · 3 comments

Comments

@Mike-7777777
Copy link

Traceback (most recent call last):
  File "tum-traffic-dataset-dev-kit/src/label_conversion/conversion_openlabel_to_nuscenes.py", line 274, in <module>
    converter.convert_openlabel_to_nuscenes()
  File "tum-traffic-dataset-dev-kit/src/label_conversion/conversion_openlabel_to_nuscenes.py", line 88, in convert_openlabel_to_nuscenes
    infos_list += self._fill_infos(labels_list, camera_labels_list)
  File "tum-traffic-dataset-dev-kit/src/label_conversion/conversion_openlabel_to_nuscenes.py", line 158, in _fill_infos
    cam_annotations = [next(iter(json.load(open(camera_labels_list[0][j]))['openlabel']['frames'].values())) \
IndexError: list index out of range

Code related to this error is(I think):

camera_labels_list = []
for camera_list in sorted(glob(os.path.join(self.load_dir, self.map_version_to_dir[split], 'labels_images',
                                                        '*'))):
    camera_labels_list.append(sorted(glob(os.path.join(camera_list, '*'))))

When I print the camera_labels_list, it shows empty:

Start converting ...
Converting split: training...
[]
@PaulBigiel
Copy link

What I did to get the list non empty:
The folder structure after the split is

  • images
  • labels_point_clouds
  • point_clouds

However, in the code line 72 you find:
for camera_list in sorted(glob(os.path.join(self.load_dir, self.map_version_to_dir[split], 'labels_images',

So the code searches for "labels_images", which doesn't exist but there is "labels_point_cloud". Change the code there to
for camera_list in sorted(glob(os.path.join(self.load_dir, self.map_version_to_dir[split], 'labels_point_clouds',
and the list won't be empty anymore.

You can clearly see that they changed their project structure, since the documentation also doesn't match directories for several scripts. I think it ran on their PC before they changed it and therefore maybe all bugs in the code are related to changed directory names.

Next error python gives me after changing the code:
line 174, in _fill_infos cam_info['filename'] = os.path.join(cam_annotations[i]['frame_properties']['image_file_name']) KeyError: 'image_file_name'

I will look into it. Please let me know if you found a solution.

@PaulBigiel
Copy link

If you look into the JSON, you can see that there is no entry called image_file_name. However, there is image_file_names, which contains two immage names.

For example: 'image_file_names': ['1646667310_044372291_s110_camera_basler_south1_8mm.jpg', '1646667310_055996268_s110_camera_basler_south2_8mm.jpg']

You can replace

cam_info['filename'] = os.path.join(cam_annotations[i]['frame_properties']['image_file_name'])
with
cam_info['filename'] = os.path.join(cam_annotations[i]['frame_properties']['image_file_names'])

however, this will return a list instead of just an image file name, which gives you the following error:
a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not list

It seems like the code is written for a dataset with one camera, however the default dataset the code links for if you give no arguments, cleary mentions the R02 dataset.
default='/data/00_tum_traffic_dataset/r02_tum_traffic_intersection_dataset/r02_tum_traffic_intersection_dataset_train_val_test/',

This is really messed up.

@PaulBigiel
Copy link

Ok, the converter, once it works, doesn't make a dataset like nuscenes, but instead directly generates the corresponding .pkl files that are probably ment for use in mmdetection3D.

However, I think the BEV-Fusion repo has modified the way .pkl files are generated so they may not work as intended. I think I won't look further in this.

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

2 participants