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

RandomFog behaves differently in version 2.0.4 compared to previous versions #2340

Open
huuquan1994 opened this issue Feb 13, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@huuquan1994
Copy link
Contributor

Describe the bug

The result of RandomFog in version 1.4.6 is completely different from the newest version 2.0.4

To Reproduce

Steps to reproduce the behavior:

  1. Environment (e.g., OS, Python version, Albumentations version, etc.)
    OS: MacOS Sonoma 14.2 (23C64)
    Python: 3.10.16
    Albumentations version: 1.4.6 and 2.0.4

  2. Sample code that produces the bug.

import albumentations as A
from PIL import Image
import numpy as np

# read image
img_path = 'path/to/image'
pil_image = Image.open(img_path).convert('RGB')

# apply data aug
# for version 1.4.6
_augs_fnc = A.RandomFog(alpha_coef=0.08, fog_coef_lower=0.6, fog_coef_upper=1.0, p=1.0)

# for version 2.0.4
# _augs_fnc = A.RandomFog(alpha_coef=0.08, fog_coef_range=(0.6, 1.0), p=1.0,)

img_np = np.array(pil_image)
augmented = _augs_fnc(image=img_np)
aug_image = Image.fromarray(augmented['image'])
  1. Any error messages or incorrect outputs.
    None

Expected behavior

I expect both results should look the same or very similar

Actual behavior

The two results are completely different and RandomFog in version 2.0.4 are not really foggy

Screenshots

Load image

Image

Version 1.4.6

Image

Version 2.0.4

Image
@huuquan1994 huuquan1994 added the bug Something isn't working label Feb 13, 2025
@ternaus
Copy link
Collaborator

ternaus commented Feb 13, 2025

I changed a few things under the good there, but it should not create such a difference.

Will take a look.

@ternaus
Copy link
Collaborator

ternaus commented Feb 14, 2025

Reverted the algorithm back. Should work correctly now

@ternaus ternaus closed this as completed Feb 14, 2025
@huuquan1994
Copy link
Contributor Author

@ternaus
Thanks for the quick response!
I've checked the latest version. The result looks a bit better now but not quite close to version 1.4.6

Image

If we decrease the alpha_coef, it's similar to Gaussian Blur but if we increase it, it shows noticeable "foggy circles" which looks unnatural compared to version 1.4.6.

Could you take a look again?

@ternaus
Copy link
Collaborator

ternaus commented Feb 14, 2025

Ok, will take a look

@ternaus ternaus reopened this Feb 14, 2025
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