Project Icon

PETR

多视角3D感知框架 目标检测与BEV分割的统一解决方案

PETR是一个多视角3D感知框架,通过位置嵌入变换将3D坐标信息编码到图像特征中。其升级版PETRv2引入时序建模,支持目标检测和BEV分割。该框架在nuScenes数据集上展现了出色性能,为3D感知研究提供了有力基线。此外,PETR还支持3D车道线检测,相关工作在CVPR 2023工作坊中获得第一名。

[ECCV2022] Position Embedding Transformation for Multi-View 3D Object Detection

[ICCV2023] PETRv2: A Unified Framework for 3D Perception from Multi-Camera Images

arXiv visitors PWC

This repository is an official implementation of PETR and PETRv2. The flash attention version can be find from the "flash" branch.


PETR develops position embedding transformation (PETR) for multi-view 3D object detection. PETR encodes the position information of 3D coordinates into image features, producing the 3D position-aware features. Object query can perceive the 3D position-aware features and perform end-to-end object detection. It can serve as a simple yet strong baseline for future research.


PETRv2 is a unified framework for 3D perception from multi-view images. Based on PETR, PETRv2 explores the effectiveness of temporal modeling, which utilizes the temporal information of previous frames to boost 3D object detection. The 3D PE achieves the temporal alignment on object position of different frames. A feature-guided position encoder is further introduced to improve the data adaptability of 3D PE. To support for high-quality BEV segmentation, PETRv2 provides a simply yet effective solution by adding a set of segmentation queries. Each segmentation query is responsible for segmenting one specific patch of BEV map. PETRv2 achieves state-of-the-art performance on 3D object detection and BEV segmentation.

News

2023.10.11 The 3D lane detection of PETRv2 has been released on TopoMLP. It support openlanev2 and won the 1st place in CVPR2023 workshop!.
2023.01.25 Our multi-view 3D detection framework StreamPETR (63.6% NDS and 55.0% mAP)** without TTA and future frames.
2023.01.04 Our multi-modal detection framework CMT is released on arxiv.
2022.11.04 The code of multi-scale improvement in PETRv2 is released.
2022.09.21 The code of query denoise improvement in PETRv2 is released.
2022.09.04 PETRv2 with VoVNet backbone and multi-scale achieves (59.1% NDS and 50.8% mAP).
2022.08.11 PETRv2 with GLOM-like backbone and query denoise achieves (59.2% NDS and 51.2% mAP) without extra data.
2022.07.04 PETR has been accepted by ECCV 2022.
2022.06.28 The code of BEV Segmentation in PETRv2 is released.
2022.06.16 The code of 3D object detection in PETRv2 is released.
2022.06.10 The code of PETR is released.
2022.06.06 PETRv2 is released on arxiv.
2022.06.01 PETRv2 achieves another SOTA performance on nuScenes dataset (58.2% NDS and 49.0% mAP) by the temporal modeling and supports BEV segmentation.
2022.03.10 PETR is released on arxiv.
2022.03.08 PETR achieves SOTA performance (50.4% NDS and 44.1% mAP) on standard nuScenes dataset.

Preparation

This implementation is built upon detr3d, and can be constructed as the install.md.

  • Environments
    Linux, Python==3.6.8, CUDA == 11.2, pytorch == 1.9.0, mmdet3d == 0.17.1

  • Detection Data
    Follow the mmdet3d to process the nuScenes dataset (https://github.com/open-mmlab/mmdetection3d/blob/master/docs/en/data_preparation.md).

  • Segmentation Data
    Download Map expansion from nuScenes dataset (https://www.nuscenes.org/nuscenes#download). Extract the contents (folders basemap, expansion and prediction) to your nuScenes maps folder.
    Then build Segmentation dataset:

    cd tools
    python build-dataset.py
    

    If you want to train the segmentation task immediately, we privided the processed data ( HDmaps-final.tar ) at gdrive. The processed info files of segmentation can also be find at gdrive.

  • Pretrained weights
    To verify the performance on the val set, we provide the pretrained V2-99 weights. The V2-99 is pretrained on DDAD15M (weights) and further trained on nuScenes train set with FCOS3D. For the results on test set in the paper, we use the DD3D pretrained weights. The ImageNet pretrained weights of other backbone can be found here. Please put the pretrained weights into ./ckpts/.

  • After preparation, you will be able to see the following directory structure:

    PETR
    ├── mmdetection3d
    ├── projects
    │   ├── configs
    │   ├── mmdet3d_plugin
    ├── tools
    ├── data
    │   ├── nuscenes
    │     ├── HDmaps-nocover
    │     ├── ...
    ├── ckpts
    ├── README.md
    

Train & inference

cd PETR

You can train the model following:

tools/dist_train.sh projects/configs/petr/petr_r50dcn_gridmask_p4.py 8 --work-dir work_dirs/petr_r50dcn_gridmask_p4/

You can evaluate the model following:

tools/dist_test.sh projects/configs/petr/petr_r50dcn_gridmask_p4.py work_dirs/petr_r50dcn_gridmask_p4/latest.pth 8 --eval bbox

Visualize

You can generate the reault json following:

./tools/dist_test.sh projects/configs/petr/petr_vovnet_gridmask_p4_800x320.py work_dirs/petr_vovnet_gridmask_p4_800x320/latest.pth 8 --out work_dirs/pp-nus/results_eval.pkl --format-only --eval-options 'jsonfile_prefix=work_dirs/pp-nus/results_eval'

You can visualize the 3D object detection following:

python3 tools/visualize.py

Main Results

PETR: We provide some results on nuScenes val set with pretrained models. These model are trained on 8x 2080ti without cbgs. Note that the models and logs are also available at Baidu Netdisk with code petr.

configmAPNDStrainingconfigdownload
PETR-r50-c5-1408x51230.5%35.0%18hoursconfiglog / gdrive
PETR-r50-p4-1408x51231.70%36.7%21hoursconfiglog / gdrive
PETR-vov-p4-800x32037.8%42.6%17hoursconfiglog / gdrive
PETR-vov-p4-1600x64040.40%45.5%36hoursconfiglog / gdrive

PETRv2: We provide a 3D object detection baseline and a BEV segmentation baseline with two frames. The model is trained on 8x 2080ti without cbgs. The processed info files contain 30 previous frames, whose transformation matrix is aligned with the current frame. The info files, models and logs are also available at Baidu Netdisk with code petr.

configmAPNDStrainingconfigdownload
PETRv2-vov-p4-800x32041.0%50.3%30hoursconfiglog / gdrive
configDriveLaneVehiclebackboneconfigdownload
PETRv2_BEVseg85.6%49.0%46.3%V2-99configlog / gdrive
configF-scoreX-nearX-farZ-nearZ-farbackboneconfigdownload
PETRv2_3DLane61.2%0.4000.5730.2650.413V2-99

StreamPETR: Stream-PETR achieves significant performance improvements without introducing extra computation cost, compared to the single-frame baseline.

configmAPNDSFPS-Pytorchconfigdownload
StreamPETR-r50-704x25645.0%55.0%31.7/s

Acknowledgement

Many thanks to the authors of mmdetection3d and detr3d .

Citation

If you find this project useful for your research, please consider citing:

@article{liu2022petr,
  title={Petr: Position embedding transformation for multi-view 3d object detection},
  author={Liu, Yingfei and Wang, Tiancai and Zhang, Xiangyu and Sun, Jian},
  journal={arXiv preprint arXiv:2203.05625},
  year={2022}
}
@article{liu2022petrv2,
  title={PETRv2: A Unified Framework for 3D Perception from Multi-Camera Images},
  author={Liu, Yingfei and Yan, Junjie and Jia, Fan and Li, Shuailin and Gao, Qi and Wang, Tiancai and Zhang, Xiangyu and Sun, Jian},
  journal={arXiv preprint arXiv:2206.01256},
  year={2022}
}

Contact

If you have any questions, feel free to open an issue or contact us at liuyingfei@megvii.com, yanjunjie@megvii.com or

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号