COS 429 - Computer Vision

Fall 2011

Course home Outline and lecture notes Assignments

Assignment 4

Due Friday, Dec. 16

This assignment is about image classification, using a "bag of features" approach. It begins with a training phase:

  1. Start by downloading, which contains a subset of the Caltech 101 database, with 10 classes of 30 images each.
  2. Pick 10 images from each category to act as the training set. The remaining images will be the test set.
  3. Randomly select n grayscale patches of size 11x11 from each training image, if you want to use the color information, you can also use 11x11x3 patches. (Start with a small number of patches for debugging, then move to a larger number for your final tests.)
  4. Run k-means clustering (e.g. with k=100) on the training patches, forming the resulting cluster centers into a "codebook".
  5. Learn patch histograms for each class:
       For each class:
          For each training image in the class:
             For each patch:
                Find the nearest vector in the codebook, and increment a
                counter for that codeword's entry in a 100-dimensional
                histogram for the class.

Now, you will classify each image in the test set, using the Naive Bayes method, as described in this document. Implement the following:

   For each image in test set:
      Set the (un-normalized) probability of each class to 1
      For each of n randomly-selected patches:
         Find the nearest codeword in the codebook, and multiply the
         probability of each class by one plus the count of that codeword
         in the class's histogram
      Select the class with the Maximum A Posteriori (MAP) probability.

Report the confusion matrix for the classification. That is, form a matrix of 10 rows and 10 columns (where 10 is the number of classes), such that the entry in the i-th column and j-th row equals the probability that a query for an image of class i yields a result of class j. You should include the confusion matrix as a table of numbers; if you wish, you may also make a graphical visualization.


This assignment is due Friday, December 16, 2009 at 11:59 PM. Please see the general notes on submitting your assignments, as well as the late policy and the collaboration policy.

Please submit a single .zip file containing:

The Dropbox link to submit the assignment is here.

Last update 1-Dec-2011 11:18:07
smr at princeton edu