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

copypaste_based_on_bbox #8905

Merged
merged 18 commits into from
Oct 28, 2022
Merged

Conversation

JarvisKevin
Copy link

@JarvisKevin JarvisKevin commented Sep 28, 2022

image

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

It's much more expensive for us to annotate a mask label than bbox. So, How copypaste can be utilized when only bbox provided?

Modification

If only gt_bboxes provided, gt_masks can be generated by the gt_bboxes to get a second best preformance.

@CLAassistant
Copy link

CLAassistant commented Sep 28, 2022

CLA assistant check
All committers have signed the CLA.

@ZwwWayne
Copy link
Collaborator

Hi @JarvisKevin

Thanks for your kind PR. It seems that CLA is not signed. Could you sign the CLA so that eventually we could merge this PR after review? You can check the contents and follow the instruction in the communication box shown as below
image

@ZwwWayne ZwwWayne assigned Czm369 and unassigned jbwang1997 Sep 28, 2022
@ZwwWayne ZwwWayne added this to the 2.27.0 milestone Sep 28, 2022
@JarvisKevin
Copy link
Author

[MMDet] copypaste with bbox - Jarvis的文章 - 知乎
https://zhuanlan.zhihu.com/p/568957551

@JarvisKevin
Copy link
Author

Is there any idea to test this change in test_transforms.py?

@Czm369
Copy link
Collaborator

Czm369 commented Sep 28, 2022

Thanks for you kind PR! CopyPaste with the PR can be directly used in object detection. Can you show images with CopyPaste based on bboxes? In addition, verify that CopyPaste can be used normally with with_mask=Fasle for LoadAnnotations in the unit test, and there is no gt_masks in the returned results.

@JarvisKevin
Copy link
Author

@Czm369 Thanks for your suggestion of the unit_test. The picture with cp based on bboxes was posted on https://zhuanlan.zhihu.com/p/568957551, maybe you can refer it.

@Czm369
Copy link
Collaborator

Czm369 commented Sep 28, 2022

The unit test for CopyPaste is at

Copy link
Collaborator

@Czm369 Czm369 left a comment

Choose a reason for hiding this comment

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

LGTM

@JarvisKevin JarvisKevin marked this pull request as ready for review September 30, 2022 01:42
@codecov
Copy link

codecov bot commented Oct 8, 2022

Codecov Report

Base: 64.12% // Head: 64.10% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (7559768) compared to base (9d3e162).
Patch coverage: 90.90% of modified lines in pull request are covered.

❗ Current head 7559768 differs from pull request most recent head 27528ab. Consider uploading reports for the commit 27528ab to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8905      +/-   ##
==========================================
- Coverage   64.12%   64.10%   -0.03%     
==========================================
  Files         361      361              
  Lines       29536    29558      +22     
  Branches     5022     4925      -97     
==========================================
+ Hits        18939    18947       +8     
- Misses       9580     9594      +14     
  Partials     1017     1017              
Flag Coverage Δ
unittests 64.10% <90.90%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
mmdet/datasets/pipelines/transforms.py 76.18% <90.90%> (+0.22%) ⬆️
mmdet/core/bbox/samplers/random_sampler.py 75.00% <0.00%> (-5.56%) ⬇️
mmdet/models/detectors/cornernet.py 94.87% <0.00%> (-5.13%) ⬇️
mmdet/models/dense_heads/corner_head.py 68.33% <0.00%> (-1.39%) ⬇️
mmdet/core/bbox/assigners/max_iou_assigner.py 72.36% <0.00%> (-1.32%) ⬇️
mmdet/core/hook/wandblogger_hook.py 14.91% <0.00%> (-0.13%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

drop parameter "using_cutmix"
add indicator "paste_by_box"
@hhaAndroid
Copy link
Collaborator

@JarvisKevin Please fix the lint

@@ -2813,6 +2814,42 @@ def get_indexes(self, dataset):
"""
return random.randint(0, len(dataset))

def gen_masks_from_bboxes(self, bboxes, img_shape):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the dev-3.x branch need to be updated in sync?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we should migrate the change.

@hhaAndroid hhaAndroid self-requested a review October 27, 2022 04:42
@ZwwWayne ZwwWayne merged commit 1f8b195 into open-mmlab:dev Oct 28, 2022
@ZwwWayne ZwwWayne added this to In progress in Migration via automation Oct 28, 2022
@JarvisKevin JarvisKevin deleted the copypaste_based_on_bbox branch November 14, 2022 03:01
@ZwwWayne ZwwWayne moved this from In progress to To do in Migration Jan 29, 2023
@ZwwWayne
Copy link
Collaborator

We need to migrate this PR to MMDet 3.x

@ZwwWayne ZwwWayne removed this from To do in Migration Jan 29, 2023
SakiRinn pushed a commit to SakiRinn/mmdetection-locount that referenced this pull request Mar 17, 2023
…pen-mmlab#8905)

* copypaste_based_on_bbox

* docformatter

* formatter again

* fix bug of dict get method in check_gt_masks

* test copypaste based on bbox

* change mask generating method

* docformatter

* docformatter

* update comment 'result' to 'results'

* rename

* Update transforms.py

* Update transforms.py

* Update transforms.py

* rename 'mask_gen' to 'using_cutmix'

* yapf

* Add files via upload

* yapf

* paste_by_box

drop parameter "using_cutmix"
add indicator "paste_by_box"
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.

None yet

6 participants