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

[MMSIG-21] Migrate Eqlv2 loss to MMDet 3.x #10120

Merged
merged 34 commits into from
May 8, 2023

Conversation

xin-li-67
Copy link
Contributor

Motivation

MMSIG task: Migrate EQLv2 loss implementation to MMDetection 3.x.

Modification

mmdet/models/losses/init.py
mmdet/models/losses/eqlv2_loss.py

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@xin-li-67 xin-li-67 changed the title Migrate Eqlv2 loss to MMDet 3.x [WIP] Migrate Eqlv2 loss to MMDet 3.x Apr 16, 2023
@xin-li-67
Copy link
Contributor Author

Original evaluation matrix:

bboxAP:  
Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.242
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=300 catIds=all] = 0.401
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=300 catIds=all] = 0.254
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.181
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.317
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.367
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.135
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.225
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.308
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.331
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.223
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.417
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.497
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.197
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.308
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.415
maskAP:
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.237
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=300 catIds=all] = 0.372
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=300 catIds=all] = 0.251
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.169
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.316
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.370
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.149
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.228
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.286
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.326
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.210
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.415
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.495
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.213
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.313
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.389

My evaluation result running on single RTX3090:

04/17 19:38:01 - mmengine - INFO - Evaluating bbox...
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.251
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=300 catIds=all] = 0.424
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=300 catIds=all] = 0.261
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.194
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.324
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.368
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.166
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.239
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.303
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.348
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.241
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.429
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.511
04/17 19:48:58 - mmengine - INFO - Evaluating segm...
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.246
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=300 catIds=all] = 0.397
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=300 catIds=all] = 0.259
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.176
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.326
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.369
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  r] = 0.187
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  c] = 0.236
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=  f] = 0.283
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=300 catIds=all] = 0.339
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     s | maxDets=300 catIds=all] = 0.222
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     m | maxDets=300 catIds=all] = 0.429
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=     l | maxDets=300 catIds=all] = 0.507
04/17 20:00:31 - mmengine - INFO - Epoch(val) [12][19809/19809]    lvis/bbox_AP: 0.2510  lvis/bbox_AP50: 0.4240  lvis/bbox_AP75: 0.2610  lvis/bbox_APs: 0.1940  lvis/bbox_APm: 0.3240  lvis/bbox_APl: 0.3680  lvis/bbox_APr: 0.1660  lvis/bbox_APc: 0.2390  lvis/bbox_APf: 0.3030  lvis/segm_AP: 0.2460  lvis/segm_AP50: 0.3970  lvis/segm_AP75: 0.2590  lvis/segm_APs: 0.1760  lvis/segm_APm: 0.3260  lvis/segm_APl: 0.3690  lvis/segm_APr: 0.1870  lvis/segm_APc: 0.2360  lvis/segm_APf: 0.2830  data_time: 0.0368  time: 0.3822

My training config is configs/lvis/mask-rcnn_r50_fpn_sample1e-3_eqlv2_8x2_1x_lvis_v1.py :

_base_ = './mask-rcnn_r50_fpn_sample1e-3_ms-1x_lvis-v1.py'

model = dict(
    roi_head=dict(
        bbox_head=dict(
            loss_cls=dict(type="EQLV2Loss", use_sigmoid=True))),
)

train_cfg = dict(val_interval=12)

@xin-li-67 xin-li-67 changed the title [WIP] Migrate Eqlv2 loss to MMDet 3.x [MMSIG-21] Migrate Eqlv2 loss to MMDet 3.x Apr 20, 2023
@hhaAndroid
Copy link
Collaborator

@xin-li-67 Can you fix the ci please?

@xin-li-67
Copy link
Contributor Author

@xin-li-67 Can you fix the ci please?

I think I have fixed the unittest for the EQLv2 loss in the latest commit.

@hhaAndroid
Copy link
Collaborator

@xin-li-67 Hi, CI Failed

@hhaAndroid hhaAndroid merged commit ff63d06 into open-mmlab:dev-3.x May 8, 2023
@xin-li-67 xin-li-67 deleted the eqlv2_dev branch May 8, 2023 03:05
@twangnh
Copy link

twangnh commented Oct 14, 2023

@xin-li-67 Hi thanks for your contribution, we reproduced the eqlv2 on 8GPU on mmdetection with newest version, but only get the following result:

lvis/bbox_AP: 0.2350 lvis/bbox_AP50: 0.3820 lvis/bbox_AP75: 0.2510 lvis/bbox_APs: 0.1770 lvis/bbox_APm: 0.3000 lvis/bbox_APl: 0.3530 lvis/bbox_APr: 0.1180 lvis/bbox_APc: 0.2220 lvis/bbox_APf: 0.3000 lvis/segm_AP: 0.2270 lvis/segm_AP50: 0.3580 lvis/segm_AP75: 0.2430 lvis/segm_APs: 0.1620 lvis/segm_APm: 0.2950 lvis/segm_APl: 0.3560 lvis/segm_APr: 0.1250 lvis/segm_APc: 0.2210 lvis/segm_APf: 0.2780 data_time: 0.0342 time: 0.2995

which is lower than your result and the eqlv2 official repository

yumion pushed a commit to yumion/mmdetection that referenced this pull request Jan 31, 2024
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.

4 participants