matlab - Bag of Words Classification Using KNN -
i have computed bag of words models training , testing images. have 260 bow vectors(100x1) training images , 282 bow vectors (100x1) testing images. classify test images using knn algorithm. however, don't know how use bow vectors.
i assume want use knn in decision process.
to able use knn, need calculate distance between 2 vectors. can use norm calculate distance. fortunately, matlab doing if have statistics , machine learning toolbox.
let x vector , each row of 1x100 bow vectors(transpose of them). , y vector assign class of each bow vector. instance, if want classify images whether includes bicycle or not, y must contain binary(if bicycle presented in image : 1 or otherwise: 0) information each histogram.
x = [ - ---- -- - -- - first histogram; y = [1; - - - ---- -- -- second histogram; 0; - ---- - ------ third histogram] 1] mdl = fitcknn(x,y); %this model.
actually, don't know whether work or not bow, because use svm it. so, luck , please inform if worked or not.
Comments
Post a Comment