This project is inspired by the code snippets available from Svetlana Lazebnik et al.. It implement the Spatial Pyramid Matching scheme for classifying different scene categories, while yielding the GPU and Parallel Computing Toolboxes of MATLAB.
Progression of the loss function for optimizing some of the hyperparameters of the SVM
Progression of the loss function for optimizing one of the hyperparameters of the SVM
Code diagram of the script
- denseSIFTVN.m: Extracts dense SIFT descriptors from the images.
- DictionaryFormationVN.m: Forms a dictionary of visual words using k-means clustering.
- Final_Experiment.m: Main script to run the experiment, including feature extraction, dictionary formation, spatial pyramid matching, and SVM classification.
- gaussVN.m: Applies Gaussian filtering to the images.
- hist_intersection_VN.m: Computes the histogram intersection kernel.
- miniBatchKMeansVN.m: Performs mini-batch k-means clustering.
- resultsTable.mat: Stores the results of the experiments.
- scene_categories/: Directory containing the dataset of scene categories.
- SIFTnormalizationVN.m: Normalizes SIFT descriptors.
- SpatialPyramidVN.m: Constructs spatial pyramid representations of the images.
- splitTheDatastore2.m: Splits the image datastore into training and testing sets.
To run this project:
- Ensure MATLAB is installed on your system.
- Clone this repository to your local machine.
- Place your dataset in the
scene_categories/
directory. - Open MATLAB and navigate to the cloned project directory.
- Run the
Final_Experiment.m
script to start the image classification pipeline.
run('Final_Experiment.m')
This repository is a simple form of reproduction with a few changes compared to the initial files that are provided. In keeping with that theme, one can identify the use of GPU accelaration and Parallel processing to minimize the experiment's time to completion. Yet, there exist comments and parts inside some code snippets (even cases where the only changes made in the code snippets are just more explanatory comments) that belong in the initial draft of the contributors as the latter are provided in the link. All acknowledgements for those parts go to the authors!
This code is for teaching/research purposes only.
Pyramid Levels | Number of Centers | Optimization Parameter | Mean Accuracy |
---|---|---|---|
2 | 200 | BoxConstraint | 71.7507 |
2 | 200 | BoxConstraint & KernelScale | 71.3947 |
2 | 200 | All | 71.6320 |
2 | 400 | BoxConstraint | 71.6024 |
2 | 400 | BoxConstraint & KernelScale | 71.8398 |
2 | 400 | All | 70.5935 |
3 | 200 | BoxConstraint | 76.0237 |
3 | 200 | BoxConstraint & KernelScale | 75.1335 |
3 | 200 | All | 76.0534 |
3 | 400 | BoxConstraint | 74.6588 |
3 | 400 | BoxConstraint & KernelScale | 75.9050 |
3 | 400 | All | 76.9139 |
4 | 200 | BoxConstraint | 73.2344 |
4 | 200 | BoxConstraint & KernelScale | 74.5994 |
4 | 200 | All | 75.5786 |
4 | 400 | BoxConstraint | 75.6083 |
4 | 400 | BoxConstraint & KernelScale | 75.0742 |
4 | 400 | All | 74.2433 |