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

[Feature] Support TOOD: Task-aligned One-stage Object Detection (ICCV 2021 Oral) #6746

Merged
merged 18 commits into from
Dec 24, 2021

Conversation

RangiLyu
Copy link
Member

@RangiLyu RangiLyu commented Dec 9, 2021

TOOD: Task-aligned One-stage Object Detection

https://arxiv.org/abs/2108.07755

Introduction

One-stage object detection is commonly implemented by optimizing two sub-tasks: object classification and localization, using heads with two parallel branches, which might lead to a certain level of spatial misalignment in predictions between the two tasks. In this work, we propose a Task-aligned One-stage Object Detection (TOOD) that explicitly aligns the two tasks in a learning-based manner. First, we design a novel Task-aligned Head (T-Head) which offers a better balance between learning task-interactive and task-specific features, as well as a greater flexibility to learn the alignment via a task-aligned predictor. Second, we propose Task Alignment Learning (TAL) to explicitly pull closer (or even unify) the optimal anchors for the two tasks during training via a designed sample assignment scheme and a task-aligned loss. Extensive experiments are conducted on MS-COCO, where TOOD achieves a 51.1 AP at single-model single-scale testing. This surpasses the recent one-stage detectors by a large margin, such as ATSS (47.7 AP), GFL (48.2 AP), and PAA (49.0 AP), with fewer parameters and FLOPs. Qualitative results also demonstrate the effectiveness of TOOD for better aligning the tasks of object classification and localization.

overview

Checklist

  • Implement TOOD.
  • Align accuracy.
    tood_r50_fpn_1x_coco:
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.424
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=1000 ] = 0.595
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=1000 ] = 0.461
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=1000 ] = 0.251
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=1000 ] = 0.455
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=1000 ] = 0.555
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.614
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 ] = 0.614
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=1000 ] = 0.614
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=1000 ] = 0.416
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=1000 ] = 0.658
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=1000 ] = 0.779
  • Add unit tests.
  • Upload checkpoints.

@RangiLyu RangiLyu added WIP Working in progress planned feature labels Dec 9, 2021
@codecov
Copy link

codecov bot commented Dec 10, 2021

Codecov Report

Merging #6746 (0d6c0e2) into dev-v2.20.0 (eb1903f) will increase coverage by 0.33%.
The diff coverage is 85.15%.

Impacted file tree graph

@@               Coverage Diff               @@
##           dev-v2.20.0    #6746      +/-   ##
===============================================
+ Coverage        62.04%   62.37%   +0.33%     
===============================================
  Files              322      327       +5     
  Lines            25717    26122     +405     
  Branches          4356     4421      +65     
===============================================
+ Hits             15955    16293     +338     
- Misses            8913     8963      +50     
- Partials           849      866      +17     
Flag Coverage Δ
unittests 62.35% <85.15%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmdet/models/losses/focal_loss.py 69.33% <73.07%> (+2.06%) ⬆️
mmdet/models/detectors/tood.py 75.00% <75.00%> (ø)
mmdet/core/hook/set_epoch_info_hook.py 80.00% <80.00%> (ø)
mmdet/models/dense_heads/tood_head.py 83.39% <83.39%> (ø)
mmdet/core/bbox/assigners/task_aligned_assigner.py 93.65% <93.65%> (ø)
mmdet/core/bbox/assigners/__init__.py 100.00% <100.00%> (ø)
mmdet/core/hook/__init__.py 100.00% <100.00%> (ø)
mmdet/models/dense_heads/__init__.py 100.00% <100.00%> (ø)
mmdet/models/detectors/__init__.py 100.00% <100.00%> (ø)
mmdet/models/losses/gfocal_loss.py 97.36% <100.00%> (+0.87%) ⬆️
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb1903f...0d6c0e2. Read the comment docs.

@RangiLyu RangiLyu changed the base branch from master to dev-v2.20.0 December 10, 2021 05:18
@RangiLyu RangiLyu changed the title [WIP] Support TOOD: Task-aligned One-stage Object Detection (ICCV 2021 Oral) [Feature] Support TOOD: Task-aligned One-stage Object Detection (ICCV 2021 Oral) Dec 13, 2021
@RangiLyu RangiLyu removed the WIP Working in progress label Dec 13, 2021
@ZwwWayne ZwwWayne requested a review from hhaAndroid December 15, 2021 03:24
@RangiLyu RangiLyu requested a review from ZwwWayne December 24, 2021 06:19
@ZwwWayne ZwwWayne merged commit ec42990 into open-mmlab:dev-v2.20.0 Dec 24, 2021
@AronLin AronLin mentioned this pull request Dec 27, 2021
ZwwWayne pushed a commit that referenced this pull request Jul 18, 2022
… 2021 Oral) (#6746)

* [Feature] Support TOOD.

* update

* use assign result

* use assign result

* clean assigner

* add config

* add tood head unit test and fix device bug

* test assigner and fix empty gt error

* test hook

* add anchor-based cfg and readme

* update readme

* resolve comments

* resolve comment

* add metafile

* fix model index

* copyright

* resolve comments

* resolve comments
ZwwWayne pushed a commit to ZwwWayne/mmdetection that referenced this pull request Jul 19, 2022
… 2021 Oral) (open-mmlab#6746)

* [Feature] Support TOOD.

* update

* use assign result

* use assign result

* clean assigner

* add config

* add tood head unit test and fix device bug

* test assigner and fix empty gt error

* test hook

* add anchor-based cfg and readme

* update readme

* resolve comments

* resolve comment

* add metafile

* fix model index

* copyright

* resolve comments

* resolve comments
@RangiLyu RangiLyu deleted the tood branch December 17, 2022 03:41
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.

3 participants