Shuang Zeng1,2*β , Xinyuan Chang2β , Xinran Liu2, Yujian Yuan1,3, Shiyi Liang1,2, Zheng Pan2, Mu Xu2, Xing Wei1β‘
1 Xiβan Jiaotong University, 2 Amap, Alibaba Group, 3The Hong Kong University of Science and Technology
High-Definition Maps (HD maps) are essential for the precise navigation and decision-making of autonomous vehicles, yet their creation and upkeep present significant cost and timeliness challenges. The online construction of HD maps using on-board sensors has emerged as a promising solution; however, these methods can be impeded by incomplete data due to occlusions and inclement weather, while their performance in distant regions remains unsatisfying. This paper proposes PriorDrive to address these limitations by directly harnessing the power of various vectorized prior maps, significantly enhancing the robustness and accuracy of online HD map construction. Our approach integrates a variety of prior maps uniformly, such as OpenStreetMap's Standard Definition Maps (SD maps), outdated HD maps from vendors, and locally constructed maps from historical vehicle data. To effectively integrate such prior information into online mapping models, we introduce a Hybrid Prior Representation (HPQuery) that standardizes the representation of diverse map elements. We further propose a Unified Vector Encoder (UVE), which employs fused prior embedding and a dual encoding mechanism to encode vector data. To improve the UVE's generalizability and performance, we propose a segment-level and point-level pre-training strategy that enables the UVE to learn the prior distribution of vector data. Through extensive testing on the nuScenes, Argoverse 2 and OpenLane-V2, we demonstrate that PriorDrive is highly compatible with various online mapping models and substantially improves map prediction capabilities. The integration of prior maps through PriorDrive offers a robust solution to the challenges of single-perception data, paving the way for more reliable autonomous vehicle navigation.
a. Create a conda virtual environment and activate it.
conda create -n priordrive python=3.8 -y
conda activate priordriveb. Install PyTorch and torchvision following the official instructions.
pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
# Recommended torch>=1.9c. Install gcc>=5 in conda env (optional).
conda install -c omgarcia gcc-5 # gcc-6.2c. Install mmcv-full.
pip install mmcv-full==1.4.0
# pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.htmld. Install mmdet and mmseg.
pip install mmdet==2.14.0
pip install mmsegmentation==0.14.1e. Install timm.
pip install timmf. Clone PriorDrive.
git clone https://github.com/MIV-XJTU/PriorDrive.git
g. Install mmdet3d and GKT
cd /path/to/PriorDrive/mmdetection3d
python setup.py develop
cd /path/to/PriorDrive/projects/mmdet3d_plugin/maptr/modules/ops/geometric_kernel_attn
python setup.py build install
h. Install other requirements.
cd /path/to/PriorDrive
pip install -r requirement.txti. Prepare pretrained models.
cd /path/to/PriorDrive
mkdir ckpts
cd ckpts
wget https://download.pytorch.org/models/resnet50-19c8e357.pth
wget https://download.pytorch.org/models/resnet18-f37072fd.pthDownload nuScenes V1.0 full dataset data and CAN bus expansion data HERE. Prepare nuscenes data by running
Download CAN bus expansion
# download 'can_bus.zip'
unzip can_bus.zip
# move can_bus to data dir
Prepare nuScenes data
We genetate custom annotation files which are different from mmdet3d's
python tools/maptrv2/custom_nusc_map_converter.py --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes --version v1.0 --canbus ./data
Using the above code will generate nuscenes_map_infos_temporal_{train,val}.pkl, which contain local vectorized map annotations.
Get Online Local Prior
You can directly download the pre-collected online local prior maps from here.
Folder structure
PriorDrive
βββ mmdetection3d/
βββ projects/
βββ tools/
βββ configs/
βββ ckpts/
β βββ r101_dcn_fcos3d_pretrain.pth
βββ PriorDrive_Online_Local_Prior_Maps/
βββ data/
β βββ can_bus/
β βββ nuscenes/
β β βββ maps/
β β βββ samples/
β β βββ sweeps/
β β βββ v1.0-test/
| | βββ v1.0-trainval/
| | βββ nuscenes_infos_temporal_train.pkl
| | βββ nuscenes_infos_temporal_val.pkl
Train PriorDrive with 8 GPUs
./tools/dist_train.sh ./projects/configs/priordrive/maptrv2_nusc_r50_24ep.py 8
Eval PriorDrive with 8 GPUs
./tools/dist_test_map.sh ./projects/configs/priordrive/maptrv2_nusc_r50_24ep.py ./path/to/ckpts.pth 8
we provide tools for visualization and benchmark under path/to/PriorDrive/tools/maptr
cd /path/to/PriorDrive/
export PYTHONPATH="/path/to/PriorDrive/"
# visualize nuscenes dataset
python tools/maptrv2/nusc_vis_pred.py /path/to/experiment/config /path/to/experiment/ckpt
Notes:
- All the visualization samples will be saved in
/path/to/PriorDrive/work_dirs/experiment/vis_pred/automatically. If you want to customize the saving path, you can add--show-dir /customized_path. - The score threshold is set to 0.3 by default. For better visualization, you can adjust the threshold by adding
--score-thresh customized_thresh - The GT is visualized in fixed_num_pts format by default, we provide multiple formats to visualize GT at the same time by setting
--gt-format:se_ptsmeans the start and end points of GT,bboxmeans the bounding box envelops the GT,polyline_ptsmeans the original annotated GT (you can use Douglas-Peucker algorithm to simplify the redundant annotated points).
We also provide the script to merge the input, output and GT into video to benchmark the performance qualitatively.
python tools/maptr/generate_video.py /path/to/visualization/directoryNotes:
- The video will be saved in
/path/to/PriorDrive/work_dirs/experiment/
If you find PriorDrive is useful in your research or applications, please consider giving us a star π and citing it by the following BibTeX entry.
@article{zeng2024driving,
title={Driving with Prior Maps: Unified Vector Prior Encoding for Autonomous Vehicle Mapping},
author={Zeng, Shuang and Chang, Xinyuan and Liu, Xinran and Pan, Zheng and Wei, Xing},
journal={arXiv preprint arXiv:2409.05352},
year={2024}
}PriorDrive is mainly based on MapTRv2. It is also greatly inspired by the following outstanding contributions to the open-source community: mmdetection3d, BEVFusion, BEVFormer, HDMapNet, VectorMapNet.
