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

[Fix]: Remove sampling hardcode. #6317

Merged
merged 2 commits into from
Oct 25, 2021

Conversation

RangiLyu
Copy link
Member

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

Remove hardcode of determining sampling by loss type.

Resolve #5717 [Bug]: Can not using custom loss when determine sampling by loss type.

Modification

Sampling or not is determined by sampler in train_cfg now.

If there is no sampler or setting PseudoSampler in train_cfg, sampling will be False, otherwise, be True.

And to avoid BC-breaking, when sampler is set in train_cfg, we still keep the loss type logic and raise a warning. These codes will be removed after several versions.

BC-breaking (Optional)

Yes. sampling will not be determined by loss type in the future.

Need to check backward compatibility.

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.

@RangiLyu RangiLyu self-assigned this Oct 19, 2021
@codecov
Copy link

codecov bot commented Oct 19, 2021

Codecov Report

Merging #6317 (caf3b50) into master (c88509c) will increase coverage by 0.01%.
The diff coverage is 50.00%.

❗ Current head caf3b50 differs from pull request most recent head d370a52. Consider uploading reports for the commit d370a52 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6317      +/-   ##
==========================================
+ Coverage   61.80%   61.81%   +0.01%     
==========================================
  Files         315      315              
  Lines       25157    25172      +15     
  Branches     4185     4186       +1     
==========================================
+ Hits        15549    15561      +12     
- Misses       8798     8800       +2     
- Partials      810      811       +1     
Flag Coverage Δ
unittests 61.79% <50.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
mmdet/models/dense_heads/anchor_head.py 85.34% <50.00%> (-1.39%) ⬇️
mmdet/models/detectors/two_stage.py 68.23% <0.00%> (ø)
mmdet/models/roi_heads/standard_roi_head.py 62.11% <0.00%> (ø)
mmdet/datasets/pipelines/auto_augment.py 90.64% <0.00%> (+0.07%) ⬆️
mmdet/models/dense_heads/yolact_head.py 79.55% <0.00%> (+0.17%) ⬆️
mmdet/models/detectors/yolact.py 97.36% <0.00%> (+3.08%) ⬆️

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 c88509c...d370a52. Read the comment docs.

@ZwwWayne
Copy link
Collaborator

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

@RangiLyu RangiLyu added the bug Something isn't working label Oct 25, 2021
@ZwwWayne ZwwWayne merged commit e43df7c into open-mmlab:master Oct 25, 2021
@RangiLyu RangiLyu deleted the remove_sampling_hardcode branch January 13, 2022 08:16
ZwwWayne pushed a commit to ZwwWayne/mmdetection that referenced this pull request Jul 19, 2022
* [Fix]: Remove sampling hardcode.

* add doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Can not using custom loss when determine sampling by loss type.
3 participants