Apache License 2.0

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

UniAD:把「规划」写进损失函数,端到端自动驾驶的一次范式转向

项目背景与痛点

传统自动驾驶系统是一条流水线:感知 → 预测 → 规划 → 控制。每个环节单独训练、单独评测,中间通过人工定义的接口通信——检测框、车道线矢量、预测轨迹。这套架构在工业界被验证了十几年,但它有两个难以根治的问题。

第一是误差级联。如果感知漏掉一个行人,预测层无从修正,规划层只能基于残缺的世界模型做出决策,而错误一旦发生就不可逆。第二是目标错位。感知模块优化的是 mAP,预测模块优化的是 minADE,真正的下游目标——自车不碰撞、舒适,安全地到达终点——从来没有出现在上游的损失函数里。感知学会识别“一切物体”,却不知道规划器只在乎其中一部分。

UniAD(CVPR 2023 Best Paper)的出发点很明确:不再把自动驾驶拆成若干独立任务,而是把所有中间任务统一到一个以规划为终点的网络里,让梯度从规划端一路反传到感知端。论文标题里的 “Planning-oriented” 就是这一主张的宣言。

核心技术揭秘

UniAD 的结构可以理解为“一次前向传播,穿过整条决策链”。所有模块通过**查询(Query)**这一轻量载体串联,而不是通过稠密的中间表征(如整张 BEV 分割图)传递信息。这是它设计上最聪明的地方:query 携带的是“任务需要的信息”,而非“所有信息”,避免了表征被稀释。

graph TD A[多视角环视图像<br/>6 路相机] --> B[图像骨干网络<br/>ResNet-101] B --> C[BEV 特征编码器<br/>时序融合] C --> D[TrackFormer<br/>检测与跟踪] C --> E[MapFormer<br/>在线地图构建] D --> F[MotionFormer<br/>多模态轨迹预测] E --> F F --> G[OccFormer<br/>占用栅格预测] F --> H[Planner<br/>自车轨迹规划] G --> H H --> I[多任务损失联合优化] I -->|"梯度反传"| C

具体到数据流:6 路环视图像先经 CNN 骨干提取特征,再由 BEV 编码器投影到统一的鸟瞰图坐标系(论文实现为 200×200 的 BEV 网格),并通过时序自注意力融合历史帧,解决遮挡与测距问题。此后五组 query 依次登场:

  • Track Query 逐帧继承上一帧的实例身份,实现检测与跟踪的一体化,天然免除了跨帧关联的匈牙利匹配;
  • Map Query 在线生成车道线、路口等矢量元素,不依赖离线高清地图;
  • Motion Query 为每个 agent 生成 K 条候选未来轨迹,用 winner-takes-all 损失逼迫不同 mode 覆盖不同意图,避免回归到“平均轨迹”这一经典陷阱;
  • Occ Query 预测未来若干帧的占用栅格,为规划提供稠密几何约束;
  • Plan Query 只输出自车轨迹,但它受到的约束最严——既要拟合人类驾驶行为,又要通过占用预测做碰撞惩罚。

工程上还有一处值得注意的细节:UniAD 采用两阶段训练。感知模块收敛慢,若一上来就端到端联合优化,规划损失会把尚未成形的感知表征带偏。因此先分模块预训练,再解冻做联合微调。这不算学术上的新奇点,却是让整套框架能够真正跑通的关键决策。

功能亮点与差异

与 TransFuser、ST-P3 这类“隐式端到端”方案相比,UniAD 最大的差异在于保留了显式的中间任务表征。它不是一个输入图像、输出轨迹的黑箱,中间的检测框、地图、预测轨迹全部可见、可评测、可干预。这在上车审查时价值极高——出了问题,你能定位到是感知漏检还是规划过于激进。

与模块化管线相比,它的优势是信息无损与梯度贯通。规划端的碰撞损失可以反传,提示感知模块“这类物体对我更重要”,这是任何串行架构都做不到的。同时,逐级 Query 传递极大压缩了模块间的通信开销,比堆叠稠密 BEV 分割的方案更节省显存。

应用场景与落地建议

UniAD 最现实的定位是研究基线、算法预研平台、闭环仿真中的上游决策模型。它全套基于 nuScenes,代码结构清晰、模块可拆,非常适合做端到端方案的对照实验。

但要真正上车,有几个坑必须提前踩过:

  1. 实时性。多相机 + 时序 BEV + 五组 Transformer 解码器,推理开销远超 10Hz 的规划周期要求。生产环境必须做量化、裁剪时序队列长度、降低 BEV 分辨率,或者把感知部分蒸馏到轻量骨干上。
  2. 开环不等于闭环。nuScenes 上的规划评测是开环模仿学习,模型看到的是人类驾驶的历史轨迹,容易产生因果混淆(causal confusion)——比如把“前车减速”误学成“我也该减速”。开环指标好,不代表闭环不撞车,必须用 CARLA 或自建仿真做闭环验证。
  3. 标注依赖。多任务联合训练意味着你需要检测、跟踪、地图、占用四套标注同时对齐,数据成本远高于单任务管线。
  4. 兜底机制不可省。即便端到端,也建议保留一层基于规则的 safety fallback,对规划输出做可行性校验后再下发控制。

综合评价

优点:架构设计优雅,Query 串联的思路兼具效率与可解释性;规划导向的损失设计切中模块化管线的根本痛点;论文与代码质量都属上乘,是端到端自动驾驶方向少有的“能复现的 Best Paper”。

缺点:算力门槛高,距离实时部署有明显差距;强依赖 nuScenes 的多任务标注与固定传感器配置,跨数据集迁移成本不低;开环评测的说服力有限,安全性的真正证据仍待闭环验证。

一句话总结:UniAD 不是一辆能开上路的车,而是一份关于“自动驾驶网络应该长什么样”的高质量答卷。它证明了把规划目标写进损失函数是可行的,接下来的问题,是怎么把它压进车规级芯片里。

关于

GitHub 原始描述(英文)

[CVPR 2023 Best Paper Award] Planning-oriented Autonomous Driving

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

Dockerfile
Python
Shell

Release

README

Planning-oriented Autonomous Driving

arXiv | Video | Poster | Slides

https://github.com/OpenDriveLab/UniAD/assets/48089846/bcf685e4-2471-450e-8b77-e028a46bd0f7



teaser

Table of Contents:

  1. Highlights
  2. News
  3. Getting Started
  4. Results and Models
  5. TODO List
  6. License
  7. Citation
  8. 🔥 See Also: GenAD & Vista

Highlights

  • :oncoming_automobile: Planning-oriented philosophy: UniAD is a Unified Autonomous Driving algorithm framework following a planning-oriented philosophy. Instead of standalone modular design and multi-task learning, we cast a series of tasks, including perception, prediction and planning tasks hierarchically.
  • :trophy: SOTA performance: All tasks within UniAD achieve SOTA performance, especially prediction and planning (motion: 0.71m minADE, occ: 63.4% IoU, planning: 0.31% avg.Col)

News

  • Paper Title Change: To avoid confusion with the “goal-point” navigation in Robotics, we change the title from “Goal-oriented” to “Planning-oriented” suggested by Reviewers. Thank you!

  • Planning Metric: Discussion [Ref: https://github.com/OpenDriveLab/UniAD/issues/29]: Clarification and Notice regarding open-loop planning results comparison.

  • 2024/08/27 New feature: Implementation for CARLA and closed-loop evaluation on CARLA Leaderboard 2.0 scenarios are available in Bench2Drive.

  • 2023/08/03 Bugfix [Commit]: Previously, the visualized planning results were in opposition on the x axis, compared to the ground truth. Now it’s fixed.

  • 2023/06/12 Bugfix [Ref: https://github.com/OpenDriveLab/UniAD/issues/21]: Previously, the performance of the stage1 model (track_map) could not be replicated when trained from scratch, due to mistakenly adding loss_past_traj and freezing img_neck and BN. By removing loss_past_traj and unfreezing img_neck and BN in training, the reported results could be reproduced (AMOTA: 0.393, stage1_train_log).

  • 2023/04/18 New feature: You can replace BEVFormer with other BEV Encoding methods, e.g., LSS, as long as you provide the bev_embed and bev_pos in track_train and track_inference. Make sure your bevs and ours are of the same shape.

  • 2023/04/18 Base-model checkpoints are released.

  • 2023/03/29 Code & model initial release v1.0.

  • 2023/03/21 🌟🌟 UniAD is accepted by CVPR 2023, as an Award Candidate (12 out of 2360 accepted papers)!

  • 2022/12/21 UniAD paper is available on arXiv.

Getting Started

Results and Pre-trained Models

UniAD is trained in two stages. Pretrained checkpoints of both stages will be released and the results of each model are listed in the following tables.

Stage1: Perception training

We first train the perception modules (i.e., track and map) to obtain a stable weight initlization for the next stage. BEV features are aggregated with 5 frames (queue_length = 5).

Method Encoder Tracking
AMOTA
Mapping
IoU-lane
config Download
UniAD-B R101 0.390 0.297 base-stage1 base-stage1

Stage2: End-to-end training

We optimize all task modules together, including track, map, motion, occupancy and planning. BEV features are aggregated with 3 frames (queue_length = 3).

Method Encoder Tracking
AMOTA
Mapping
IoU-lane
Motion
minADE
Occupancy
IoU-n.
Planning
avg.Col.
config Download
UniAD-B R101 0.363 0.313 0.705 63.7 0.29 base-stage2 base-stage2

Checkpoint Usage

  • Download the checkpoints you need into UniAD/ckpts/ directory.
  • You can evaluate these checkpoints to reproduce the results, following the evaluation section in TRAIN_EVAL.md.
  • You can also initialize your own model with the provided weights. Change the load_from field to path/of/ckpt in the config and follow the train section in TRAIN_EVAL.md to start training.

Model Structure

The overall pipeline of UniAD is controlled by uniad_e2e.py which coordinates all the task modules in UniAD/projects/mmdet3d_plugin/uniad/dense_heads. If you are interested in the implementation of a specific task module, please refer to its corresponding file, e.g., motion_head.

License

All assets and code are under the Apache 2.0 license unless specified otherwise.

Citation

If you find our project useful for your research, please consider citing our paper and codebase with the following BibTeX:

@inproceedings{hu2023_uniad,
 title={Planning-oriented Autonomous Driving}, 
 author={Yihan Hu and Jiazhi Yang and Li Chen and Keyu Li and Chonghao Sima and Xizhou Zhu and Siqi Chai and Senyao Du and Tianwei Lin and Wenhai Wang and Lewei Lu and Xiaosong Jia and Qiang Liu and Jifeng Dai and Yu Qiao and Hongyang Li},
 booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
 year={2023},
}
@misc{contributors2023_uniadrepo,
  title={Planning-oriented Autonomous Driving},
  author={UniAD contributors},
  howpublished={\url{https://github.com/OpenDriveLab/UniAD}},
  year={2023}
}

Awesome

🔥 See Also

We are thrilled to launch our recent line of works: GenAD and Vista, to advance driving world models with the largest driving video dataset collected from the web - OpenDV.

GenAD: Generalized Predictive Model for Autonomous Driving (CVPR’24, Highlight ⭐)

Vista: A Generalizable Driving World Model with High Fidelity and Versatile Controllability 🌏

评论

暂无评论