GithubHelp home page GithubHelp logo

Comments (16)

JoOkuma avatar JoOkuma commented on May 27, 2024 1

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.

gigony avatar gigony commented on May 27, 2024

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.

jakirkham avatar jakirkham commented on May 27, 2024

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.

grlee77 avatar grlee77 commented on May 27, 2024

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.

jakirkham avatar jakirkham commented on May 27, 2024

This reminds me, @JoOkuma pointed me to this watershed implementation, which might also be of interest here 🙂

from cucim.

JoOkuma avatar JoOkuma commented on May 27, 2024

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.

grlee77 avatar grlee77 commented on May 27, 2024

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.

louismullie avatar louismullie commented on May 27, 2024

The implementation on my profile can be used under the Apache 2.0 license.

from cucim.

grlee77 avatar grlee77 commented on May 27, 2024

The implementation on my profile can be used under the Apache 2.0 license.

Great, thanks @louismullie

from cucim.

rijobro avatar rijobro commented on May 27, 2024

Any progress on this? @louismullie your implementation only works for 2d, correct?

from cucim.

jakirkham avatar jakirkham commented on May 27, 2024

Based on recent discussion, another option might be to build on NPP's FloodFill

from cucim.

ma-sadeghi avatar ma-sadeghi commented on May 27, 2024

@jakirkham Would it work for 3D as well?

from cucim.

jakirkham avatar jakirkham commented on May 27, 2024

No it is 2D only

from cucim.

ma-sadeghi avatar ma-sadeghi commented on May 27, 2024

@gigony Could you explain a little bit why porting scikit-image's watershed using cupy is not feasible? Thanks!

from cucim.

jakirkham avatar jakirkham commented on May 27, 2024

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.

jakirkham avatar jakirkham commented on May 27, 2024

Just noting this is something MONAI had expressed interest in using here.

cc @drbeh

from cucim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.