Enhanced Training of Query-Based Object Detection via Selective Query Recollection arxiv
Enhanced Training of Query-Based Object Detection via Selective Query Recollection
Fangyi Chen, Han Zhang, Kai Hu, Yu-Kai Huang, Chenchen Zhu, Marios Savvides
Carnegie Mellon University, Meta AI
2023.07 We support SQR-DAB-DETR at detrex codebase.
2023.06 We fixed an issue in the inference of SQR-Deformable DETR, which logically exists but does not impact the final results.
2023.03 This work has been accepted by CVPR 2023.
2023.03 The experiments and code on SQR-adamixer and SQR-Deformable DETR have been released.
2022.12 The code is available now.
🌧 One phenomenon where query-based object detectors mispredict at the last decoding stage but correctly predict at intermediate stages.
The decoding procedure of DETR implies that detection should be stage-by-stage enhanced in terms of IOU and confidence score. Indeed, monotonically improved AP is empirically achieved by this procedure. However, when visualizing the stage-wise predictions, we surprisingly observe that decoder makes mistakes in a decent proportion of cases where the later stages degrade true- positives and upgrade false-positives from the former stages.
- The responsibility that each stage takes is unbalanced, while supervision applied to them is analogous.
- Due to the sequential structure of the decoder, an intermediate query refined by a stage - no matter this refinement brings positive or negative effects - will be cascaded to the following stage
As a training strategy that fit most query-based object detectors (DETR family), SQR cumulatively collects intermediate queries as stages go deeper, and feeds the collected queries to the downstream stages aside from the sequential structure.
This repo provide the implementation of SQR-Adamixer and SQR-deformable DETR. The code structure follows the MMDetection framework. Adamixer is a typical query-based object detector that enjoys fast convergence and high AP performance. Deformable DETR is known for its creative deformable attention module that mitigates the slow convergence and high complexity issues of DETR.
Our config file lies in configs/sqr folder.
We provide two implementation instances of SQR-adamixer in this repo, one is in /mmdet/models/roi_heads/adamixer_decoder_Qrecycle.py, which might be slower for training but require less GPU memory (and easy to understand the logic). Another is in /mmdet/models/roi_heads/adamixer_decoder_Qrecycle_optimize.py, which is much faster than the former (and highly recommended for using) but has higher requirement on GPU memory.
Similarly, We provide two implementation instances of SQR-deformable DETR in QRDeformableDetrTransformerDecoder
in /mmdet/models/utils/transformer.py. Named as forward
and forward_slow
, separately. Please also check this issue and the QRDeformableDETRHead
in /mmdet/models/dense_heads/QR_deformable_detr_head.py where the recollected query is aligned with stages during training. Please note that SQR is only a training strategy that does not affect/change testing pipeline.
We test our models under python=3.7, pytorch=1.9.1, cuda=11.1, mmcv=1.3.3
.
NOTE:
Please use mmcv_full==1.3.3
and pytorch>=1.5.0
for correct reproduction.
- Clone this repo
git clone https://github.com/Fangyi-Chen/SQR.git
cd SQR
- Create a conda env and activate it
conda create -n sqr-detr python=3.7 -y
conda activate sqr-detr
- Install Pytorch and torchvision
Follow the instruction on https://pytorch.org/get-started/locally/.
# an example:
conda install pytorch==1.9.1 torchvision==0.10.1 torchaudio==0.9.1 cudatoolkit=11.1 -c pytorch -c conda-forge
- Install mmcv
pip install mmcv-full=1.3.3 --no-cache-dir
- Install mmdet
pip install -r requirements/build.txt
pip install -v -e . # or "python setup.py develop"
Please see get_started.md for the basic usage of MMDetection.
#q | AP | AP50 | AP75 | APs | APm | APl | model | cfg | |
---|---|---|---|---|---|---|---|---|---|
SQR-Adamixer-R50 | 100 | 44.5 | 63.2 | 47.8 | 25.7 | 47.4 | 60.2 | ckpt | cfg |
SQR-Adamixer-R101-7stages | 300 | 49.8 | 68.8 | 54.0 | 32.0 | 53.4 | 65.1 | ckpt | cfg |
SQR-Deformable-DETR | 300 | 45.8 | 64.7 | 49.8 | 28.2 | 49.4 | 60.0 | ckpt | cfg |
If you find SQR useful, please use the following entry to cite us:
@InProceedings{Chen_2023_CVPR,
author = {Chen, Fangyi and Zhang, Han and Hu, Kai and Huang, Yu-Kai and Zhu, Chenchen and Savvides, Marios},
title = {Enhanced Training of Query-Based Object Detection via Selective Query Recollection},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2023},
pages = {23756-23765}
}
The following begins the original mmdetection README.md file
News: We released the technical report on ArXiv.
Documentation: https://mmdetection.readthedocs.io/
English | 简体中文
MMDetection is an open source object detection toolbox based on PyTorch. It is a part of the OpenMMLab project.
The master branch works with PyTorch 1.3+. The old v1.x branch works with PyTorch 1.1 to 1.4, but v2.0 is strongly recommended for faster speed, higher performance, better design and more friendly usage.
-
Modular Design
We decompose the detection framework into different components and one can easily construct a customized object detection framework by combining different modules.
-
Support of multiple frameworks out of box
The toolbox directly supports popular and contemporary detection frameworks, e.g. Faster RCNN, Mask RCNN, RetinaNet, etc.
-
High efficiency
All basic bbox and mask operations run on GPUs. The training speed is faster than or comparable to other codebases, including Detectron2, maskrcnn-benchmark and SimpleDet.
-
State of the art
The toolbox stems from the codebase developed by the MMDet team, who won COCO Detection Challenge in 2018, and we keep pushing it forward.
Apart from MMDetection, we also released a library mmcv for computer vision research, which is heavily depended on by this toolbox.
The mmdetection project is released under the Apache 2.0 license.
v2.12.0 was released in 01/05/2021. Please refer to changelog.md for details and release history. A comparison between v1.x and v2.0 codebases can be found in compatibility.md.
Results and models are available in the model zoo.
Supported backbones:
- ResNet (CVPR'2016)
- ResNeXt (CVPR'2017)
- VGG (ICLR'2015)
- HRNet (CVPR'2019)
- RegNet (CVPR'2020)
- Res2Net (TPAMI'2020)
- ResNeSt (ArXiv'2020)
Supported methods:
- RPN (NeurIPS'2015)
- Fast R-CNN (ICCV'2015)
- Faster R-CNN (NeurIPS'2015)
- Mask R-CNN (ICCV'2017)
- Cascade R-CNN (CVPR'2018)
- Cascade Mask R-CNN (CVPR'2018)
- SSD (ECCV'2016)
- RetinaNet (ICCV'2017)
- GHM (AAAI'2019)
- Mask Scoring R-CNN (CVPR'2019)
- Double-Head R-CNN (CVPR'2020)
- Hybrid Task Cascade (CVPR'2019)
- Libra R-CNN (CVPR'2019)
- Guided Anchoring (CVPR'2019)
- FCOS (ICCV'2019)
- RepPoints (ICCV'2019)
- Foveabox (TIP'2020)
- FreeAnchor (NeurIPS'2019)
- NAS-FPN (CVPR'2019)
- ATSS (CVPR'2020)
- FSAF (CVPR'2019)
- PAFPN (CVPR'2018)
- Dynamic R-CNN (ECCV'2020)
- PointRend (CVPR'2020)
- CARAFE (ICCV'2019)
- DCNv2 (CVPR'2019)
- Group Normalization (ECCV'2018)
- Weight Standardization (ArXiv'2019)
- OHEM (CVPR'2016)
- Soft-NMS (ICCV'2017)
- Generalized Attention (ICCV'2019)
- GCNet (ICCVW'2019)
- Mixed Precision (FP16) Training (ArXiv'2017)
- InstaBoost (ICCV'2019)
- GRoIE (ICPR'2020)
- DetectoRS (ArXix'2020)
- Generalized Focal Loss (NeurIPS'2020)
- CornerNet (ECCV'2018)
- Side-Aware Boundary Localization (ECCV'2020)
- YOLOv3 (ArXiv'2018)
- PAA (ECCV'2020)
- YOLACT (ICCV'2019)
- CentripetalNet (CVPR'2020)
- VFNet (ArXix'2020)
- DETR (ECCV'2020)
- Deformable DETR (ICLR'2021)
- CascadeRPN (NeurIPS'2019)
- SCNet (AAAI'2021)
- AutoAssign (ArXix'2020)
- YOLOF (CVPR'2021)
Some other methods are also supported in projects using MMDetection.
Please refer to get_started.md for installation.
Please see get_started.md for the basic usage of MMDetection. We provide colab tutorial, and full guidance for quick run with existing dataset and with new dataset for beginners. There are also tutorials for finetuning models, adding new dataset, designing data pipeline, customizing models, customizing runtime settings and useful tools.
Please refer to FAQ for frequently asked questions.
We appreciate all contributions to improve MMDetection. Please refer to CONTRIBUTING.md for the contributing guideline.
MMDetection is an open source project that is contributed by researchers and engineers from various colleges and companies. We appreciate all the contributors who implement their methods or add new features, as well as users who give valuable feedbacks. We wish that the toolbox and benchmark could serve the growing research community by providing a flexible toolkit to reimplement existing methods and develop their own new detectors.
If you use this toolbox or benchmark in your research, please cite this project.
@article{mmdetection,
title = {{MMDetection}: Open MMLab Detection Toolbox and Benchmark},
author = {Chen, Kai and Wang, Jiaqi and Pang, Jiangmiao and Cao, Yuhang and
Xiong, Yu and Li, Xiaoxiao and Sun, Shuyang and Feng, Wansen and
Liu, Ziwei and Xu, Jiarui and Zhang, Zheng and Cheng, Dazhi and
Zhu, Chenchen and Cheng, Tianheng and Zhao, Qijie and Li, Buyu and
Lu, Xin and Zhu, Rui and Wu, Yue and Dai, Jifeng and Wang, Jingdong
and Shi, Jianping and Ouyang, Wanli and Loy, Chen Change and Lin, Dahua},
journal= {arXiv preprint arXiv:1906.07155},
year={2019}
}
- MMCV: OpenMMLab foundational library for computer vision.
- MMClassification: OpenMMLab image classification toolbox and benchmark.
- MMDetection: OpenMMLab detection toolbox and benchmark.
- MMDetection3D: OpenMMLab's next-generation platform for general 3D object detection.
- MMSegmentation: OpenMMLab semantic segmentation toolbox and benchmark.
- MMAction2: OpenMMLab's next-generation action understanding toolbox and benchmark.
- MMTracking: OpenMMLab video perception toolbox and benchmark.
- MMPose: OpenMMLab pose estimation toolbox and benchmark.
- MMEditing: OpenMMLab image and video editing toolbox.
- MMOCR: A Comprehensive Toolbox for Text Detection, Recognition and Understanding.
- MMGeneration: OpenMMLab image and video generative models toolbox.