Nuplan (an open source data set for autonomous driving planning) - installation and configuration in ubuntu

Table of contents

1. Introduction to nuplan:

1.1 Significance of nuplan dataset:

2. Install

2.1 Download the development kit devkit

2.2 Install the specified version of python

2.3 Install the virtual environment

miniconda installation (skip this step if miniconda is already installed)

Create a conda environment

Install dependencies in the created conda environment:

3. Dataset download and environment variable setting

3.1 Dataset download

3.2 Environment variable configuration

Package environment variable configuration

Database environment variable configuration

4. Summary

5. References


1. Introduction to nuplan:

        It is the world's first open source data set (released in 2021) for autonomous driving planning method tests. It collected approximately 1,300 hours of driving data in four cities: Boston, Pittsburgh, Las Vegas and Singapore.

        Although ML-based motion planners are increasingly available, the lack of established datasets, simulation frameworks, and evaluation metrics also limits progress in this field. Existing datasets ( Argoverse , Lyft , Waymo ) mainly focus on short-term motion prediction of other agents, rather than long-term planning of the ego vehicle. This leads to the fact that most of the previous methods use open-loop evaluation based on L2 indicators, which is not suitable for rational evaluation of long-term planning. In order to solve the above problems, in addition to providing large-scale real vehicle data sets, nuplan also provides a learning-based training framework to develop machine learning-based planners, lightweight closed-loop simulators, motion planning evaluation indicators and visualization tools . The figure below is its training framework.

nuplan training framework

2. Install

2.1 Download the development kit devkit

        First, cd to the desired installation directory, then run the following code in a terminal:

git clone https://github.com/motional/nuplan-devkit.git
cd nuplan-devkit

2.2 Install the specified version of python

        The official devkit is used to test Python 3.9 on Ubuntu. In order to avoid bugs, it is recommended to install python3.9, and the installation can be achieved by using the following command:

sudo apt install python-pip
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.9
sudo apt-get install python3.9-dev

2.3 Install the virtual environment

miniconda installation (skip this step if miniconda is already installed)

        Enter the following command in the terminal to download the miniconda installation package:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

        Run the installation package:

bash Miniconda3-latest-Linux-x86_64.sh

        During the installation process, follow the instructions and keep selecting yes. After installing conda, you can change the source to improve the speed. You can refer to canda to change the source in the ubuntu environment.

Create a conda environment

        First ensure that the terminal is in the downloaded folder nuplan-devkit, and then run the following code:

conda create --name nuplan python=3.9
## 激活conda环境
conda activate nuplan
## 安装指定版本pip
python -m pip install pip==21.2.4 -i https://pypi.tuna.tsinghua.edu.cn/simple

Install dependencies in the created conda environment:

        Ensure that the terminal is in the nuplan-devkit directory and the conda environment of nuplan is activated, and run the following codes in sequence:

pip install -r requirements_torch.txt
pip install -r requirements.txt

        The above-mentioned two txt lists in the folder directory are used to install the dependent packages. The number of dependent packages is huge, the installation takes a long time, and there may be interruptions. Therefore, after the interrupt problem occurs, the above two lines of code should be run repeatedly to ensure that all packages are installed successfully.

        Note: The grpcio and SQLAlchemy versions of the dependency packages provided by the official nuplan-devkit are missing. You should install the SQLAlchemy-1.43.0 and SQLAlchemy-1.4.27 installation packages respectively. Therefore, you need to run the following two lines of code to ensure that the versions are correct, otherwise bugs will occur when you run nuplan later.

pip install grpcio==1.43.0
pip install SQLAlchemy==1.4.27

3. Dataset download and environment variable setting

3.1 Dataset download

        After registering on the nuplan official website , you can download the data set. After registration, you can enter the following download interface, and download at least two data sets in the red box as shown in the figure :

Datasets to be downloaded for trial and testing: maps and mini

        After the data download is complete, they should be decompressed to the corresponding folders respectively, so as to facilitate subsequent downloading and adding of larger training data sets. The official suggested file storage hierarchy is as follows:

~/nuplan
├── exp
│   └── ${USER}
│       ├── cache
│       │   └── <cached_tokens>
│       └── exp
│           └── my_nuplan_experiment
└── dataset
    ├── maps
    │   ├── nuplan-maps-v1.0.json
    │   ├── sg-one-north
    │   │   └── 9.17.1964
    │   │       └── map.gpkg
    │   ├── us-ma-boston
    │   │   └── 9.12.1817
    │   │       └── map.gpkg
    │   ├── us-nv-las-vegas-strip
    │   │   └── 9.15.1915
    │   │       └── map.gpkg
    │   └── us-pa-pittsburgh-hazelwood
    │       └── 9.17.1937
    │           └── map.gpkg
    └── nuplan-v1.1
        ├── mini
        │   ├── 2021.05.12.22.00.38_veh-35_01008_01518.db
        │   ├── 2021.06.09.17.23.18_veh-38_00773_01140.db
        │   ├── ...
        │   └── 2021.10.11.08.31.07_veh-50_01750_01948.db
        └── trainval
            ├── 2021.05.12.22.00.38_veh-35_01008_01518.db
            ├── 2021.06.09.17.23.18_veh-38_00773_01140.db
            ├── ...
            └── 2021.10.11.08.31.07_veh-50_01750_01948.db

        If you are just trying or learning, we don't have to download the trainval dataset, just download the maps and mini datasets. Therefore, corresponding simplification can be made on the basis of the official recommended file hierarchy, and the downloaded maps and mini datasets can be stored in the following format:

~/nuplan
├── dataset
    ├── maps
    │   ├── nuplan-maps-v1.0.json
    │   ├── sg-one-north
    │   │   └── 9.17.1964
    │   │       └── map.gpkg
    │   ├── us-ma-boston
    │   │   └── 9.12.1817
    │   │       └── map.gpkg
    │   ├── us-nv-las-vegas-strip
    │   │   └── 9.15.1915
    │   │       └── map.gpkg
    │   └── us-pa-pittsburgh-hazelwood
    │       └── 9.17.1937
    │           └── map.gpkg
    └── nuplan-v1.1
        ├── mini
            ├── 2021.05.12.22.00.38_veh-35_01008_01518.db
            ├── 2021.06.09.17.23.18_veh-38_00773_01140.db
            ├── ...
            └── 2021.10.11.08.31.07_veh-50_01750_01948.db

3.2 Environment variable configuration

Package environment variable configuration

        In order to run the nuplan-devkit source code, you first need to add this environment variable, and write the following content in the ~/.bashrc file according to the actual path of nuplan-devkit:

# 打开并编辑.bashrc
sudo gedit ~/.bashrc
# 根据个人安装的路径将以下内容写入./bashrc中
export PYTHONPATH="${PYTHONPATH}:$HOME/nuplan-devkit"

Database environment variable configuration

        The purpose of database environment variable configuration is to quickly find the location of the data folder through code, and also need to add the following content in ~/.bashrc:

# 以下路径根据数据集文件夹以及地图文件夹的位置进行设置
export NUPLAN_DATA_ROOT="$HOME/nuplan/dataset/mini"
export NUPLAN_MAPS_ROOT="$HOME/nuplan/dataset/maps"

4. Summary

        The above content is a personal summary of the actual operation according to the instructions of the official nuplan installation document . During this period, some bugs in the official installation document were encountered and solved.

        If there are any problems with the above content, welcome to discuss.

5. References

        nuPlan (nuscenes.org)

        motional/nuplan-devkit: The devkit of the nuPlan dataset. (github.com)

        nuPlan — nuplan-devkit v0.1 documentation

Guess you like

Origin blog.csdn.net/m0_63771100/article/details/130062340