sparkfish / augraphy

Augmentation pipeline for rendering synthetic paper printing, faxing, scanning and copy machine processes
https://github.com/sparkfish/augraphy
MIT License
334 stars 43 forks source link

Confusion on `Geometric` Augmentation #320

Closed what-in-the-nim closed 1 year ago

what-in-the-nim commented 1 year ago

Description

When using the Geometric augmentation, I encountered confusion on the randomize keyword argument and its interaction with other arguments. The current behavior is that when initializing the Geometric class, the randomize argument, which defaults to True, overrides all other arguments that are not explicitly passed in during initialization. This behavior seems to differ from what I initially assumed, where I expected all other arguments to be set to their default values if not provided.

# Geometric __init__
def __init__(
        self,
        scale=(1, 1),
        translation=(0, 0),
        fliplr=0,
        flipud=0,
        crop=(),
        rotate_range=(0, 0),
        padding=[0, 0, 0, 0],
        padding_type="fill",
        padding_value=(255, 255, 255),
        randomize=1,
        p=1,
    )

Steps to reproduce

augmentation = Geometric(rotate_range=(-4,  4))
augmented = augmentation(image)

Original Image

original

Current Behavior

output_weird

Expected Behavior

output

Proposed Solution

I suggest setting the randomize argument to False by default, as it would provide a more intuitive behavior.

Please note that this issue is based on my understanding of the current behavior. If my assumptions are incorrect, please provide clarity on the intended behavior of the Geometric augmentation class.

kwcckw commented 1 year ago

Thanks for the feedback. We have randomize set as True for some other application. So when randomize is True, it overwrites all the other parameters. We will look into this further and change it accordingly.

kwcckw commented 1 year ago

In the newer releases, we have randomize set as false now. Please feel free to let us know again if you have other related feedback.