Skip to content
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

make compatible with ConfigDict and dict #8942

Merged
merged 2 commits into from
Oct 18, 2022

Conversation

MambaWong
Copy link
Contributor

@MambaWong MambaWong commented Oct 5, 2022

If AnchorHead is used as the net head and dict is used as the train_cfg parameter, an error will be reported.
That is because dict does not support python object attributes interface like train_cfg.assigner, but ConfigDict does.

cfg = dict(
    type='mmdet.AnchorHead',
    num_classes=80,
    in_channels=256,
    train_cfg=dict(
        assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.5,
                      neg_iou_thr=0.3)))

anchor_head = MODELS.build(cfg)

AttributeError: class AnchorHead in mmdet/models/dense_heads/anchor_head.py: 'dict' object has no attribute 'assigner'

@ZwwWayne ZwwWayne assigned BIGWangYuDong and unassigned jbwang1997 Oct 8, 2022
@ZwwWayne ZwwWayne requested a review from RangiLyu October 8, 2022 02:46
@ZwwWayne ZwwWayne added this to the 3.0.0rc2 milestone Oct 8, 2022
@ZwwWayne
Copy link
Collaborator

ZwwWayne commented Oct 8, 2022

Hi @MambaWong ,
Thanks for your kind PR. Could elaborate more in the PR message to indicate its necessity? For example, in which case the dict will be passed to the head

@BIGWangYuDong
Copy link
Collaborator

BIGWangYuDong commented Oct 12, 2022

LGTM, we can check all codes to avoid this potential error. Such as in gfl_head, mask2former_head, etc.

@RangiLyu RangiLyu added the v-3.x label Oct 14, 2022
@ZwwWayne ZwwWayne merged commit 71a5081 into open-mmlab:dev-3.x Oct 18, 2022
MambaWong added a commit to MambaWong/mmdetection-1 that referenced this pull request Oct 20, 2022
… heads (open-mmlab#8942)

* make compatible with `ConfigDict` and `dict`

* update
MambaWong added a commit to MambaWong/mmdetection-1 that referenced this pull request Oct 21, 2022
… heads (open-mmlab#8942)

* make compatible with `ConfigDict` and `dict`

* update
MambaWong added a commit to MambaWong/mmdetection-1 that referenced this pull request Oct 22, 2022
… heads (open-mmlab#8942)

* make compatible with `ConfigDict` and `dict`

* update
MambaWong added a commit to MambaWong/mmdetection-1 that referenced this pull request Oct 22, 2022
… heads (open-mmlab#8942)

* make compatible with `ConfigDict` and `dict`

* update
@MambaWong MambaWong deleted the AnchorHead branch November 6, 2022 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants