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

Augmentation issues #673

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

Conversation

jesusbft
Copy link

@jesusbft jesusbft commented Jan 4, 2025

The actual augmentation parameters have issues:

The ElasticTransform parameters makes the image unreadable
ElasticTransform(alpha=64, sigma=25, p=1.0),

augmented_34_20250103_131205
augmented_35_20250103_131205
augmented_45_20250103_131205

The Affine and ShiftScaleRotate options cut the borders and lose informations:
Affine(translate_px=(0, 5), rotate=(-3, 3), shear=(-5, 5), p=1.0)
ShiftScaleRotate(shift_limit=0.0625, scale_limit=0.2, rotate_limit=1, p=0.2) Similar

augmented_55_20250103_131340
augmented_21_20250103_131339
augmented_37_20250103_131338

My suggestions are:

  • ElasticTransform reduce the alpha parameter to equal/lower than 10 (I suggest the int 7)

  • Substitute the Affine and ShiftScaleRotate to option SafeRotate, that don't remove any information of the image.

self._transforms = Compose([
                                    ToFloat(),
                                    PixelDropout(p=0.2),
                                    OneOf([
                                        MotionBlur(p=0.2),
                                        MedianBlur(blur_limit=3, p=0.1),
                                        Blur(blur_limit=3, p=0.1),
                                    ], p=0.2),
                                    OneOf([
                                        OpticalDistortion(p=0.3),
                                        ElasticTransform(alpha=7, sigma=25, p=0.1),
                                        SafeRotate(limit=(-3,3), border_mode=cv2.BORDER_CONSTANT, p=0.2)
                                    ], p=0.2),
                                   ], p=1.0)

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.

1 participant