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

NuScenes dataparser #939

Merged
merged 8 commits into from
Nov 12, 2022
Merged

NuScenes dataparser #939

merged 8 commits into from
Nov 12, 2022

Conversation

zmurez
Copy link
Contributor

@zmurez zmurez commented Nov 11, 2022

This adds support for the NuScenes dataset #921. Optionally you can use the 3D cuboid labels to mask dynamic objects.

Copy link
Contributor

@tancik tancik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! Can you add a screenshot to the PR showing a rendering of this dataset.

from pathlib import Path
import torch

from nuscenes.nuscenes import NuScenes as NuScenesDatabase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package is missing from the requirements.

@@ -0,0 +1,136 @@
from dataclasses import dataclass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a new folder scripts/datasets/ to put this file in.


@dataclass
class NuScenesDataParserConfig(DataParserConfig):
"""Nerfstudio dataset config"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a little more information about what the nuscenes dataset it, including a mention of the mask script. I worry people won't know the mask script exists.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
How to generate the mask of the Nuscene dataset.

[23:33:03] Saving config to: outputs/scene-0061/nerfacto/2023-02-01_233303/config.yml           experiment_config.py:124
[23:33:03] Saving checkpoints to: outputs/scene-0061/nerfacto/2023-02-01_233303/nerfstudio_models         trainer.py:120
logging events to: outputs/scene-0061/nerfacto/2023-02-01_233303
Setting up training dataset...
Caching all 36 images.
Printing profiling stats, from longest to shortest duration in seconds
Traceback (most recent call last):
  File "/home/zongmu/anaconda3/envs/nerfstudio/bin/ns-train", line 8, in <module>
    sys.exit(entrypoint())
  File "/DATA2/xiaoquan.wang/nerfstudio/scripts/train.py", line 247, in entrypoint
    main(
  File "/DATA2/xiaoquan.wang/nerfstudio/scripts/train.py", line 233, in main
    launch(
  File "/DATA2/xiaoquan.wang/nerfstudio/scripts/train.py", line 172, in launch
    main_func(local_rank=0, world_size=world_size, config=config)
  File "/DATA2/xiaoquan.wang/nerfstudio/scripts/train.py", line 86, in train_loop
    trainer.setup()
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/engine/trainer.py", line 145, in setup
    self.pipeline = self.config.pipeline.setup(
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/configs/base_config.py", line 57, in setup
    return self._target(self, **kwargs)
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/pipelines/base_pipeline.py", line 222, in __init__
    self.datamanager: VanillaDataManager = config.datamanager.setup(
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/configs/base_config.py", line 57, in setup
    return self._target(self, **kwargs)
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/datamanagers/base_datamanager.py", line 327, in __init__
    super().__init__()
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/datamanagers/base_datamanager.py", line 150, in __init__
    self.setup_train()
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/datamanagers/base_datamanager.py", line 360, in setup_train
    self.train_image_dataloader = CacheDataloader(
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/utils/dataloaders.py", line 80, in __init__
    self.cached_collated_batch = self._get_collated_batch()
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/utils/dataloaders.py", line 117, in _get_collated_batch
    batch_list = self._get_batch_list()
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/utils/dataloaders.py", line 111, in _get_batch_list
    batch_list.append(res.result())
  File "/home/zongmu/anaconda3/envs/nerfstudio/lib/python3.8/concurrent/futures/_base.py", line 437, in result
    return self.__get_result()
  File "/home/zongmu/anaconda3/envs/nerfstudio/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/home/zongmu/anaconda3/envs/nerfstudio/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/datasets/base_dataset.py", line 120, in __getitem__
    data = self.get_data(image_idx)
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/datasets/base_dataset.py", line 101, in get_data
    data["mask"] = get_image_mask_tensor_from_path(filepath=mask_filepath, scale_factor=self.scale_factor)
  File "/DATA2/xiaoquan.wang/nerfstudio/nerfstudio/data/utils/data_utils.py", line 29, in get_image_mask_tensor_from_path
    pil_mask = Image.open(filepath)
  File "/home/zongmu/anaconda3/envs/nerfstudio/lib/python3.8/site-packages/PIL/Image.py", line 3227, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/DATA/xinchao.gou/nuscenes/masks/CAM_FRONT/n015-2018-07-24-11-22-45+0800__CAM_FRONT__1532402930612460.png

@zmurez
Copy link
Contributor Author

zmurez commented Nov 12, 2022

ns-train nerfacto --vis tensorboard nuscenes-data --data-dir data/NuScenes --mask-dir data/NuScenes --data scene-0061

image
image

@zmurez zmurez requested a review from tancik November 12, 2022 01:59
Copy link
Contributor

@tancik tancik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding this dataset. The results look cool.

@tancik
Copy link
Contributor

tancik commented Nov 12, 2022

Can you run ns-dev-test, it will fix the build errors.

@zmurez
Copy link
Contributor Author

zmurez commented Nov 12, 2022

Can you run ns-dev-test, it will fix the build errors.

done

@tancik tancik merged commit 6ea7dbf into nerfstudio-project:main Nov 12, 2022
@zmurez zmurez deleted the nuscenes branch November 12, 2022 05:48
@tancik tancik linked an issue Nov 14, 2022 that may be closed by this pull request
@segments-tobias
Copy link

@zmurez Is there an option to use all the cameras instead of just the front camera, or should I add that myself?

@segments-tobias
Copy link

Just saw the comment here:
"waiting on multiple camera support" # TODO: remove once multiple cameras are supported
so that answers my question ;)

@WUMINGCHAzero
Copy link

@zmurez Hi! Thanks for your great work! I wonder about the difference between world coordinates in nuScenes and that in nerfstudio. (I've tried to find it by myself but failed, still confused after reading the docs.) Thanks a lot!

@hjxwhy
Copy link

hjxwhy commented Feb 28, 2023

@zmurez Thanks for your contribution! Have you tested nuScenes dataset's other cameras? I have tested it with other cameras and all of them failed otherwise front camera. Thanks!

@donjiaking
Copy link

@zmurez Thanks for your contribution! Have you tested nuScenes dataset's other cameras? I have tested it with other cameras and all of them failed otherwise front camera. Thanks!

@hjxwhy Hi, do you figure out how to use other cameras?

chris838 pushed a commit to chris838/nerfstudio that referenced this pull request Apr 22, 2023
* nuscenes dataparser

* cleanup

* style

* cleanup

* cleanup

* cleanup

Co-authored-by: zmurez <[email protected]>
@mzlchou
Copy link

mzlchou commented Jul 1, 2024

Is there any way to use multiple cameras yet?

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

Successfully merging this pull request may close these issues.

NuScenes Dataset
8 participants