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

Add CropLike #299

Merged
merged 4 commits into from
May 12, 2021
Merged

Add CropLike #299

merged 4 commits into from
May 12, 2021

Conversation

Yshuo-Li
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented May 11, 2021

Codecov Report

Merging #299 (ab64e55) into master (41968e2) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #299      +/-   ##
==========================================
+ Coverage   80.54%   80.65%   +0.10%     
==========================================
  Files         162      162              
  Lines        8091     8110      +19     
  Branches     1192     1193       +1     
==========================================
+ Hits         6517     6541      +24     
+ Misses       1429     1425       -4     
+ Partials      145      144       -1     
Flag Coverage Δ
unittests 80.65% <100.00%> (+0.10%) ⬆️

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

Impacted Files Coverage Δ
mmedit/datasets/pipelines/__init__.py 100.00% <ø> (ø)
mmedit/datasets/pipelines/crop.py 97.03% <100.00%> (+0.22%) ⬆️
mmedit/models/common/generation_model_utils.py 100.00% <0.00%> (+4.80%) ⬆️

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 41968e2...ab64e55. Read the comment docs.

Modify the size of image by cropping or padding. Align upper-left.

Args:
target_key (str): The target key.
Copy link
Contributor

Choose a reason for hiding this comment

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

What is a "target key"?


The priority of getting 'target size' is:
1, results[source_key].shape
2, target_size
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a note for the required, added and modified keys.



@PIPELINES.register_module()
class ModifySize:
Copy link
Contributor

Choose a reason for hiding this comment

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

Random thought: how about rename it to "TopLeftCrop"?

@Yshuo-Li Yshuo-Li changed the title add ModifySize add CropLike May 12, 2021
@@ -1,5 +1,6 @@
import mmcv
import numpy as np
from PIL.Image import NONE
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this


@PIPELINES.register_module()
class CropLike:
"""Crop/pad a key according to the size of another key.
Copy link
Contributor

Choose a reason for hiding this comment

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

Crop/pad the image in the target_key according to the size of image in the reference_key .

@innerlee innerlee changed the title add CropLike Add CropLike May 12, 2021
return results

def __repr__(self):
return (self.__class__.__name__ + f' target_key={self.target_key}, ' +
Copy link
Contributor

Choose a reason for hiding this comment

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

return (f'{self.__class__.__name__} target_key={self.target_key}, '
        f'reference_key={self.reference_key}')

@innerlee innerlee merged commit 613b260 into open-mmlab:master May 12, 2021
@Yshuo-Li Yshuo-Li deleted the modify-size branch June 19, 2021 03:02
Yshuo-Li added a commit to Yshuo-Li/mmediting that referenced this pull request Jul 15, 2022
* add ModifySize

* Rename

* Rename and fix

* tiny fix

Co-authored-by: liyinshuo <[email protected]>
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.

2 participants