From 8fff2c215c52e4107a856d0faa402efb00e35231 Mon Sep 17 00:00:00 2001 From: QuanyiLi Date: Sun, 27 Aug 2023 18:17:47 +0100 Subject: [PATCH] PG+waymo+nuscenes --- documentation/PG.rst | 4 ++ documentation/nuscenes.rst | 103 ++++++++++++++++++++++++++++++++ documentation/waymo.rst | 3 +- scenarionet/convert_nuscenes.py | 4 +- setup.py | 1 + 5 files changed, 111 insertions(+), 4 deletions(-) diff --git a/documentation/PG.rst b/documentation/PG.rst index 35c9471..72180e8 100644 --- a/documentation/PG.rst +++ b/documentation/PG.rst @@ -2,6 +2,10 @@ PG ############ +| Website: https://metadriverse.github.io/metadrive/ +| Download: *N/A (collected online)* +| Paper: https://arxiv.org/pdf/2109.12674.pdf + The PG scenarios are collected by running simulation and record the episodes in MetaDrive simulator. The name PG refers to Procedural Generation, which is a technique used to generate maps. When a map is determined, the vehicles and objects will be spawned and actuated according to a hand-crafted rules. diff --git a/documentation/nuscenes.rst b/documentation/nuscenes.rst index 9f900bf..f6c9aec 100644 --- a/documentation/nuscenes.rst +++ b/documentation/nuscenes.rst @@ -2,6 +2,109 @@ nuScenes ############################# +| Website: https://www.nuscenes.org/nuscenes +| Download: https://www.nuscenes.org/nuscenes (Registration required) +| Paper: https://arxiv.org/pdf/1903.11027.pdf + +The nuScenes dataset (pronounced /nuːsiːnz/) is a public large-scale dataset for autonomous driving developed by the team at Motional (formerly nuTonomy). +Motional is making driverless vehicles a safe, reliable, and accessible reality. +By releasing a subset of our data to the public, +Motional aims to support public research into computer vision and autonomous driving. + +For this purpose nuScenes contains 1000 driving scenes in Boston and Singapore, +two cities that are known for their dense traffic and highly challenging driving situations. +The scenes of 20 second length are manually selected to show a diverse and interesting set of driving maneuvers, +traffic situations and unexpected behaviors. +The rich complexity of nuScenes will encourage development of methods that enable safe driving in urban areas with dozens of objects per scene. +Gathering data on different continents further allows us to study the generalization of computer vision algorithms across different locations, weather conditions, vehicle types, vegetation, road markings and left versus right hand traffic. + + +1. Install nuScenes Toolkit +============================ + +First of all, we have to install the ``nuscenes-devkit``. + +.. code-block:: bash + + # install from github (Recommend) + git clone git@github.com:nutonomy/nuscenes-devkit.git + cd nuscenes-devkit/setup + pip install -e . + + # or install from PyPI + pip install nuscenes-devkit + + # or install with scenarionet + pip install -e .[nuscenes] + +By installing from github, you can access examples and source code the toolkit. +The examples are useful to verify whether the installation and dataset setup is correct or not. + + +2. Download nuScenes Data +============================== + +The official instruction is available at https://github.com/nutonomy/nuscenes-devkit#nuscenes-setup. +Here we provide a simplified installation procedure. + +First of all, please complete the registration on nuScenes website: https://www.nuscenes.org/nuscenes. +After this, go to the Download section and download the following files/expansions: + +- mini/train/test splits +- Can bus expansion +- Map expansion + +We recommend to download the mini split first to verify and get yourself familiar with the process. +All downloaded files are ``.tgz`` files and can be uncompressed by ``tar -zxf xyz.tgz``. + +Secondly, all files should be organized to the following structure:: + + /nuscenes/data/path/ + ├── maps/ + | ├──basemap/ + | ├──prediction/ + | ├──expansion/ + | └──... + ├── samples/ + | ├──CAM_BACK + | └──... + ├── sweeps/ + | ├──CAM_BACK + | └──... + ├── v1.0-mini/ + | ├──attribute.json + | ├──calibrated_sensor.json + | ├──map.json + | ├──log.json + | ├──ego_pose.json + | └──... + └── v1.0-trainval/ + + +The ``/nuscenes/data/path`` should be ``/data/sets/nuscenes`` by default according to the official instructions, +allowing the ``nuscens-devkit`` to find it. +But you can still place it to any other places and: + +- build a soft link connect your data folder and ``/data/sets/nuscenes`` +- or specify the ``dataroot`` when calling nuScenes APIs and our convertors. + + +After this step, the examples in ``nuscenes-devkit`` is supposed to work well. +Please try ``nuscenes-devkit/python-sdk/tutorials/nuscenes_tutorial.ipynb`` and see if the demo can successfully run. + +3. Build nuScenes Database +=========================== + +After setup the raw data, convertors in ScenarioNet can read the raw data, convert scenario format and build the database. +Here we take converting raw data in ``nuscenes-mini`` as an example:: + + python -m scenarionet.convert_waymo -d /path/to/your/database --version v1.0-mini --dataroot /nuscens/data/path + +The ``version`` is to determine which split to convert. ``dataroot`` is set to ``/data/sets/nuscenes`` by default, +but you need to specify it if your data is stored in any other directory. +Now all converted scenarios will be placed at ``/path/to/your/database`` and are ready to be used in your work. + + Known Issues: nuScenes ======================= diff --git a/documentation/waymo.rst b/documentation/waymo.rst index f32afa6..1891aa2 100644 --- a/documentation/waymo.rst +++ b/documentation/waymo.rst @@ -83,6 +83,5 @@ Here we take converting raw data in ``training_20s`` as an example:: Now all converted scenarios will be placed at ``/path/to/your/database`` and are ready to be used in your work. Known Issues: Waymo -===================== - +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ N/A diff --git a/scenarionet/convert_nuscenes.py b/scenarionet/convert_nuscenes.py index bf83f7c..22ae961 100644 --- a/scenarionet/convert_nuscenes.py +++ b/scenarionet/convert_nuscenes.py @@ -24,6 +24,7 @@ if __name__ == '__main__': default='v1.0-mini', help="version of nuscenes data, scenario of this version will be converted " ) + parser.add_argument("--dataroot", default="/data/sets/nuscenes", help="The path of nuscenes data") parser.add_argument("--overwrite", action="store_true", help="If the database_path exists, whether to overwrite it") parser.add_argument("--num_workers", type=int, default=8, help="number of workers to use") args = parser.parse_args() @@ -33,8 +34,7 @@ if __name__ == '__main__': output_path = args.database_path version = args.version - dataroot = '/home/shady/data/nuscenes' - scenarios, nuscs = get_nuscenes_scenarios(dataroot, version, args.num_workers) + scenarios, nuscs = get_nuscenes_scenarios(args.dataroot, version, args.num_workers) write_to_directory( convert_func=convert_nuscenes_scenario, diff --git a/setup.py b/setup.py index 32a89c2..0de22ba 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ setup( "waymo": waymo, "nuplan": nuplan, "nuscenes": nuscenes, + "all": nuscenes + waymo + nuplan }, include_package_data=True, license="Apache 2.0",