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

implement stacked spatial transforms as coordinates ops + resampling #112

Closed
wyli opened this issue Feb 24, 2020 · 2 comments · Fixed by #131
Closed

implement stacked spatial transforms as coordinates ops + resampling #112

wyli opened this issue Feb 24, 2020 · 2 comments · Fixed by #131
Assignees

Comments

@wyli
Copy link
Contributor

wyli commented Feb 24, 2020

stacked spatial transforms such as #107 #108 #109 #110 #111 could be implemented as computing multiple operations on a grid and doing one step resampling

This ticket looks for a "vanilla" non-gpu implementation

https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.map_coordinates.html
https://pytorch.org/docs/stable/nn.functional.html#grid-sample

@tvercaut
Copy link
Member

I had a quick play with grid-sample and it performs quite well in comparison to other easily accessible alternatives for resampling:
https://colab.research.google.com/drive/17pI6xPGLTGcpGBulBrWZeNnBfLAwzqZT

Why not just stick to this for the resampling part (at least unless we find a faster or more feature rich implementation)?

scipy
10 loops, best of 3: 25.4 ms per loop

jax on device
10 loops, best of 3: 72.8 ms per loop

torch with Tesla T4
10000 loops, best of 3: 149 µs per loop

opencv cpu
1000 loops, best of 3: 1.3 ms per loop

cupy on device
100 loops, best of 3: 4.48 ms per loop

For the record, there is an interesting related discussion thread here:
pytorch/pytorch#24870

@wyli
Copy link
Contributor Author

wyli commented Feb 24, 2020

Thanks! looks very promising. we'll do some benchmarking for complete preprocessing pipelines, also need to consider the multi-gpu cases. @madil90

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 a pull request may close this issue.

2 participants