-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Faster
hessian_matrix_*
and structure_tensor_eigvals
via analytic…
…al eigenvalues for the 3D case (#434) closes #354 This MR implements faster 2D and 3D pixelwise eigenvalue computations for `hessian_matrix_eigvals`, `structure_tensor_eigvals` and `hessian_matrix_det`. The 2D case already had a fairly fast code path, but it is further improved here by switching from a fused kernel to an elementwise kernel that removed the need for a separate call to `cupy.stack`. In 3D runtime is reduced by ~30x for float32 and >100x for float64. The 3D case also uses MUCH less RAM than previously (>20x reduction). For example computing the eigenvalues for size (128, 128, 128) float32 arrays would run out of memory even on an A6000 (40GB). With the changes here, it works even for 16x larger data of shape (512, 512, 512). Functions that benefit from this are: - `cucim.skimage.feature.hessian_matrix_det` - `cucim.skimage.feature.hessian_matrix_eigvals` - `cucim.skimage.feature.structure_tensor_eigenvalues` - `cucim.skimage.feature.shape_index` - `cucim.skimage.feature.multiscale_basic_features` - `cucim.skimage.filters.meijering` - `cucim.skimage.filters.sato` - `cucim.skimage.filters.frangi` - `cucim.skimage.filters.hessian` Independently of the above, the function `cucim.skimage.measure.inertia_tensor_eigvals` was updated with custom kernels so it can operate purely on the GPU for the 2D and 3D cases (formly these used copies to/from the host). These operate on tiny arrays, so they use only a single GPU thread. Despite the lack of paralellism, this is lower overhead than round trip host/device transfer. This will also improve region properties making use of these eigenvalues (e.g. the `axis_major_length` and `axis_minor_length` properties for `regionprops_table`) Authors: - Gregory Lee (https://github.com/grlee77) Approvers: - Gigon Bae (https://github.com/gigony) URL: #434
- Loading branch information
Showing
4 changed files
with
395 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.