ECE 5554 / ECE 4554: Computer Vision Fall 2017

Instructions

  • Due date: 11:59pm on Monday, November 27, 2017

  • Handin: through Canvas

  • Starter code and data: hw5.zip

  • Deliverables:

    • Please prepare your answer sheet using the filename of FirstName_LastName_HW5.pdf.

    • Include all the code you implement in each problem. Remember to set relative paths so that we can run your code out of the box.

    • Compress the code and answer sheet into FirstName_LastName_HW5.zip before uploading it to canvas.

Scene Cateogrization (100 points)

 

The goal of this assignment is to introduce you to image categorization. We will focus on the task of scene categorization. You task is to implement image features, train a classifier using the training samples, and then evaluate the the classifier on the test set.


Dataset: In the supplemental material, we have supplied images with 8 outdoor scene categories: coast, mountain, forest, open country, street, inside city, tall buildings and highways. The dataset has been split into a train set (1888 images) and test set (800 images), placed in train and test folders separately. The associated labels are stored in gs.mat, for example, label id of 42.jpg in the training folder corresponds to train_gs(42). Its actual label name will be names{train_gs(42)}.

A. Color histogram and k-nearest neighbor (kNN) classifier (25 points)

  • Implement a function to compute the color histogram of an image. For example, you can use the Matlab function hist for computing marginal histogram of RGB channels.

  • Use nearest neighbor classifier (kNN) to categorize the test images.

B. Bag of visual words model and nearest neighbor classifier (25 points)

  • Implement K-means cluster algorithm to compute visual word dictionary. The feature dimension of SIFT features is 128.

  • Use the included SIFT word descriptors included in sift_desc.mat to build bag of visual words as your image representation.

  • Use nearest neighbor classifier (kNN) to categorize the test images.

C. Bag of visual words model and a discriminative classifier (25 points)

  • Use the bag of visual word representation.

  • Replace the nearest neighbor classifier with SVM classifer. Use 1 vs. all SVM for training the multi-class classifier.

D. Spatial pyramid model and a discriminative classifier (25 points)

Write-up

  • (25 points) A. Color histogram and k-nearest neighbor (kNN) classifier

    • Describe your quntization/binning method and parameters

    • Report number of K for the kNN classifer

    • Display the confusion matrix and categorization accuracy.

  • (25 points) B. Bag of visual words model and nearest neighbor classifier

    • Describe the number of visual words you use, K-means stopping criterion, and the categorization accuracy.

    • Display the confusion matrix and categorization accuracy.

  • (25 points) C. Bag of visual words model and a discriminative classifier

    • Report the training time and testing time for SVM

    • Display the confusion matrix and categorization accuracy.

  • (25 points) D. Spatial pyramid model and a discriminative classifier

    • Describe the level of pyramid you used.

    • Display the confusion matrix and categorization accuracy.

Hint

  • You cannot use built-in or external implementation of K-Means algorithm.

  • Useful MATLAB function

    • hist: for building the histogram for color and bag of visual words.

    • pdist2: for finding nearest neighbor

    • KDTreeSearcher: for efficient nearest neighbor search

    • fitcsvm, : for training a SVM

Graduate credit (max possible 30 points extra credit)

  • up to 10 points: Use “soft assignment” to assign visual words to histogram bins. Each visual word will cast a distance-weighted vote to multiple bins.

 
  • up to 10 points: For bag of visual word models, experiment with different number of visual word, e.g. K = 25, 50, 100, 200, 400, 800, 1600. Report the categorization accuracy for each K.

  • up to 15 points: Using pre-trained convolutional neural network as a feature extractor and a SVM for scene categorization. You can use the ConvNet library in MATLAB MatConvNet with one of the pre-trained models here.

 


In your answer sheet, describe the extra points under a separate heading.

Acknowledgements

This homework is adapted from the projects developed by Derek Hoiem (UIUC).