visual bag of words model we have seen the effectiveness of the popular bag of words model in extracting meaningful features from unstructured text documents bag of words refers to the document being broken down into its constituentswords and computing frequency of occurrences or other measures like tf-idf similarlyin case of image raw pixel matrices or derived feature descriptors from other algorithmswe can apply bag of words principle however the constituents will not be words in this case but they will be subset of features/pixels extracted from images which are similar to each other imagine you have multiple pictures of octopuses and you were able to extract the dense surf features each having values in each feature vector you can now use an unsupervised learning algorithm like clustering to extract clusters of similar feature descriptors each cluster can be labeled as visual word or visual feature subsequentlyeach feature descriptor can be binned into one of these clusters or visual words thusyou end up getting one-dimensional visual bag of words vector with counts of number of feature descriptors assigned to each of the visual words for the feature descriptor matrix each feature or visual word tends to capture some portion of the images that are similar to each other like octopus eyestentaclessuckersand so onas depicted in figure - figure - visual bag of words (courtesy of ian londonimage classification in python with visual bag of wordsthe basic idea is hence to get feature descriptor matrix from using any algorithm like surfapply an unsupervised algorithm like -means clusteringand extract out bins or visual features/words and their counts (based on number of feature descriptors assigned to each binthen for each subsequent imageonce you extract the feature descriptorsyou can use the -means model to assign each feature descriptor to one of the visual feature clusters and get one-dimensional vector of counts this is depicted in figure - for sample octopus imageassuming our vbow (visual bag of wordsmodel has three bins of eyestentaclesand suckers