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

Mean shift algorithm #235

Open
wants to merge 1 commit into
base: source
Choose a base branch
from
Open

Mean shift algorithm #235

wants to merge 1 commit into from

Conversation

ashwani-rathee
Copy link
Member

  • covers mean shift image segmentation algorithm

@ashwani-rathee ashwani-rathee changed the title [WIP]: Mean shift algorithm Mean shift algorithm Sep 25, 2021
Copy link
Member

@timholy timholy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't noticed these (they arrived back when I wasn't paying attention), thanks for adding this!

Comment on lines +16 to +17
# - We have specify a prior on the number of clusters(Number of K which is no of
# segments).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# - We have specify a prior on the number of clusters(Number of K which is no of
# segments).
# - We have specify a prior on the number `K` of clusters (segments).

# but has two main issues:
# - We have specify a prior on the number of clusters(Number of K which is no of
# segments).
# - It can be sensitive to value of k-means parameter.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not entirely surprising. Is it really worth making as a separate point?

It could also be stated that K-means tends to return clusters of approximately equal radius, which may not be how a human would do it.

# - Each hill represents a cluster
# - Peak(mode) of hill represents "center" of the cluster
# - Each pixel climbs the steepest hill within its neighborhood
# - Pixel assigned to the hill(cluster) it climbs. That's the idea behind meanshift.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# - Pixel assigned to the hill(cluster) it climbs. That's the idea behind meanshift.
# - A pixel is assigned to the hill(cluster) it climbs.

I think the "idea behind meanshift" encompasses all of these points.

# The Manhattan Distance is another useful choice sometimes.
# - A radius. All pixels within this radius (measured according the above distance)
# will be accounted for the calculation.
# - A value difference. From all pixels inside radius r, we will take only those
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would "intensity" be clearer than "value"?

# - Set $m_i = f_i$ as initial mean fro each pixel idea
# - Repeat the following for each mean mi:
# - place window of size $w$ around $m_i$.
# - compute centroid m within the window set $mi = main$
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what main means

# Task: Find modes(clusters) of distribution.

# Clustering:
# - Set $m_i = f_i$ as initial mean fro each pixel idea
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# - Set $m_i = f_i$ as initial mean fro each pixel idea
# - Set $m_i = f_i$ as initial mean for each pixel


# Clustering:
# - Set $m_i = f_i$ as initial mean fro each pixel idea
# - Repeat the following for each mean mi:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the same notation. Is mi the same as $m_i$?

# - stop if shift in mean $m_i$ is less than a threshoold $\epsilon$, $m_i$ is the mode

# It's a very simple but computationally expensive method which doesn't require input of
# the number of clusters. Very robust to outliers and clustering depends on window size w.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, one could say that it replaces specification of # of clusters with the size of the radius.

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

Successfully merging this pull request may close these issues.

2 participants