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
Improve histogram matching performance on unsigned integer data (resume #6209) #6354
Conversation
`np.bincount` is preferable to `np.unique` for unsigned integer types (i.e. most image representations). This affords a 6-fold performance increase for these types of inputs.
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.
Thank you @grlee77, looks good 😉. Can you add a unitest to check the consistency of the result depending on input dtype?
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.
Thank you @grlee77!
Thanks for adding this fast uint code path @kwikwag |
scikit-image#6209) (scikit-image#6354) * histogram_matching: use np.bincount for uints `np.bincount` is preferable to `np.unique` for unsigned integer types (i.e. most image representations). This affords a large performance increase for these types of inputs. * add benchmarks for match_histograms * add float/int code paths consistency check Co-authored-by: kwikwag <sadan.yuval@gmail.com>
Add kwikwag due to his contributions in scikit-image#6209, which are included in scikit-image#6354.
* Add automatically generated v0.20 release notes produced by generate_release_notes.py. Still requires manual cleaning. * Turn pr numbers into URLs * Use template structure from release_dev.rst * Fix urls * Describe first PRs on footprint decomposition * Remove PRs that were backported to v0.19 * Separate "New features" and "Changes" "New features" MUST be totally backwards compatible. Everything else goes into "changes and new deprecations". * Apply suggestions from code review Some suggestions I plan to edit locally, some I'd like to discuss first. Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com> Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> * Clarify some new features and address review Use present tense and imperative tone for release notes. Try to be more precise about why and how things changed. Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com> * Add work on release notes A lot of the removed PRs were already backported to 0.19. So I'm ignoring these for 0.20. Note that I'm checking if the commit is available in these releases with "git tag --contains <COMMIT_HASH>". * Continue work on release notes * Continue work on release notes I'm confused with what to do abou the Milestone 1.0. Should these be included in 0.20 now. Collect them for now until that's confirmed. Furthermore, collect the backported PRs. We can delete them later but for now it's useful to keep them for review and in case we want to go back. Note that quite a lot are missing because I didn't start this earlier. * Continue work on release notes * Fix too short title underline * Continue work on 0.20 release notes * Continue work on 0.20 release notes * Continue work on 0.20 release notes Add kwikwag due to his contributions in #6209, which are included in #6354. * Continue work on 0.20 release notes * Continue work on 0.20 release notes * Reword description of new footprint decomposition Co-authored-by: Gregory Lee <grlee77@gmail.com> * Continue work on 0.20 release notes * Continue work on 0.20 release notes * Continue work on 0.20 release notes * Remove list of all PRs * Add not included PRs as of 2022-10-24 Should include some unlisted backported PRs as well. * Continue work on 0.20 release notes * Finish including all current PRs in 0.20's release notes. * Reorder and -structure release notes This introduces additional subsections as a suggestion. Hopefully this makes it easier for readers to focus on the stuff they are actually interested in without having to read through a list of minor fixes and updates. Were it made sense I also consolidated related bullet points. E.g. if one PR added something new and a following one added some further fixes or improvements. In that case both PR numbers are appended in brackets. * Resolve mislabeled PRs in milestone 0.21 As these are already merged and included they should go into 0.20. I don't think any of these (formerly 1.0) are breaking. * Update author and reviewer lists * Add recent merged PRs to 0.20 release notes * Apply some suggestions from @mkcor Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> * Apply @mkcor's suggestion Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> * Apply modified suggestions from @mkcor Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> * Add recent merged PRs to 0.20 release notes as of 2022-12-05. * Continue work on release notes * Fix contributor list * Continue work on release notes Only PR left is the one with the long list of completed deprecations. * Apply suggestions from @mkcor Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> * Remove unnecessary "the" in a few places Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> * Continue work on release notes * Add recently merged PR 6581 * Add recently merged PR 6644 * Add recently merged PR 6650 * Don't use ambiguous "dep" Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> * Add recently merged PR 6652 Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> * Add recently merged PR 6655 * Add draft of the highlights section See https://github.com/scikit-image/scikit-image/releases/tag/v0.19.0 for an example from an earlier release. * Mark as prerelease Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com> Co-authored-by: Marianne Corvellec <marianne.corvellec@ens-lyon.org> Co-authored-by: Gregory Lee <grlee77@gmail.com> Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
Description
This PR adds the suggestions from #6209. Benchmark results show a large improvement for unsigned integer types as compared to floating point types. The improvement is > 10x at larger sizes.
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
.example, to backport to v0.19.x after merging, add the following in a PR
comment:
@meeseeksdev backport to v0.19.x
run-benchmark
label. To rerun, the labelcan be removed and then added again. The benchmark output can be checked in
the "Actions" tab.