Skip to content

A reproduction of the Spatial Pyramid Matching Scheme leveraging GPU and Parallel Processing in MATLAB as part of my thesis research

Notifications You must be signed in to change notification settings

Va-Ns/Spatial-Pyramid-Matching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Classification using the Spatial Pyramid Matching scheme in MATLAB

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.

image

Progression of the loss function for optimizing some of the hyperparameters of the SVM

image

Progression of the loss function for optimizing one of the hyperparameters of the SVM

mermaid-diagram-2024-07-06-235543

Code diagram of the script

Project Structure

  • 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.

How to Run

To run this project:

  1. Ensure MATLAB is installed on your system.
  2. Clone this repository to your local machine.
  3. Place your dataset in the scene_categories/directory.
  4. Open MATLAB and navigate to the cloned project directory.
  5. Run the Final_Experiment.m script to start the image classification pipeline.
run('Final_Experiment.m')

Disclaimer

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!

License

This code is for teaching/research purposes only.

Table of results

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

About

A reproduction of the Spatial Pyramid Matching Scheme leveraging GPU and Parallel Processing in MATLAB as part of my thesis research

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages