Skip to content
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

how to apply this method to image segmentation? #1

Open
DerekRay opened this issue Apr 1, 2022 · 2 comments
Open

how to apply this method to image segmentation? #1

DerekRay opened this issue Apr 1, 2022 · 2 comments
Labels
question Further information is requested

Comments

@DerekRay
Copy link

DerekRay commented Apr 1, 2022

spatious radius or range radius not needed?

@masqm masqm added the question Further information is requested label Apr 2, 2022
@masqm
Copy link
Owner

masqm commented Apr 2, 2022

Hi Derek,

  1. Yes, our algorithm can be used to image segmentation.

To adopt mean-shift in image segmentation, you can refer to:
https://github.com/MichaelMansour256/image-segmentation
This a simple image segmentation example. They use mean-shift algorithm in sklearn to achieve segmentation.

If you want use our algorithm instead of it, you can replace

bandwidth = estimate_bandwidth(x, quantile=.2,n_samples=500)
ms = MeanShift(bandwidth=bandwidth, bin_seeding=True)

to our the example code shown in README.md

It is important to note that segmentation of small-size images may be slower than sklearn since our algorithm uses GPUs. However, in the large-size image segmentation, our algorithm will have a speed advantage.

  1. For your second question, yes, our algorithm doesn't need pre-configured radius(bandwidth).
# Estimate bandwidth for mean shift(Select 1000 points)
bandwidth = cluster.estimate_bandwidth(X[0:999])
bandwidth_gpu = 2*bandwidth/(X.max()-X.min())

The code above can estimate a suitable bandwidth.

Best,
Masqm

@DerekRay
Copy link
Author

DerekRay commented Apr 8, 2022

Hi Derek,

  1. Yes, our algorithm can be used to image segmentation.

To adopt mean-shift in image segmentation, you can refer to: https://github.com/MichaelMansour256/image-segmentation This a simple image segmentation example. They use mean-shift algorithm in sklearn to achieve segmentation.

If you want use our algorithm instead of it, you can replace

bandwidth = estimate_bandwidth(x, quantile=.2,n_samples=500)
ms = MeanShift(bandwidth=bandwidth, bin_seeding=True)

to our the example code shown in README.md

It is important to note that segmentation of small-size images may be slower than sklearn since our algorithm uses GPUs. However, in the large-size image segmentation, our algorithm will have a speed advantage.

  1. For your second question, yes, our algorithm doesn't need pre-configured radius(bandwidth).
# Estimate bandwidth for mean shift(Select 1000 points)
bandwidth = cluster.estimate_bandwidth(X[0:999])
bandwidth_gpu = 2*bandwidth/(X.max()-X.min())

The code above can estimate a suitable bandwidth.

Best, Masqm

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants