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

bad performance with warp_polar in 3D #6614

Open
patquem opened this issue Nov 7, 2022 · 2 comments
Open

bad performance with warp_polar in 3D #6614

patquem opened this issue Nov 7, 2022 · 2 comments

Comments

@patquem
Copy link
Contributor

patquem commented Nov 7, 2022

Description:

Hello,
As mentioned in the documentation, warp_polar can be used in 3D.
Meanwhile, the performance are bad* in comparison to classical 2D warp_polar applied n-times on an array of shape (p, q) (considering an original 3D array of shape (n, p, q)).
Can this be improved ?
Thanks,
Patrick

*+60 % in the example below with my PC

Way to reproduce:

import time
import numpy as np
import matplotlib.pyplot as plt
from skimage.transform import warp_polar

arr = np.random.random((1000, 256, 256))

t1 = time.process_time()
warp_polar(arr, radius=100, channel_axis=0)
time1 = time.process_time() - t1

t2 = time.process_time()
for arr_i in arr:
    warp_polar(arr_i, radius=100)
time2 = time.process_time() - t2

print(time1 / time2)

Traceback or output:

No response

Version information:

3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)]
Windows-10-10.0.19041-SP0
scikit-image version: 0.19.3
numpy version: 1.21.6
@stefanv
Copy link
Member

stefanv commented Nov 8, 2022

My guess is that the for loops uses a lot less memory; that can sometimes help with performance. It's only 500MB of memory for the image, but the transformed coordinates also have to be computed and stored, so that's probably another 1500MB.

Even faster would be to precompute the warping coordinates for one slice, and to then re-apply those same coordinates repeatedly for each next slice.

@github-actions
Copy link

github-actions bot commented May 8, 2023

Hey, there hasn't been any activity on this issue for more than 180 days. For now, we have marked it as "dormant" until there is some new activity. You are welcome to reach out to people by mentioning them here or on our forum if you need more feedback! If you think that this issue is no longer relevant, you may close it by yourself; otherwise, we may do it at some point (either way, it will be done manually). In any case, thank you for your contributions so far!

@github-actions github-actions bot added the 😴 Dormant no recent activity label May 8, 2023
@github-actions github-actions bot removed the 😴 Dormant no recent activity label May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants