-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Versatile distance transforms (Euclidean and Geodesic) #1332
Comments
also used in monai metrics computation Line 23 in f01994d
|
There is a recent paper using a convolution-based and differential approximation for a distance transform: |
Thanks @ddrobny. On a related note, tensorflow has a GPU implementation of the Felzenszwalb & Huttenlocher Distance transform:
For Euclidean distance, we can compare the performance (and read the interesting comments) with an established (but GPL so don't look at the code) implementation: |
As mentioned in #4603, @masadcv just released FastGeodis, a package to compute Geodesic and Euclidean distance maps in PyTorch. |
We plan to have an equivalent of SciPy's see: rapidsai/cucim#318 |
@grlee77 Thanks a lot! I just tried it on the DeepEdit Code and it appears to be 100% compatible to what scipy does, really awesome. |
Also for anyone wondering what the impact of this would be, I did some profiling on a full 3D volume. Here is the according snippet: https://gist.github.com/matt3o/0de8a24a10135ed24de6f77ab89e15b1 And the results were:
Edit: Added the cdt transform too, since that is the one used in DeepEdit. CDT runs a lot faster on CPU, still it's a huge difference for big volumes. |
Fixes Project-MONAI#4103 ### Description - considers spacing and subvoxel borders when computing surface Dice - reimplemented http://medicaldecathlon.com/files/Surface_distance_based_measures.ipynb using pytorch API - there's possibility of speed up once Project-MONAI#1332 is addressed ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [x] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Wenqi Li <[email protected]>
As of #6981, the Euclidean distance transform will be part of MONAI from version 1.3 ongoing. It has GPU support via cuCIM and runs a lot faster. Falls back to SciPy if necessary, look into the docs for details. I will also soon publish an overhauled version of DeepEdit with much faster transforms based on torch and this GPU-based distance transform, which will hopefully be integrated into MONAI as well |
Is your feature request related to a problem? Please describe.
Several segmentation pipelines, and in particular interactive segementation ones, rely on some form of distance transform (e.g. Euclidean, Chamfer or Geodesic Distance Transform).
At the moment there is no off-the-shelf pytorch function to compute these.
Describe the solution you'd like
A MONAI-based implementation of distance transforms (ideally differentiable) would be fantastic. It woul accelerate uptake of such methods.
Describe alternatives you've considered
Additional context
Example use cases of distance transforms in segmentaiton:
The text was updated successfully, but these errors were encountered: