GithubHelp home page GithubHelp logo

Comments (12)

daitakahashi avatar daitakahashi commented on July 24, 2024 1

In my observation, negative noise-values of the GaussNoise are truncated.

import numpy as np
import albumentations as A
x = np.full((10, 10), 128, dtype=np.uint8)
tr = A.Compose([A.GaussNoise(p=1)])  # for 1.4.8
tr = A.Compose([A.GaussNoise(p=1, noise_scale_factor=1.0)]  # for 1.4.9

1.4.8

(tr(image=x)['image'] >= x).all()  # -> almost always False

1.4.9

(tr(image=x)['image'] >= x).all()  # -> always True

from albumentations.

voegtlel avatar voegtlel commented on July 24, 2024 1

Sorry, won't be able to test this until next Monday, OOO until then. Maybe the others can confirm. Anyways, thanks for the quick fix! 🥳

from albumentations.

JulianJvn avatar JulianJvn commented on July 24, 2024

We ran into the same issue, and it broke our CI.

  • I think GaussNoise is not broken as stated in the PR title, but an additional parameter was introduced with a default value that changes the behavior. Looking at the code, you should be able to get the previous behavior by setting noise_scale_factor=1.0.
  • The release notes do not mention that the default behavior changed (not even how the new parameter is called). Why?
  • Can Albumentations switch to semantic versioning? Changing the default behavior is a breaking change which would merit a major version release under semantic versioning, not a patch version release.

from albumentations.

voegtlel avatar voegtlel commented on July 24, 2024

@JulianJvn thanks for this finding! I also checked the release notes and didn't find this. Absolutely agree, semver should be used and reflect that breaking change.

from albumentations.

ternaus avatar ternaus commented on July 24, 2024

My bad.

I will put noise_scale_factor=1.0 as default, so that it would work as before.

from albumentations.

ternaus avatar ternaus commented on July 24, 2024

We ran into the same issue, and it broke our CI.

  • I think GaussNoise is not broken as stated in the PR title, but an additional parameter was introduced with a default value that changes the behavior. Looking at the code, you should be able to get the previous behavior by setting noise_scale_factor=1.0.
  • The release notes do not mention that the default behavior changed (not even how the new parameter is called). Why?
  • Can Albumentations switch to semantic versioning? Changing the default behavior is a breaking change which would merit a major version release under semantic versioning, not a patch version release.

It is possible, but will require extra effort and attention.

Would you consider becoming a sponsor?

https://github.com/sponsors/albumentations-team

from albumentations.

ternaus avatar ternaus commented on July 24, 2024

@daitakahashi thank you. Will look at it asap.

from albumentations.

ternaus avatar ternaus commented on July 24, 2024

Made scale_factor=1 as default in #1800

from albumentations.

daitakahashi avatar daitakahashi commented on July 24, 2024

Here may be the cause. The value gauss should be a mean == self.mean array (possibly with some negative values).

return {"gauss": gauss.astype(image.dtype)}

>>> tr.transforms[0].get_params_dependent_on_targets({'image':x})
{'gauss': array([[253,  11, 253,   3, 255,   2, 252, 253, 251, 254],
       [251, 251, 249, 253, 255,   1,   0,   5, 252,   3],
       [255,   1,   3,   9,   6, 249,   0,   1, 254,  11],
       [251,   2,   0,   1, 249, 253, 252,   0,   0,   5],
       [241,   4,   7,   1, 248, 244,   5,   0, 247,   0],
       [  0, 255, 253,  13,   5,   1,   3, 252, 249,   1],
       [252,   5,   0,   0,   0, 246, 240,   4, 253,   2],
       [  3,   5, 253,   7,   2, 251,   2, 252, 255, 250],
       [  0,   2, 253,  16,   2,   5,   3,   3,   4,   9],
       [  0, 254,   5,  17, 249, 254,  12, 255,   7,   8]], dtype=uint8)}

from albumentations.

ternaus avatar ternaus commented on July 24, 2024

Yep, it is this casting.

Adding tests

from albumentations.

ternaus avatar ternaus commented on July 24, 2024

Fixed in #1801

@voegtlel @daitakahashi @JulianJvn

Could you please verify that things work as expected? Default behavior is generate per pixel and noise is not truncated.

If no other issues will come up with it, I will make a hotfix release 1.4.10 in couple hours.

from albumentations.

ternaus avatar ternaus commented on July 24, 2024

Version 1.4.10 with fix for GaussNoise released.

Thanks @voegtlel @JulianJvn and @daitakahashi for help.

from albumentations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.