Why is the value of cluster center and index keeps varying for an image in kmeans?
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Walter Roberson
on 1 Jan 2014
kmeans by default uses random initialization. You can alter that by using the 'start' option; you could give a specific matrix for example.
2 Comments
Walter Roberson
on 1 Jan 2014
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.
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!