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

Suggestions for a 10x faster implementation. #14

Closed
hongfz16 opened this issue Jul 20, 2021 · 2 comments
Closed

Suggestions for a 10x faster implementation. #14

hongfz16 opened this issue Jul 20, 2021 · 2 comments

Comments

@hongfz16
Copy link

Hi. Thank you for sharing the code. After going through your code, I found two places where the implementation could be faster.

  1. In the function filterItChopOff, you could replace signal.convolve2d with cv2.filter2D which is a faster implementation.
  2. In the function rotatePC, it is better to convert R, which is originally the type of dtype('O'), to dtype(np.float64), which is going to boost the performance of np.dot.

After the above two modifications, the execution time of getHHA.py is ~2.5s compared to the original ~23s.

@charlesCXK
Copy link
Owner

@hongfz16
Thanks for your helpful advice! I will test the solution you provide and update this repo if it has no problem.

@charlesCXK
Copy link
Owner

I follow your suggestions and find the bottleneck of the running speed lies in the R. It was the type of object, which is slow for np.dot function. I have updated the optimized code. Thanks again!

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

No branches or pull requests

2 participants