Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bag of words - image classification

i have some doubts incase of bag of words based image classification, i will first of tell what i have done

  1. i have extracted the features from the training image with two different categories using SURF method,

  2. i have then made clustering of the features for the two categories.

  3. in order to classify my test image (i.e) to which of the two category the test image belongs to. for this classifying purpose i am using SVM classifier, but here is what i have a doubt , how do we input the test image do we have to do the same step from 1 to 2 again and then use it as a test set or is there any other method to do,

  4. also would be great to know the efficiency of the bow approach,

kindly some one provide me with an clarification

like image 708
user1903801 Avatar asked Dec 14 '12 11:12

user1903801


People also ask

How is image classification performed for bag of words?

Use the Computer Vision Toolbox™ functions for image category classification by creating a bag of visual words. The process generates a histogram of visual word occurrences that represent an image. These histograms are used to train an image category classifier.

What is bag of features image classification?

Bag Of Visual Words(also known as Bag Of Features) is a technique to compactly describe images and compute similarities between images. It is used for image classification. The approach has its origin in text retrieval(information retrieval) and is an extension to the NLP algorithm Bag of Words.

How does a bag of visual words work?

In bag of words (BOW), we count the number of each word appears in a document, use the frequency of each word to know the keywords of the document, and make a frequency histogram from it. We treat a document as a bag of words (BOW).

How do we use clustering to compute a bag of words image representation?

The number of the clusters is the codebook size (analogous to the size of the word dictionary). Thus, each patch in an image is mapped to a certain codeword through the clustering process and the image can be represented by the histogram of the codewords.


1 Answers

The classifier needs the representation for the test data to have the same meaning as the training data. So, when you're evaluating a test image, you extract the features and then make the histogram of which words from your original vocabulary they're closest to.

That is:

  1. Extract features from your entire training set.
  2. Cluster those features into a vocabulary V; you get K distinct cluster centers.
  3. Encode each training image as a histogram of the number of times each vocabulary element shows up in the image. Each image is then represented by a length-K vector.
  4. Train the classifier.
  5. When given a test image, extract the features. Now represent the test image as a histogram of the number of times each cluster center from V was closest to a feature in the test image. This is a length K vector again.

It's also often helpful to discount the histograms by taking the square root of the entries. This approximates a more realistic model for image features.

like image 81
Danica Avatar answered Sep 30 '22 21:09

Danica