fast hog calculation #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
strange logic to slow down Hog execution speed
Checklist
Current Hog takes use of 3 loops, ex: for 9 bins, 128 * 128 cells.
However, 2 loops should be fine:
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.