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

Intermittent Functionality of Albumentations on Google Colab #2346

Closed
mahdimohamadiha opened this issue Feb 17, 2025 · 3 comments
Closed

Intermittent Functionality of Albumentations on Google Colab #2346

mahdimohamadiha opened this issue Feb 17, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@mahdimohamadiha
Copy link

Describe the bug

When using the Albumentations package on Google Colab, transformations sometimes work as expected, but other times they fail without any changes to the code. This inconsistency occurs when running the same code multiple times.

To Reproduce

Steps to reproduce the behavior:

Run the same transformation code multiple times on Google Colab.
Observe that some executions succeed while others fail without any apparent reason.

Sample code that produces the bug:

import albumentations as A
import cv2
import matplotlib.pyplot as plt

# Declare an augmentation pipeline
transform = A.Compose([
    A.ToGray(num_output_channels=3, method="weighted_average")
])

# Read an image with OpenCV and convert it to the RGB colorspace
image = cv2.imread("/path/to/image.png")
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

# Augment an image
transformed = transform(image=image)
transformed_image = transformed["image"]

plt.figure(figsize=(8, 4))
plt.subplot(1, 2, 1)
plt.imshow(image)
plt.title("Original")
plt.axis("off")

plt.subplot(1, 2, 2)
plt.imshow(transformed_image)
plt.title("ToGray")
plt.axis("off")

plt.show()

Expected behavior

The transformations should work consistently across multiple runs without intermittent failures.

Actual behavior

The same transformation code sometimes works and sometimes does not.

Screenshots / GIF

issue.mp4

Additional context

When I use this package to generate data for a dataset and run a loop to apply transformations, some images get augmented while others do not.

@mahdimohamadiha mahdimohamadiha added the bug Something isn't working label Feb 17, 2025
@ternaus
Copy link
Collaborator

ternaus commented Feb 17, 2025

Default probability for ToGray is p=0.5, it is expected to get half of the images transformed in such case. If you want all images transformed => use `p=1``

P.S. Would love to see you as a sponsor for the library at: https://github.com/sponsors/albumentations-team

@ternaus ternaus closed this as completed Feb 17, 2025
@mahdimohamadiha
Copy link
Author

Thanks for the explanation! Now I see that setting p=1 transforms all images. I appreciate your help and the great work on this library!

@ternaus
Copy link
Collaborator

ternaus commented Feb 19, 2025

@mahdimohamadiha I have a request.

For sure, the best would be to see you as a sponsor, but it it not always an option.

There is another material way to say "Thank you for the library".

Could you please write a small testimonial, meaning a few sentences about your experience with the library?

Such third party validation, mentioning the library and me helps a lot to promote the library.

Here are a few examples of how it may look from other people:

https://albumentations.ai/testimonials/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy