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

Unproportional mosaicing #1389

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

DavidAdamczyk
Copy link

@DavidAdamczyk DavidAdamczyk commented Jan 31, 2023

We would like to contribute to project Albumentations with new augmentation named Unproportional mosaicing.

image

image

image

@DavidAdamczyk DavidAdamczyk changed the title Add unprop Unproportional mosaicing Jan 31, 2023
tiles = np.asarray(tiles)

shape_y, shape_x = tiles.shape
shuffled_ids = np.linspace(0, shape_y - 1, shape_y, dtype=np.int32).tolist()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do not save them into class member. Return as an argument.

albumentations/augmentations/transforms.py Outdated Show resolved Hide resolved
albumentations/augmentations/transforms.py Outdated Show resolved Hide resolved
albumentations/augmentations/transforms.py Outdated Show resolved Hide resolved
def apply_to_keypoint(self, keypoint, **params):
return ()

def get_params_dependent_on_targets(self, params):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to implement targets_as_params to use this method.

Comment on lines +2712 to +2714
num_segments = params["num_segments"] if "num_segments" in params else 7
ratio = params["ratio"] if "ratio" in params else 4.0 / 3.0
# refinement_steps = params["refinement_steps"] if "refinement_steps" in params else 10
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mabe better to use it as an augmentation argument on creation. Also we could rewrite it if it will be provided on transform call.

index = 0

# We must work with the copy because "Split" alters the original list
segms_copy = segms.copy()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We do not copy there

# We must work with the copy because "Split" alters the original list
segms_copy = segms.copy()

for segm in segms_copy:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use enum for index

Copy link
Author

Choose a reason for hiding this comment

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

@Dipet I would like to ask you what do you mean by enum. You mean enumerate function?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Replace

index = 0

# We must work with the copy because "Split" alters the original list
segms_copy = segms.copy()

for segm in segms_copy:

with:

# We must work with the copy because "Split" alters the original list
segms_copy = segms.copy()

for index, segm in enumerate(segms_copy):

return True

# Split
current_num_semgs = 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo semgs

Copy link
Author

Choose a reason for hiding this comment

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

@thiagoribeirodamotta
Copy link

Hi there,
Are there any plans on merging this PR?

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

3 participants