-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
WIP: Reduce the default tolerance in threshold_li #3622
Conversation
f3a3e9b
to
2785531
Compare
Fixes scikit-image#3605 In that issue, I found that a tolerance of `range / 2**15` was sufficient. However, the only thing that guarantees convergence is the smallest intensity difference in the image (it's impossible for the update to change if the threshold doesn't change). I've set this as the new default, as the only downside is that it might take a long time to converge, but that seems preferable to finding an incorrect threshold.
2785531
to
7425be1
Compare
A small update: while I was playing around with the test image, I indeed found that a factor of 2 over the empirically found limit above was insufficient to ensure robustness. After I sampled pixels from the test image in #3605 to get a 1024x1024 image, In the end, I found a threshold that I think works in all cases: the tolerance should be strictly less than the smallest difference between two consecutive intensity values. I've made that (half the smallest gap) the default. I think in some cases you might end up making more updates than if you just brute-forced the threshold, but at least it will always be correct (and on average it should be much faster). There's a chance that we could dramatically speed this up by sorting the intensities and only updating the foreground and background means incrementally, but I leave that for a later PR. The rest of my to-do list remains to be done, just wanted to update with the current status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Juan! Kind reminder about the other bullets.
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
* Reduce the default tolerance in threshold_li Fixes scikit-image#3605 In that issue, I found that a tolerance of `range / 2**15` was sufficient. However, the only thing that guarantees convergence is the smallest intensity difference in the image (it's impossible for the update to change if the threshold doesn't change). I've set this as the new default, as the only downside is that it might take a long time to converge, but that seems preferable to finding an incorrect threshold. * Fix documentation of tolerance in threshold_li
* Reduce default tolerance in threshold_li (#3622) * Reduce the default tolerance in threshold_li Fixes #3605 In that issue, I found that a tolerance of `range / 2**15` was sufficient. However, the only thing that guarantees convergence is the smallest intensity difference in the image (it's impossible for the update to change if the threshold doesn't change). I've set this as the new default, as the only downside is that it might take a long time to converge, but that seems preferable to finding an incorrect threshold. * Fix documentation of tolerance in threshold_li * Backport Python3 float division in thresholding
Fixes #3605
In that issue, I found that a tolerance of
range / 2**15
wassufficient. However, I don't know whether this is generally true, so an
extra factor of 2 is probably a good margin, and gets us to a nice
round number.
Still to do:
threshold_li
. Possibly after mergingattribute_operators
.Checklist
[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
For reviewers
later.
__init__.py
.doc/release/release_dev.rst
.@meeseeksdev backport to v0.14.x