I have more than 1500 black and white classified images in a training set and I want to create a probabilistic model to classified new images. To be more explicit, given a new black and white image, my model has to predict:animal: 84%vegetal: 12%mineral: 4%I watched this lecture and I still have questions about the procedure to create this model.1. Extraction of the keypoints of each imageIf I correctly understood the video, the first step is to extract all the keypoints with SIFT from all the images to create a kind of dictionary of visual words. Each word is described by a multidimensional vector.Next, I have to use the $k$-means method to create groups of visual words.Question 1: how many groups should I create? Does it exist a rule-of-thumb to determine the $k$ number I have to use?2. Creation of histogramsNow, for each image, I have to create an histogram/a vector where each features corresponds to one group defined in part 1. The value associated to each feature corresponds to the frequency of the word in the image.Question 2: how can I create this vector? Indeed, each image is unique and will never match perfectly with the words in my dictionary (words who is, by the way, mean of different words). Who can I bypass this problem?3. Creation of the modelFinally, I have to create my model. In the video, the lecturer used SVM and has to create one classifier by category (binary classifier). In my case, I have 100 different categories (my introduction was a simplification) and I prefer to have only one classifier. Also, I want to get the probabilities, given an image, to be part of a category.Question 3: is it possible to create only one classifier who gives probabilistic data?To finish, don't hesitate to make suggestions or corrections about the procedure I described if you know a better way to classified my data.
What is the procedure to create a bag of visual words model with SIFT?
predictive modeling;image classification;probability
Question 1: how many groups should I create?There is no rule of thumb but typically if you have n categories of data you may want to set k as 10*n. This has known to work well, however you can always change this number by looking at the accuracy on your validation data set.Question 2: Creation of histogramsLet us say you extract m features from each image and your dictionary contains k words, for each of these m features you would find the closest match to the k words and assign this word to that particular feature. This way you will have m number of visual words taking one of the k values. Now you count the occurrence of these visual words and creating a normalized histogram out of it. So each image will have a normalized histogram of the k visual words.Question 3: ClassificationNow that we know how to extract a histogram for a given image, we would compute the histograms on the training data and given a test image we extract its histogram. Now, how we classify this is entirely up to you. You could just find the closest match in the histograms of training data using euclidian distance or do a weighted sum etc. A simple way of obtaining probabilistic data is to train a neural network with softmax at the output layer and given a test image pass its histogram through the network and obtain the probabilities. 