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 outputs Incorrect Bounding Boxes Values #1721

Closed
ahmed-sorour1 opened this issue May 12, 2024 · 4 comments
Closed

Augmentation outputs Incorrect Bounding Boxes Values #1721

ahmed-sorour1 opened this issue May 12, 2024 · 4 comments

Comments

@ahmed-sorour1
Copy link

ahmed-sorour1 commented May 12, 2024

Hello everyone,

I am doing an Object Detection task and tried to write a code to get my images and it's labels from drive and then do data augmentation.

The Results:

  1. Images were good and correctly flipped and rotated.
  2. Labels "Bounding Boxes" weren't placed in the right place that they should be at, they were incorrect and not accurate at all.
    how should I solve this problem?

This is my code:
Screenshot 2024-05-12 025520
Screenshot 2024-05-12 025559
Screenshot 2024-05-12 025647

If anyone can help I will appreciate it!

@ayasyrev
Copy link
Contributor

When you use transform without Compose you mast use albumentations format for bboxes.
So if you want chose one of transform, use A.OneOf conteiner for it.
As:

transforms = A.Compose(
    [A.OneOf(
        [
            A.HorizontalFlip(p=1),
            A.Affine(rotate=90, p=1),
        ]
    )
    ],
    bbox_params=...
)

@ahmed-sorour1
Copy link
Author

@ayasyrev Thanks for you reply!

This isn't the issue as I use choosen_augmentations = random.sample(augmentations.transforms, 2) to do both flip and rotate on separate images.

The problem here is in handling the bounding boxes coordination's after doing augmentation, the new coordination aren't true and not accurate at all.

If you could help me to know the cause or the solution of this problem?

@ayasyrev
Copy link
Contributor

In you code you use transforms out of Compose, but all preprocess and post process for bboxes inside Compose.

Could you provide more information?
What input data you got and what result you expect?

@ternaus
Copy link
Collaborator

ternaus commented May 14, 2024

@ahmed-sorour1

Feel free to reopen this issue when you could share example that could reproduce the bug

@ternaus ternaus closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants