BOW prediction of cluster for training data

六眼飞鱼酱① 提交于 2020-01-03 03:28:24

问题


I am creating a bag of visual words for classification of videos. I am not using SURF descriptors and that is why I couldn't use OpenCV's BOWImgDescriptorExtractor for this purpose. I extracted my descriptors and I cluster them by myself. I have my vocabulary now (of size 4000). what I should do is to assign my training descriptors to these cluster and create visual histogram for next steps. how should I do this prediction and create visual histogram for my training data from the created dictionary ?


回答1:


In order to assign the descriptors to clusters, you have to choose a distance metric. A simple choice would be the Euclidean distance. Then you need to compute the distance from the training descriptors to each cluster centroid, and assign them to the cluster whose centroid is closer to the descriptor than the centroids of any other cluster.

After you've done that for all training descriptors on the image, you count the number of descriptors assigned to each cluster, and then build a histogram. The procedure must be repeated for all images in the training set, though. Since the number of descriptors might vary with the image, the histograms are usually normalized before being fed into the classifier as feature vectors for training.



来源:https://stackoverflow.com/questions/24186838/bow-prediction-of-cluster-for-training-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!