Skip to content

Fix float32 support in denoise_bilateral and denoise_tv_bregman#3936

Merged
alexdesiqueira merged 3 commits intoscikit-image:masterfrom
jni:float32
May 28, 2019
Merged

Fix float32 support in denoise_bilateral and denoise_tv_bregman#3936
alexdesiqueira merged 3 commits intoscikit-image:masterfrom
jni:float32

Conversation

@jni
Copy link
Copy Markdown
Member

@jni jni commented May 28, 2019

Description

Fixes #3449, again.

See #3449 (comment) and subsequent replies for details.

Checklist

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.
  • Consider backporting the PR with @meeseeksdev backport to v0.14.x

@alexdesiqueira alexdesiqueira merged commit 4e3fd1f into scikit-image:master May 28, 2019
@alexdesiqueira
Copy link
Copy Markdown
Member

Thanks @jni!

@jni
Copy link
Copy Markdown
Member Author

jni commented May 28, 2019

@meeseeksdev backport to v0.14.x

@jni
Copy link
Copy Markdown
Member Author

jni commented May 28, 2019

@meeseeksdev backport to v0.15.x

meeseeksmachine pushed a commit to meeseeksmachine/scikit-image that referenced this pull request May 28, 2019
@jni jni deleted the float32 branch May 28, 2019 23:22
int i = 0
np_floats lam = 2 * weight
np_floats rmse = DBL_MAX
double rmse = DBL_MAX
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this line changed, the whole point of this was to keep float32 as float32 as long as possible. wasa it causing errors?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume that setting a float32 to DBL_MAX does not do good things. Perhaps I there is a FLT_MAX?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see. I didn't know what DBL meant, there is a way to switch code paths between dtypes for a fused type. I guess we would need to do that here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just set it to FLT_MAX regardless of dtype. If your initial RMSE exceeds that, you're in deep trouble 😂

Anyway, the code works, it's just probably a tiny bit slower because of float32-float64 comparisons in the float32 input case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this "optimization" would be a 0.16 branch only IMO.

hmaarrfk added a commit that referenced this pull request May 29, 2019
…6-on-v0.14.x

Backport PR #3936 on branch v0.14.x (Fix float32 support in denoise_bilateral and denoise_tv_bregman)
hmaarrfk added a commit that referenced this pull request Jun 9, 2019
…6-on-v0.15.x

Backport PR #3936 on branch v0.15.x (Fix float32 support in denoise_bilateral and denoise_tv_bregman)
@hmaarrfk hmaarrfk mentioned this pull request Sep 3, 2019
5 tasks
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

Successfully merging this pull request may close these issues.

Denoise throws ValueError

4 participants