8000 fast hog calculation by WeiChungChang · Pull Request #1 · WeiChungChang/scikit-image · GitHub
[go: up one dir, main page]

Skip to content

fast hog calculation #1

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

Merged
merged 1 commit into from
Sep 3, 2020
Merged

fast hog calculation #1

merged 1 commit into from
Sep 3, 2020

Conversation

WeiChungChang
Copy link
Owner

Description

strange logic to slow down Hog execution speed

Checklist

Current Hog takes use of 3 loops, ex: for 9 bins, 128 * 128 cells.

  1. outer loop - go through each bins.
  2. middle loop - go through each rows.
  3. inner loop - go through each columns.
    However, 2 loops should be fine:
  4. outer loop - go through each rows.
  5. inner loop - go through each columns.
    then divide orientation by number_of_orientations_per_180 and put result into corresponding bin.

Ex, if number_of_orientations_per_180 is 20 (divide 180 degree by 9 bins so each bin's range is 20 degree);
if current pixel has orientation = 45, it locates at (45/20) = 2nd bin.
if current pixel has orientation = 18, it locates at (18/20) = 0th bin.
and so on.

The experiment shows this way can speed up the calculation about 10% ~ 20% of whole flow.
Since the execution time is dominated by (1) calculation bin distribution for each cell, and (2) normalization,
it implies for (1) it speed up 20~40%(may by more).

Here provided a test patch and attached a file to measure the difference.
It shows the difference is small enough to be ignored.

Please consider to rework current logic to provide better performance.

@WeiChungChang WeiChungChang merged commit 8bb20a1 into master Sep 3, 2020
@WeiChungChang WeiChungChang deleted the fast branch September 3, 2020 03:54
WeiChungChang pushed a commit that referenced this pull request Sep 3, 2020
enable anistropic window shape
WeiChungChang pushed a commit that referenced this pull request Sep 3, 2020
…it-image#4446)

* Implemeted multichannel support for denoise_tv_bregman (#1)

Compare issue scikit-image#4427 in upstream

* Implemented unittest

* Refactored code

* wrapped around long lines

* Indention, empty line and whitespace lint issues

* Update skimage/restoration/_denoise.py

Co-Authored-By: Mark Harfouche <mark.harfouche@gmail.com>

* Update skimage/restoration/_denoise.py

Co-Authored-By: Mark Harfouche <mark.harfouche@gmail.com>

* For the multichannel flag only 2D images + channel dimension is supported

* over-indented

* Update skimage/restoration/_denoise.py

Co-Authored-By: Mark Harfouche <mark.harfouche@gmail.com>

* Update skimage/restoration/_denoise.py

* Apply suggestions from code review

Allocate channel output array prior to loop.

* Apply suggestions from code review

Only allocate `channel_out` if `multichannel` is `True`

* Added check for multichannel bregman

Co-authored-by: Mark Harfouche <mark.harfouche@gmail.com>
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.

1 participant
0