Skip to content
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

Speed up find_local_max when given a finite num_peaks #5394

Merged
merged 1 commit into from
May 14, 2021

Conversation

klaussfreire
Copy link
Contributor

Description

Optimizes _shared.coord.ensure_spacing as used in
feature.peak.find_local_max when given num_peaks

There's no need to process all candidates, which could
far outnumber the requested maximum, since candidates
in find_local_max are sorted by intensity. So only return
the first few matches and ignore the rest.

The resulting speedup can be huge in a number of cases

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.

Copy link
Member

@jni jni left a comment

Choose a reason for hiding this comment

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

Cool, thanks @klaussfreire! We've definitely been having performance issues with that function so this is much appreciated. The changes are completely internal (no API changes), which also makes it easy to get it in.

Copy link
Member

@mkcor mkcor left a comment

Choose a reason for hiding this comment

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

Nice!

@mkcor mkcor merged commit 54e424a into scikit-image:main May 14, 2021
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.

None yet

3 participants