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] Add ResizeShortestEdge transform #2339

Merged
merged 7 commits into from
Dec 1, 2022

Conversation

xiexinch
Copy link
Collaborator

@xiexinch xiexinch commented Nov 23, 2022

Motivation

Support resize shortest edge while keeping the aspect ratio unchanged.

Modifed from https://github.com/facebookresearch/detectron2/blob/main/detectron2/data/transforms/augmentation_impl.py#L130

Modification

  • Add ResizeShortestEdge to mmseg/datasets/transforms/transforms.py
  • Add unit test

BC-breaking (Optional)

Depend on mmcv >= 2.0.0rc3

Use cases (Optional)

At train_pipeline:

train_pipeline = [
    ...
    dict(
        type='RandomChoiceResize',
        scales=[128, 256, 512],
        resize_type='ResizeShortestEdge',
        max_size=2048,
    )
    ...
]

@codecov
Copy link

codecov bot commented Nov 23, 2022

Codecov Report

Base: 83.64% // Head: 83.19% // Decreases project coverage by -0.44% ⚠️

Coverage data is based on head (ea217ff) compared to base (6d7af07).
Patch coverage: 86.66% of modified lines in pull request are covered.

❗ Current head ea217ff differs from pull request most recent head 3b731ed. Consider uploading reports for the commit 3b731ed to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #2339      +/-   ##
===========================================
- Coverage    83.64%   83.19%   -0.45%     
===========================================
  Files          141      141              
  Lines         7973     7998      +25     
  Branches      1193     1198       +5     
===========================================
- Hits          6669     6654      -15     
- Misses        1115     1158      +43     
+ Partials       189      186       -3     
Flag Coverage Δ
unittests 83.19% <86.66%> (-0.45%) ⬇️

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

Impacted Files Coverage Δ
mmseg/datasets/__init__.py 100.00% <ø> (ø)
mmseg/datasets/transforms/__init__.py 100.00% <ø> (ø)
mmseg/models/decode_heads/knet_head.py 14.04% <0.00%> (-0.08%) ⬇️
mmseg/datasets/transforms/transforms.py 96.42% <88.88%> (-0.49%) ⬇️
mmseg/__init__.py 92.10% <100.00%> (ø)
mmseg/models/backbones/beit.py 78.21% <100.00%> (-14.87%) ⬇️
mmseg/models/backbones/timm_backbone.py 45.83% <0.00%> (+8.33%) ⬆️

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.

@MeowZheng MeowZheng merged commit 0cdab72 into open-mmlab:dev-1.x Dec 1, 2022
MeowZheng pushed a commit to MeowZheng/mmsegmentation that referenced this pull request Dec 30, 2022
* init

* add ut

* use mmcv.RandomChoiceResize as entry

* minor change

* add docstring

* fix h,w order

* update copyright
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
wjkim81 pushed a commit to wjkim81/mmsegmentation that referenced this pull request Dec 3, 2023
nahidnazifi87 pushed a commit to nahidnazifi87/mmsegmentation_playground that referenced this pull request Apr 5, 2024
[Feature] Add ResizeShortestEdge transform
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

2 participants