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 #671

Open
jesusbft opened this issue Jan 3, 2025 · 3 comments
Open

Augmentation Issues #671

jesusbft opened this issue Jan 3, 2025 · 3 comments

Comments

@jesusbft
Copy link

jesusbft commented Jan 3, 2025

I notticed the augmentation option didn't help to improve the results.

I inspected some augmented images and I noticed some options distort the image making them useless:

augmented_119593_20250103_123157
augmented_13_20250103_125951
augmented_8_20250103_125948

I'm still figure out which will be the best option for my dataset, but it's only possible change the class DefaultAugmenter(). Maybe would be interesting create a way to set these parameters dynamically.

Thank you

@jesusbft
Copy link
Author

jesusbft commented Jan 3, 2025

More details attached:

class DefaultAugmenter():

Option: ElasticTransform(alpha=64, sigma=25, p=1.0),

augmented_34_20250103_131205
augmented_35_20250103_131205
augmented_45_20250103_131205

Option: Affine(translate_px=(0, 5), rotate=(-3, 3), shear=(-5, 5), p=1.0)

augmented_55_20250103_131340
augmented_21_20250103_131339
augmented_37_20250103_131338

I disabled both of them which are causing distortions above what I wanted.

Thank you

@jesusbft
Copy link
Author

jesusbft commented Jan 4, 2025

Update:

I could not find a way to use any rotation, scale or shear. All these options lose information in the borders. In the affine function has a parameter to fit_output, but it causes issues in the height size.

The translate_px option is not util here and also loses information.

The alpha parameter in the ElasticTransform couldn't be higher than 10. After that, it causes large deformation.

These are the settings that I use now:

        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),
                                    ], p=0.2),
                                   ], p=0.5)

@jesusbft
Copy link
Author

jesusbft commented Jan 4, 2025

SafeRotate is a good option:

SafeRotate(limit=(-3,3), border_mode=cv2.BORDER_CONSTANT, p=0.2)

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

No branches or pull requests

1 participant