Why is the value of cluster center and index keeps varying for an image in kmeans?

Dear Team,
Wish you all a Happy New Year 2014:).
Problem statement: I'm working on image retrieval using SURF features. After extracting the features from image, i tried using kmeans algorithm. I gave the below command for getting its index and cluster centers.
code
nWords = 5;
[idx,centers] = kmeans([features]',nWords);
When i try giving the above command in command window, value of idx and centers keeps varying for an image (gray scale image, size( 192 x 144)) whose extracted features is of size 64 x 10 single.Could you please let me know why the value of idx and centers are changing ?
Cheers,
Malini

답변 (1개)

Walter Roberson
Walter Roberson 2014년 1월 1일
kmeans by default uses random initialization. You can alter that by using the 'start' option; you could give a specific matrix for example.

댓글 수: 2

Thank you sir for your immediate response. Could you kindly explain more on type of specific matrix to be used. As I tried giving one dimensional and two dimensional matrix but it is throwing me error.
code
sample = [0.7 0.2;0.3 0.4];
[Qidx,Qcenters]=kmeans(Qfeatures,5,'Start',sample);
Error using kmeans (line 200)
The 'Start' matrix must have K rows.
Also could you please explain the difference between use of fuzzy c means and kmeans with respect to random initialization.Sorry for the inconvenience. kindly request you to guide me.
Cheers,
Malini
As you want 5 clusters, you must have 5 rows in your "sample" matrix. The rows must have size(Qfeatures,2) columns.
I do not know at the moment how fcm() initializes the clusters.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Cluster Analysis and Anomaly Detection에 대해 자세히 알아보기

제품

질문:

2014년 1월 1일

댓글:

2014년 1월 1일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by