DETR3D: 3D Object Detection from Multi-view Images via 3D-to-2D Queries
DETR3D: 3D Object Detection from Multi-view Images via 3D-to-2D Queries
Abstract
We introduce a framework for multi-camera 3D object detection. In contrast to existing works, which estimate 3D bounding boxes directly from monocular images or use depth prediction networks to generate input for 3D object detection from 2D information, our method manipulates predictions directly in 3D space. Our architecture extracts 2D features from multiple camera images and then uses a sparse set of 3D object queries to index into these 2D features, linking 3D positions to multi-view images using camera transformation matrices. Finally, our model makes a bounding box prediction per object query, using a set-to-set loss to measure the discrepancy between the ground-truth and the prediction. This top-down approach outperforms its bottom-up counterpart in which object bounding box prediction follows per-pixel depth estimation, since it does not suffer from the compounding error introduced by a depth prediction model. Moreover, our method does not require post-processing such as non-maximum suppression, dramatically improving inference speed. We achieve state-of-the-art performance on the nuScenes autonomous driving benchmark.
Introduction
This directory contains the implementations of DETR3D (https://arxiv.org/abs/2110.06922). Our implementations are built on top of MMdetection3D. We have updated DETR3D to be compatible with latest mmdet3d-dev1.x. The codebase and config files have all changed to adapt to the new mmdet3d version. All previous pretrained models are verified with the result listed below. However, newly trained models are yet to be uploaded.
Environment Setup
We require the version of mmdet <= V3.0.0rc5. The mmdet later than V3.0.0rc5 has refactored DETR-series and its config file, but our configs and code are yet to be updated.
Train
Downloads the pretrained backbone weights to pretrained/
For example, to train DETR3D on 8 GPUs, please use
bash tools/dist_train.sh projects/DETR3D/configs/detr3d_res101_gridmask.py 8 --cfg-options load_from=pretrained/fcos3d.pth
Evaluation using pretrained models
Download the newly trained weights accordingly.
Backbone mAP NDS Download DETR3D, ResNet101 w/ DCN, evaluation on val set 35.5 42.8 model | log above, + CBGS, evaluation on val set 35.2 42.7 model | log DETR3D, VoVNet on trainval, evaluation on test set 41.4 48.1 model | log Testing
To test, use:
bash tools/dist_test.sh projects/DETR3D/configs/detr3d_res101_gridmask.py ${CHECKPOINT_PATH} 8
Converting old models (Optional)
For old models please refer to Object DGCNN & DETR3D
From v0.17.3 to v1.0.0, mmdet3d has changed its bbox representation. Given that Box(x,y,z,θ), we have x_new = y_old, y_new = x_old, θ_new = -θ_old - π/2.
Old models are trained on v0.17.3. Our regression branch outputs (cx,cy,w,l,cz,h,sin(θ),cos(θ),vx,vy). For a previous model which outputs y=[y0,y1,y2,y3,y4,y5,y6,y7,y8,y9], we get y_new = [...,y3,y2,...,-y7,-y6, ...]. So we should change the final Linear layer's weight accordingly.
To convert the old weights, please use
python projects/DETR3D/detr3d/old_detr3d_converter.py ${CHECKPOINT_DIR}/detr3d_resnet101.pth ${CHECKPOINT_DIR}/detr3d_r101_v1.0.0.pth --code_size 10
Citation
If you find this repo useful for your research, please consider citing the papers
@inproceedings{
detr3d,
title={DETR3D: 3D Object Detection from Multi-view Images via 3D-to-2D Queries},
author={Wang, Yue and Guizilini, Vitor and Zhang, Tianyuan and Wang, Yilun and Zhao, Hang and and Solomon, Justin M.},
booktitle={The Conference on Robot Learning ({CoRL})},
year={2021}
}
Checklist
Milestone 1: PR-ready, and acceptable to be one of the
projects/
.Finish the code
Basic docstrings & proper citation
Test-time correctness
A full README
Milestone 2: Indicates a successful model implementation.
Training-time correctness
Milestone 3: Good to be a part of our core package!
Type hints and docstrings
Unit tests
Code polishing
Metafile.yml
Move your modules into the core package following the codebase's file hierarchy structure.
Refactor your modules into the core package following the codebase's file hierarchy structure.