-
-
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
Precompute histogram to speed up try_all_threshold #5305
Conversation
@sciunto you got us to go 2x faster to a test failure! 😂 ____________________ TestSimpleImage.test_try_all_threshold ____________________
self = <skimage.filters.tests.test_thresholding.TestSimpleImage object at 0x7fd0a6a16cd0>
def test_try_all_threshold(self):
fig, ax = try_all_threshold(self.image)
all_texts = [axis.texts for axis in ax if axis.texts != []]
text_content = [text.get_text() for x in all_texts for text in x]
> assert 'RuntimeError' in text_content
E AssertionError: assert 'RuntimeError' in ['TypeError', 'TypeError', 'TypeError', 'TypeError', 'TypeError', 'TypeError', ...]
scikit-image/skimage/filters/tests/test_thresholding.py:48: AssertionError Not all functions take a histogram, so probably this needs to check, either using the inspect module or in a try/except. |
Why this didn't happen during my test? 🤔 |
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.
LGTM. The build failure looks like an unrelated time-out on Azure.
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.
Nice! It looks like this contribution almost fell in the cracks...
Description
We recently merged a PR to use pre-computed histograms in threshold functions. This feature can be used internally in try_all_threshold. I noticed a 2x improvement on the hubble image.
Checklist
./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
.