use kmeans to split database of flowers

Hi, My project is about flower recognition using matlab. I have database of 100 flower of 11 types. The purpose of the project is to get as input one of the flowers and print the name and features of the flower.
I already extract 4 features of the flowers( rgb colors, number of petals and etc.) Now I want to use 'kmeans' in order to devide the flowers into 11 clusters, when each type will be assign to one of the clusters. Does kmeans has option that will let me choose 11 of the flowers as seeds which will build the clusters? Or mayby you know about anoher function which will let me insert the flowers into 11 clusters manualy?
Thanks (^_^)

 채택된 답변

Shashank Prasanna
Shashank Prasanna 2013년 8월 21일
편집: Shashank Prasanna 2013년 8월 21일

0 개 추천

You can specify your 'seed' as start point for KMEANS:
[idx,ctrs] = kmeans(X,11,'start',seedmat)
X is your matrix of 100 rows and 4 columns (based on your description)
seedmat is a matrix of your 11x4 seeds centroids which is where KMEANS will start to search.

추가 답변 (1개)

taly
taly 2013년 8월 21일

0 개 추천

thank you very much Shashank.
I have one more question: how can I compare the subject flower, that will be described by 1X4 array (that contains his features), to the clusters that k-means made?

댓글 수: 4

Shashank Prasanna
Shashank Prasanna 2013년 8월 21일
idx is the cluster indices 1 through 11. Is that what you are asking for? what do you mean by compare?
Also, please don't post comments such as these under answers. You can reply to my answer with comments or clarifications.
taly
taly 2013년 8월 21일
sorry for that, I'm new here.
As for the question: I ment, after I have 11 clusters which each define one type of flower, Is there a way that I can compare another picture of a flower to the clusters, to check which one it belongs to.
The idea that crossed my mind is to add the array of the new flower as the last row of the matrix X and then use kmeans on X and check what cluster the last row go to.
Shashank Prasanna
Shashank Prasanna 2013년 8월 21일
check the distance from each your new flower to the centroids and pick the minimum distance.
taly
taly 2013년 8월 23일
That is a great way. Thank you very much (^_^)

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

카테고리

도움말 센터File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by