8000 [Feat] Add DINO on MMDetection 3.x by Li-Qingyun · Pull Request #9149 · open-mmlab/mmdetection · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Feat] Add DINO on MMDetection 3.x #9149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Dec 19, 2022

Conversation

Li-Qingyun
Copy link
Contributor
@Li-Qingyun Li-Qingyun commented Oct 27, 2022

Motivation

Implement the results in the paper "DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection" with mmdetection. The original code has released.

Remark

For DINO implementation, our procedure includes three steps:

Besides, there are also brother PRs #8544, #9405, #8533, #9252 of two algorithms (Condition DETR and DAB DETR) developed in parallel.

I'm a student contributor in GitLink Code Camp. And this is my first experience of contributing a PR to the open source community. I'm trying hard to make DINO available in mmdetection as soon as possible.

If your project allows to use mmdetection2.x, you can refer to #8362 for the version that has been finished but not merged.

@jshilong
Copy link
Collaborator
jshilong commented Dec 9, 2022
  1. Please merge the refacor-detr after [Refactor] Change to BNC data flow for all DETRs #9460 is merged then change the data flow to BNC
  2. please remove all 91 classes related codes

Li-Qingyun and others added 8 commits December 9, 2022 21:12
…add-dino-3.x

# Conflicts:
#	mmdet/models/dense_heads/deformable_detr_head.py
#	mmdet/models/dense_heads/detr_head.py
#	mmdet/models/detectors/base_detr.py
#	mmdet/models/detectors/deformable_detr.py
#	mmdet/models/detectors/detr.py
#	mmdet/models/layers/transformer/deformable_detr_transformer.py
#	mmdet/models/layers/transformer/detr_transformer.py
@Li-Qingyun
Copy link
Contributor Author
  1. Please merge the refacor-detr after [Refactor] Change to BNC data flow for all DETRs #9460 is merged then change the data flow to BNC
  2. please remove all 91 classes related codes

The merge has been finished. The inference mAP of DINO_4s_12e on the new codebase has been aligned. @jshilong

@ZwwWayne ZwwWayne requested a review from RangiLyu December 12, 2022 03:58
Copy link
Collaborator
@jshilong jshilong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZwwWayne ZwwWayne merged commit 6e7f1e6 into open-mmlab:refactor-detr Dec 19, 2022
jshilong pushed a commit that referenced this pull request Jan 19, 2023
* feat: add config of DINO_4s_R50_50e

* feat: add detector file of DINO

* feat: add head file of DINO

* fix: align the inference results

* fix: align the loss

* refactor: move decoder to layers

* small modifications to resolve recent conversations

* refactor: rewrite device manner and other small modifications

* refactor: refactor multiple mode of pre_decoder

* doc: complementary the docstring of dino.py

* refactor & doc: refactor DINOHead and add some docstring of the dino_head.py

* fix & doc: fix bugs and add docs of dino_transformer.py

* refactor: rewrite CdnQueryGenerator

* refactor: refactor CdnQueryGenerator.

* refactor: modify cdn

* refactor: rewrite and add docstring to CdnQueryGenerator.generate_dn_bbox_query

* doc: fix return format

* doc: add docstring of CdnQueryGenerator

* feat: add 91-cls configs of detr and deformable detr

* refactor: rewrite generate_dn_mask

* refactor: rewrite collate_dn_queries

* fix & doc: fix bug of get_dn_target and add some docstring

* doc: write docstring of DINOHead

* feat: add configs of R50-24e and R50-36e

* fix: align loss

* fix: delete original __call__ of CdnQueryGenerator

* fix: add init of query_embedding

* fix: fix typo of dino config

* fix: move convert_coordinate_to_encoding and modify num_query->num_queries num_key->num_keys

* resolve the conversations

* delete some TODO

* add yapf diasble to layers/__init__.py

* fix unit test

* commit modification in pr of DINO

* fix data format from nbc to bnc in detr and deformable-detr

* fix 'gen_encoder_output_proposals' for two-stage deformable-detr

* fix 'gen_encoder_output_proposals' for two-stage deformable-detr

* set 'batch_first' to True in deformable attention

* fix error

* fix ut

* add assert for batch_first

* remove all 91cls-related codes

* doc: add loss_by_feat comment

* modify pre_decoder of DeformableDETR

* delete useless comments

* refactor: change to BNC data flow for DINO

* ut: add unit test of DINO

* add README.md of dino

* fix wrong box_noise_scale doc

* fix __init__.py of layer

Co-authored-by: KeiChiTse <xqz20@mails.tsinghua.edu.cn>
@Li-Qingyun
Copy link
Contributor Author
Li-Qingyun commented Feb 8, 2023

A DINO-5scale-R50 config @Czm369

_base_ = './dino-4scale_r50_8xb2-12e_coco.py'
model = dict(
    num_feature_levels=5,
    backbone=dict(out_indices=(0, 1, 2, 3)),
    neck=dict(in_channels=[256, 512, 1024, 2048], num_outs=5),
    encoder=dict(layer_cfg=dict(self_attn_cfg=dict(num_levels=5))),
    decoder=dict(layer_cfg=dict(cross_attn_cfg=dict(num_levels=5))))
train_dataloader = dict(batch_size=1)

@Li-Qingyun Li-Qingyun deleted the add-dino-3.x branch February 17, 2023 09:01
yumion pushed a commit to yumion/mmdetection that referenced this pull request Jan 31, 2024
* feat: add config of DINO_4s_R50_50e

* feat: add detector file of DINO

* feat: add head file of DINO

* fix: align the inference results

* fix: align the loss

* refactor: move decoder to layers

* small modifications to resolve recent conversations

* refactor: rewrite device manner and other small modifications

* refactor: refactor multiple mode of pre_decoder

* doc: complementary the docstring of dino.py

* refactor & doc: refactor DINOHead and add some docstring of the dino_head.py

* fix & doc: fix bugs and add docs of dino_transformer.py

* refactor: rewrite CdnQueryGenerator

* refactor: refactor CdnQueryGenerator.

* refactor: modify cdn

* refactor: rewrite and add docstring to CdnQueryGenerator.generate_dn_bbox_query

* doc: fix return format

* doc: add docstring of CdnQueryGenerator

* feat: add 91-cls configs of detr and deformable detr

* refactor: rewrite generate_dn_mask

* refactor: rewrite collate_dn_queries

* fix & doc: fix bug of get_dn_target and add some docstring

* doc: write docstring of DINOHead

* feat: add configs of R50-24e and R50-36e

* fix: align loss

* fix: delete original __call__ of CdnQueryGenerator

* fix: add init of query_embedding

* fix: fix typo of dino config

* fix: move convert_coordinate_to_encoding and modify num_query->num_queries num_key->num_keys

* resolve the conversations

* delete some TODO

* add yapf diasble to layers/__init__.py

* fix unit test

* commit modification in pr of DINO

* fix data format from nbc to bnc in detr and deformable-detr

* fix 'gen_encoder_output_proposals' for two-stage deformable-detr

* fix 'gen_encoder_output_proposals' for two-stage deformable-detr

* set 'batch_first' to True in deformable attention

* fix error

* fix ut

* add assert for batch_first

* remove all 91cls-related codes

* doc: add loss_by_feat comment

* modify pre_decoder of DeformableDETR

* delete useless comments

* refactor: change to BNC data flow for DINO

* ut: add unit test of DINO

* add README.md of dino

* fix wrong box_noise_scale doc

* fix __init__.py of layer

Co-authored-by: KeiChiTse <xqz20@mails.tsinghua.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0