ScenarioNet

repository·main·Indexed 43 days ago

https://github.com/metadriverse/scenarionet

An open-source platform for large-scale traffic scenario simulation and modeling. Powered by the MetaDrive Simulator, it enables the conversion of real-world datasets (Waymo, nuPlan, nuScenes, l5, Argoverse 2.0) and synthetic data into a unified scenario description format for autonomous driving ML applications, including reinforcement learning and imitation learning.

Tokens
12.7K
Snippets
49
Records
66
Agent score
54%

What's inside ScenarioNet

  1. Overview of ScenarioNet

    main

    ScenarioNet is an open-source platform designed for large-scale traffic scenario modeling and simulation. It provides a unified scenario description format that includes HD maps and detailed object annotations.

    Key capabilities include:

    • Database Management: Tools to build and manage databases from real-world datasets (Waymo, nuScenes, Lyft L5, nuPlan) and synthetic datasets (procedural or safety-critical).
    • Multi-View Replay: Scenarios can be replayed in digital twins using various views, from Bird-Eye-View (BEV) layouts to realistic 3D rendering.
    • Broad Application Support: Enables large-scale scenario generation, Autonomous Driving (AD) testing, imitation learning, and reinforcement learning in both single-agent and multi-agent environments.
  2. Overview of ScenarioNet capabilities

    main

    ScenarioNet is an open-source platform for large-scale traffic scenario simulation and modeling. It is powered by the MetaDrive Simulator and provides the following capabilities:

    • Scenario Loading: Load scenarios from real-world datasets (Waymo, nuPlan, nuScenes, l5) or synthetic datasets (procedurally generated or adversarial/safety-critical scenarios).
    • Dataset Management: Tools for building training and test sets for Machine Learning applications.
    • Reconstruction: Reconstruct scenarios for various applications including Autonomous Driving (AD) stack testing, Reinforcement Learning (RL), Imitation Learning, and scenario generation.
  3. Accessing the Lyft dataset

    main

    The Lyft dataset contains logs of movement for cars, cyclists, pedestrians, and other traffic agents, processed from raw lidar, camera, and radar data. It is suitable for training motion prediction models.

    Dataset Details:

    • 1000+ hours of traffic agent movement
    • 16k miles of data from 23 vehicles
    • 15k semantic map annotations

    External Resources:

  4. Compatibility and support for Lyft datasets

    main

    Support for Lyft datasets in ScenarioNet depends on the version of the data being used:

    1. Old Lyft Dataset: Can be read using nuscenes-toolkit and shares the nuScenes converter.
    2. New Lyft Dataset: Maintained by Woven Planet. Support for this version via L5Kit is currently under development.
  5. Configure nuPlan environment variables

    main

    To ensure nuplan-devkit can locate your data, add the following environment variables to your ~/.bashrc file:

    export NUPLAN_DATA_ROOT="$HOME/nuplan/dataset"
    export NUPLAN_MAPS_ROOT="$HOME/nuplan/dataset/maps"
    export NUPLAN_EXP_ROOT="$HOME/nuplan/exp"

    After setting these, you can verify the installation by running the tutorial located at nuplan-devkit/tutorials/nuplan_scenario_visualization.ipynb.

    export NUPLAN_DATA_ROOT="$HOME/nuplan/dataset"
    export NUPLAN_MAPS_ROOT="$HOME/nuplan/dataset/maps"
    export NUPLAN_EXP_ROOT="$HOME/nuplan/exp"
  6. Install the nuPlan Toolkit

    main

    To use ScenarioNet with nuPlan, you must first install the nuplan-devkit. It is recommended to install from GitHub to access examples and source code for verifying your installation.

    # Clone the repository
    git clone git@github.com:nutonomy/nuplan-devkit.git
    cd nuplan-devkit
    
    # Install dependencies and the package in editable mode
    pip install -r requirements.txt
    pip install -e .
    
    # Install additional required package
    pip install pytorch-lightning

    Option 2: Install from PyPI

    pip install nuplan-devkit
    git clone git@github.com:nutonomy/nuplan-devkit.git
    cd nuplan-devkit
    pip install -r requirements.txt
    pip install -e .
    pip install pytorch-lightning
  7. Install ScenarioNet and MetaDrive Simulator

    main

    ScenarioNet requires the MetaDrive Simulator to function. The recommended installation method is to create a dedicated Conda environment and install both repositories in editable mode (pip install -e .).

    Follow these steps to set up your environment:

    1. Create and activate a Python 3.9 Conda environment.
    2. Clone and install metadrive.
    3. Clone and install scenarionet.

    Note: Ensure you are in the parent directory where you want to host the repositories before cloning.

    # create environment
    conda create -n scenarionet python=3.9
    conda activate scenarionet
    
    # Install MetaDrive Simulator
    cd ~/  # Go to the folder you want to host these two repos.
    git clone https://github.com/metadriverse/metadrive.git
    cd metadrive
    pip install -e .
    
    # Install ScenarioNet
    cd ~/  # Go to the folder you want to host these two repos.
    git clone https://github.com/metadriverse/scenarionet.git
    cd scenarionet
    pip install -e .
  8. Download and organize VoD Data

    main
    1. Access Data: Register at the official VoD website to receive a download link. Download and unzip view_of_delft_prediction_PUBLIC.zip.

    2. Directory Structure: Organize the unzipped files into the following structure:

    /vod/data/path/
    ├── maps/
    |   └── expansion/
    ├── v1.0-trainval/
    |   ├── attribute.json
    |   ├── calibrated_sensor.json
    |   ├── map.json
    |   ├── log.json
    |   ├── ego_pose.json
    |   └── ...
    └── v1.0-test/
    1. Data Location: By default, vod-devkit expects the data to be at /data/sets/vod. If you store the data elsewhere, you must either:
      • Create a symbolic link from your data folder to /data/sets/vod.
      • Explicitly specify the --dataroot flag when calling vod-devkit APIs or ScenarioNet converters.
  9. Build the PG (Procedural Generation) Database

    main

    The PG scenarios are generated by running simulations in the MetaDrive simulator and recording the episodes. To build the PG database, you must have MetaDrive installed. You can use the scenarionet.convert_pg module to generate a specified number of scenarios and save them to a directory.

    Use the following command to generate 1000 scenarios:

    python -m scenarionet.convert_pg -d /path/to/pg_database --num_scenarios 1000