/SVM-Classifier

Example code for how to write an SVM classifier in MATLAB

Primary LanguageMATLAB

SVM-Classifier

Example code for how to write a SVM classifier in MATLAB.

How to Run:

To run the code, create two directories to store two categorical sets of image data. These directories of images will be used to train an SVM classifier.

Then, set the two variables in main_script, image_set_directory and image_set_complement_directory,equal to the directory paths where the training images are currently being stored. Finally run the main script to generate an SVM classifier data structure. The SVM classifier data structure can then be used to determine what category an unclassified image best fits.

The default configuration of the main_script.m file is two create a SVM classifier to make a classification decision of whether an unclassifed image best fits within a set of flower images, or set of foliage images. The script then proceeds to test how well the generated SVM classifier works by classifying a set unlabeled images and comparing its results to whether the image content is actually a picture of flowers or foliage.

The main_script can be changed to skip the testing of the SVM classifier and just return the SVM data structure needed for image classification.

Basic Principle:

The code works using the Support Vector Machine (SVM) classification algorithm (see en.wikipedia.org/wiki/Support_vector_machine for more information). It is important to keep in mind that an SVM is only capable of making a binary classifiaction. In other words, an SVM can only be trained to differentiate between two categories of training data at a time. Therefore, differentiating between more than two categories at a time is beyond the scope of this program.

The SVM in this code is used classify sets of images. To do this, a set of general statisics is generated by finding the corner points in an image and calculating the average and standard deviation of the pixel intesities around the cornor points.