-
Notifications
You must be signed in to change notification settings - Fork 60
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
Apply fixes to skimage.transform scheduled for scikit-image 0.19.2 #208
Apply fixes to skimage.transform scheduled for scikit-image 0.19.2 #208
Conversation
@chrisroat, Can you provide some context of the sizes of the For that reason this |
Thanks for consolidating everything, and adding the conversion to cupy arrays. My incremental approach was too slow. :) The application in question is warping a chunk of data to a new coordinate system. The code basically looks like the following. The
|
corresponds to scikit-image gh-6207 and gh-6214 Co-authored-by: Chris Roat <1053153+chrisroat@users.noreply.github.com>
incorporates the change from scikit-image gh-6211 Also updates PiecewiseAffineTransform to be consistent with the other transform types in keeping self.params as a CuPy array when the inputs are CuPy arrays. Note that performance of this transform will be very slow due to host/device transfers to access the CPU-only scipy.spatial.Delaunay. Co-authored-by: Chris Roat <1053153+chrisroat@users.noreply.github.com>
3fb8d05
to
2c0270f
Compare
Oh, sorry -- I realize now that you were asking about the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Greg! 😄
Had a couple questions below
# TODO: update if spatial.Delaunay become available in CuPy | ||
self._tesselation = spatial.Delaunay(cp.asnumpy(src)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we open an issue about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, it is probably not very easy to address though. We would need a Delaunay triangulation class with a vertices
attribute and find_simplex
method for the GPU (There are several other attributes/methods on this class in SciPy, but they are not used here). On the SciPy side the implementation relies on the QHull C library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure there are GPU implementations of Delaunay triangulation, but hadn't looked into whether there is a compatibly licensed one we could reuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we did find one, ideally it would be available via upstream cupyx.scipy.spatial
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk maybe it could happen. There has been work in the past like CudaHull
|
||
# determine triangle index for each coordinate | ||
simplex = self._tesselation.find_simplex(coords) | ||
# coords must be on host for calls to _tesselation methods | ||
simplex = self._tesselation.find_simplex(cp.asnumpy(coords)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we coerce to a NumPy array here?
Note: This comes up again below, but only commenting here for simplicity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._tesselation
is of class Delaunay
from SciPy so this find_simplex
method is wrapping some CPU implementation from QHull under the hood.
Yeah, that is probably the best approach here. |
So RAPIDS is releasing next week. Should we retarget this for the next release? |
Retargeted to |
@gpucibot merge |
Thanks Greg! 😄 Let's follow up on anything else in a new PR 🙂 |
Closes #199
Corresponds to:
scikit-image/scikit-image#6207
scikit-image/scikit-image#6211
scikit-image/scikit-image#6214
Additionally, the affines contained within the
PiecewiseAffineTransform
will have parameters in CuPy arrays when the inputs toestimate
are CuPy arrays. This is one to make it consistent with the other transform classes.@chrisroat, can you confirm if this fixes the issue for you?