Comments (16)
I would like to add that the solution to the watershed is not unique in the tie-zones (objects' boundaries where pixels have the same value). The tie-breaking strategy is usually an implementation detail and will probably yield different results in the GPU implementation.
from cucim.
Thanks @ma-sadeghi for the issue! We had a discussion on this issue before and we found that there are many ways to implement GPU-accelerated watershed algorithms and implementing scikit-image's watershed algorithm directly with CuPy is not feasible or tricky to implement.
We would keep follow up this issue and please let us know if you have any idea/knowledge on GPU-accelerated watershed algorithm.
Thanks!
/cc @grlee77
from cucim.
Greg likely has more thoughts here 🙂
Though one thing worth mentioning is we do have a random_walker
implementation. Admittedly not exactly what you are looking for, but may still be useful
from cucim.
Looking at the scikit-image watershed demo, the seed points for the watershed are determined via scipy.distance_transform_edt
. I did start a CuPy-based implementation for the distance transform based on the code in https://github.com/orzzzjq/Parallel-Banding-Algorithm-plus. I started with the 3D variant and have that working, but wanted to make things a bit more general in terms of not requiring all dimensions of the array to have the same size.
I had not started working on the watershed itself. Some reading turned up some GPU-based implementations in the literature, but I haven't looked into specifics of which might be best to implement. My initial impression of the scikit-image algorithm was that the priority queue data structure approach that is used there would likely not adapt well to the GPU.
from cucim.
This reminds me, @JoOkuma pointed me to this watershed implementation, which might also be of interest here 🙂
from cucim.
Hey @jakirkham.
I agree with @gigony, an implementation that produces results equivalent to skimage's watershed is tricky and might not even be that fast.
@alanpeixinho might have the GPU implementation from the article above. However, from my understanding, it does not produce the same results as the original watershed.
from cucim.
Two other GPU implementations:
1.) 2D implementation based on cellular automata in recent NPP
2.) A different GPU-based algorithm with corresponding citations at watershed-cuda, but I do not see any license info in that repository. Perhaps @louismullie can indicate if it could be used under an Apache 2.0 or similar license?
from cucim.
The implementation on my profile can be used under the Apache 2.0 license.
from cucim.
The implementation on my profile can be used under the Apache 2.0 license.
Great, thanks @louismullie
from cucim.
Any progress on this? @louismullie your implementation only works for 2d, correct?
from cucim.
Based on recent discussion, another option might be to build on NPP's FloodFill
from cucim.
@jakirkham Would it work for 3D as well?
from cucim.
No it is 2D only
from cucim.
@gigony Could you explain a little bit why porting scikit-image
's watershed using cupy
is not feasible? Thanks!
from cucim.
Actually Greg's probably the best one to explain that given he's familiar with the scikit-image codebase.
That said, we talked about this again today (hence the comment on this issue). AIUI the primary challenge with the algorithm used in scikit-image is it leverages a priority queue to go through and explore each neighborhood. This isn't particularly friendly for parallelism or working on the GPU. The other algorithms mentioned above may be better for parallelism, but could render results that are qualitatively different from what scikit-image does.
from cucim.
Just noting this is something MONAI had expressed interest in using here.
cc @drbeh
from cucim.
Related Issues (20)
- Can't install cucim from pip or conda
- [FEA] Improve performance of existing `equalize_adapthist` function (CLAHE)
- [QST] Is there a plan to add support for Jetson platforms (aarch64) or is it possible to build a Wheel ? HOT 2
- [BUG] Wrong Spacing for Aperio SVS HOT 2
- [FEA] add graycomatrix and graycoprops in skimage.feature HOT 3
- [QST] conda compatibility with scikit-image 0.20.0 HOT 2
- [BUG] CUDA_ERROR_ILLEGAL_ADDRESS with `morphology.isotropic_closing` HOT 2
- [FEA] Migrate `jpeg` to `libjpeg-turbo` HOT 3
- [QST] Installing cucim with pip under python in SideFX Houdini HOT 5
- [QST]About the Macenko implementation in the blog HOT 2
- [DOC] Clara Read Region Documentations
- Drop workarounds for scikit-image pre-0.19.0
- Drop `CUDA` info line
- Dynamically link (or `dlopen`) `libnvjpeg`
- Refactoring common `aarch64` & `x86_64` items in `dependencies.yaml` HOT 6
- Disable cuFile / GDS on SBSA ( `aarch64` ) HOT 1
- [BUG] 'free(): corrupted unsorted chunks' OR 'corrupted double-linked list' fatal errors OR segmentation fault HOT 1
- Flaky test: `test_read_region_cuda_memleak` HOT 1
- [BUG] Memory leak in read_region in generator mode (using a list of locations) HOT 2
- [cuCIM] CUDA 12 Conda Packages for ARM
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cucim.