classification - how to implement a general image classifier using SIFT and SVM -
i want train svm classifier image categorization scikit-learn. , want use opencv-python's sift algorithm function extract image feature.the situation follow:
1. scikit-learn's input of svm classifier 2-d array, means each row represent 1 image,and feature amount of each image same;here
2. opencv-python's sift algorithm returns list of keypoints numpy array of shape . here
question is:
how deal sift features fit svm classifier's input? can me ?
update1:
thanks pyan's advice, i've adapt proposal follow:
1. sift feature vectors each image
2. perform k-means clustering on vectors
3. create feature dictionary, a.k.a. cookbook, based on cluster center
4. re-represent each image based on feature dictionary, of course dimention amount of each image same
5. train svm classifier , evaluate it
update2:
i've gathered image sift feature vectors array(x * 128),which large, , need perform clustering on it.
problem is:
if use k-means , parameter cluster number has set, , don't know how can set best value; if not use k-means, algorithm may suitable this?
note:i want use scikit-learn perform clustering
proposal :
1. perform dbscan clustering on vectors, can label_size , labels;
2. because dbscan in scikit-learn can not used predicting, train new classifier based on dbscan result;
3. classifier cookbook, can label every image's sift vectors. after that, every image can re-represented ;
4.based on above work, can train final classifier b.
note:for predict new image, sift vectors must transform classifier vector classifier b's input
can give me advice?
image classification can quite general. in order define features, first need clear kind of output want. example, images can categorized according scenes in them nature view, city view, indoor view etc. different kind of classifications may require different kind of features.
a common approach used in computer vision keywords based image classification bag of words (feature bagging) or dictionary learning. can literature search familiarize on topic. in case, basic idea group sift features different clusters. instead of directly feeding scikit-learn
sift features, give vector of feature group frequency input. each image represented 1-d vector.
a short introduction wikipedia bag-of-words model in computer vision
Comments
Post a Comment