Code Monkey home page Code Monkey logo

aedet's Introduction

AeDet: Azimuth-invariant Multi-view 3D Object Detection

Paper     Website

News

AeDet achieves SOTA on Camera-Only nuScenes Detection Task with 53.1% mAP and 62.0% NDS!

Introduction

Recent LSS-based multi-view 3D object detection has made tremendous progress, by processing the features in Brid-Eye-View (BEV) via the convolutional detector. However, the typical convolution ignores the radial symmetry of the BEV features and increases the difficulty of the detector optimization. To preserve the inherent property of the BEV features and ease the optimization, we propose an azimuth-equivariant convolution (AeConv) and an azimuth-equivariant anchor. The sampling grid of AeConv is always in the radial direction, thus it can learn azimuth-invariant BEV features. The proposed anchor enables the detection head to learn predicting azimuth-irrelevant targets. In addition, we introduce a camera-decoupled virtual depth to unify the depth prediction for the images with different camera intrinsic parameters. The resultant detector is dubbed Azimuth-equivariant Detector (AeDet). Extensive experiments are conducted on nuScenes, and AeDet achieves a 62.0% NDS, surpassing the recent multi-view 3D object detectors such as PETRv2 and BEVDepth by a large margin.

Method overview

method overview

Quick Start

Installation

Step 0. Install Pytorch (v1.9.0).

Step 1. Install MMDetection3D (v1.0.0rc4).

# install mmcv
pip install mmcv-full

# install mmdetection
pip install git+https://github.com/open-mmlab/mmdetection.git

# install mmsegmentation
pip install git+https://github.com/open-mmlab/mmsegmentation.git

# install mmdetection3d
cd AeDet/mmdetection3d
pip install -v -e .

Step 2. Install requirements.

pip install -r requirements.txt

Step 3. Install AeDet (gpu required).

python setup.py develop

Data preparation

Step 0. Download nuScenes official dataset.

Step 1. Symlink the dataset root to ./data/.

ln -s ${nuscenes root} ./data/

The directory will be as follows.

AeDet
├── data
│   ├── nuScenes
│   │   ├── maps
│   │   ├── samples
│   │   ├── sweeps
│   │   ├── v1.0-test
|   |   ├── v1.0-trainval

Step 2. Prepare infos.

python scripts/gen_info.py

Step 3. Prepare depth gt.

python scripts/gen_depth_gt.py

Tutorials

Train.

python ${EXP_PATH} --amp_backend native -b 8 --gpus 8 [--ckpt_path ${ORIGIN_CKPT_PATH}]

Eval.

python ${EXP_PATH} --ckpt_path ${EMA_CKPT_PATH} -e -b 8 --gpus 8

Results

Model Image size #Key frames CBGS mAP NDS Download
BEVDepth_R50 (Baseline) 256x704 1 0.315 0.367 --
BEVDepth_R50_2KEY (Baseline) 256x704 2 0.330 0.442 --
AeDet_R50 256x704 1 0.334 0.401 google
AeDet_R50_2KEY 256x704 2 0.359 0.473 google
AeDet_R50_2KEY_CBGS 256x704 2 0.381 0.502 google
AeDet_R101_2KEY_CBGS 512x1408 2 0.449 0.562 google

Acknowledgement

Thanks BEVDepth team and MMDetection3D team for the wonderful open source projects!

Citation

If you find AeDet useful in your research, please consider citing:

@inproceedings{feng2023aedet,
    title={AeDet: Azimuth-invariant Multi-view 3D Object Detection},
    author={Feng, Chengjian and Jie, Zequn and Zhong, Yujie and Chu, Xiangxiang and Ma, Lin},
    booktitle={Proceedings of the IEEE/CVF Computer Vision and Pattern Recognition},
    year={2023}
}

aedet's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aedet's Issues

ida和bda矩阵的意义是什么?

..\AeDet\layers\backbones\lss_fpn.py中有这样一段代码:

def get_geometry(self, sensor2ego_mat, intrin_mat, ida_mat, bda_mat):
    """Transfer points from camera coord to ego coord.

    Args:
        rots(Tensor): Rotation matrix from camera to ego.
        trans(Tensor): Translation matrix from camera to ego.
        intrins(Tensor): Intrinsic matrix.
        post_rots_ida(Tensor): Rotation matrix for ida.
        post_trans_ida(Tensor): Translation matrix for ida
        post_rot_bda(Tensor): Rotation matrix for bda.

    Returns:
        Tensors: points ego coord.
    """
    batch_size, num_cams, _, _ = sensor2ego_mat.shape

    # undo post-transformation
    # B x N x D x H x W x 3
    points = self.frustum
    ida_mat = ida_mat.view(batch_size, num_cams, 1, 1, 1, 4, 4)
    points = ida_mat.inverse().matmul(points.unsqueeze(-1))
    # cam_to_ego
    points = torch.cat(
        (points[:, :, :, :, :, :2] * points[:, :, :, :, :, 2:3],
         points[:, :, :, :, :, 2:]), 5)

    combine = sensor2ego_mat.matmul(torch.inverse(intrin_mat))
    points = combine.view(batch_size, num_cams, 1, 1, 1, 4,
                          4).matmul(points)
    if bda_mat is not None:
        bda_mat = bda_mat.unsqueeze(1).repeat(1, num_cams, 1, 1).view(
            batch_size, num_cams, 1, 1, 1, 4, 4)
        points = (bda_mat @ points).squeeze(-1)
    else:
        points = points.squeeze(-1)
    return points[..., :3]

any apply is appreciated!!

运行程序遇到以下报错,怎么解决呀?

Missing logger folder: outputs/aedet_lss_r50_256x704_128x128_24e_2key/lightning_logs
Restoring states from the checkpoint path at /home/ww/Coding/AeDet/data/nuscenes/nuscenes_12hz_infos_train.pkl
Traceback (most recent call last):
File "/home/ww/Coding/AeDet/exps/aedet/aedet_lss_r50_256x704_128x128_24e_2key.py", line 109, in
run_cli()
File "/home/ww/Coding/AeDet/exps/aedet/aedet_lss_r50_256x704_128x128_24e_2key.py", line 105, in run_cli
main(args)
File "/home/ww/Coding/AeDet/exps/aedet/aedet_lss_r50_256x704_128x128_24e_2key.py", line 75, in main
trainer.fit(model, ckpt_path=args.ckpt_path)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 771, in fit
self._call_and_handle_interrupt(
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 722, in _call_and_handle_interrupt
return self.strategy.launcher.launch(trainer_fn, *args, trainer=self, **kwargs)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/strategies/launchers/subprocess_script.py", line 93, in launch
return function(*args, **kwargs)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 812, in _fit_impl
results = self._run(model, ckpt_path=self.ckpt_path)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1180, in _run
self._restore_modules_and_callbacks(ckpt_path)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1140, in _restore_modules_and_callbacks
self._checkpoint_connector.resume_start(checkpoint_path)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/trainer/connectors/checkpoint_connector.py", line 84, in resume_start
self._loaded_checkpoint = self._load_and_validate_checkpoint(checkpoint_path)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/trainer/connectors/checkpoint_connector.py", line 88, in _load_and_validate_checkpoint
loaded_checkpoint = self.trainer.strategy.load_checkpoint(checkpoint_path)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/strategies/strategy.py", line 316, in load_checkpoint
return self.checkpoint_io.load_checkpoint(checkpoint_path)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/plugins/io/torch_plugin.py", line 85, in load_checkpoint
return pl_load(path, map_location=map_location)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/pytorch_lightning/utilities/cloud_io.py", line 47, in load
return torch.load(f, map_location=map_location)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/torch/serialization.py", line 608, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/home/ww/.conda/envs/aedet2/lib/python3.8/site-packages/torch/serialization.py", line 780, in _legacy_load
raise RuntimeError("Invalid magic number; corrupt file?")
RuntimeError: Invalid magic number; corrupt file?

CDN hyperparameters

@fcjian Hi, thanks for your great work.

I would like to know when using CDN, how to determine these hyperparameters for virtual depth. Could you please explain more?

如何解决这个环境问题?

unexpected key in source state_dict: fc.weight, fc.bias

Traceback (most recent call last):
File "/home/ww/Coding/AeDet/exps/aedet/aedet_lss_r101_512x1408_256x256_24e_2key.py", line 86, in
run_cli()
File "/home/ww/Coding/AeDet/exps/aedet/aedet_lss_r101_512x1408_256x256_24e_2key.py", line 82, in run_cli
main(args)
File "/home/ww/Coding/AeDet/exps/aedet/aedet_lss_r101_512x1408_256x256_24e_2key.py", line 38, in main
model = AeDetLightningModel(**vars(args))
File "/home/ww/Coding/AeDet/exps/aedet/aedet_lss_r101_512x1408_256x256_24e_2key.py", line 14, in init
super().init(**kwargs)
File "/home/ww/Coding/AeDet/exps/aedet/aedet_lss_r101_512x1408_256x256_24e.py", line 242, in init
self.model = AeDet(self.backbone_conf,
File "/home/ww/Coding/AeDet/models/aedet.py", line 24, in init
self.head = AeDetHead(**head_conf)
File "/home/ww/Coding/AeDet/layers/heads/aedet_head.py", line 67, in init
super(AeDetHead, self).init(
File "/home/ww/.conda/envs/aedet8/lib/python3.8/site-packages/mmdet3d/models/dense_heads/centerpoint_head.py", line 307, in init
self.bbox_coder = build_bbox_coder(bbox_coder)
File "/home/ww/.conda/envs/aedet8/lib/python3.8/site-packages/mmdet/core/bbox/builder.py", line 21, in build_bbox_coder
return build_from_cfg(cfg, BBOX_CODERS, default_args)
File "/home/ww/.conda/envs/aedet8/lib/python3.8/site-packages/mmcv/utils/registry.py", line 58, in build_from_cfg
raise KeyError(
KeyError: 'AeDetBBoxCoder is not in the bbox_coder registry'

any apply is appreciated!!

如何训练?

训练的时候出现以下问题:
(aedet) ww@server3090-X570-AORUS-PRO-WIFI:~/Coding/AeDet$ python /home/ww/Coding/AeDet/mmdetection3d/tools/train.py --amp_backend native -b 8 --gpus 1
usage: train.py [-h] [--work-dir WORK_DIR] [--resume-from RESUME_FROM]
[--auto-resume] [--no-validate]
[--gpus GPUS | --gpu-ids GPU_IDS [GPU_IDS ...] | --gpu-id
GPU_ID] [--seed SEED] [--diff-seed] [--deterministic]
[--options OPTIONS [OPTIONS ...]]
[--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]]
[--launcher {none,pytorch,slurm,mpi}]
[--local_rank LOCAL_RANK] [--autoscale-lr]
config
train.py: error: unrecognized arguments: --amp_backend -b 8

ae_offset计算相关

文件:AeDet-main\mmdetection3d\mmdet3d\ops\aeconv\aeconv.py 中
计算方位角偏差
ae_offset = torch.bmm(rot_matrix, conv_offset.transpose(1, 2)).transpose(1, 2) - conv_offset
想问下,最后的 - conv_offset 的含义是什么

About the CUDA error

My computer has CUDA11.3 installed. But when I ran the "python setup.py develop", I met a error that showed in the terminal:
No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda-11.3:/usr/local/cuda'
Compiling voxel_pooling_ext without CUDA
running develop
/home/ssz/anaconda3/envs/aedet/lib/python3.8/site-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.

But I do have the CUDA in the direction.

The expected code release date

Hi authors!
Thank you for sharing your great work preview!

I wonder when can I check the full code in your repository ?

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.