Question

I am trying to use HoG+SVM to classify objects into different categories. The issue is that the dimension of the training images are different. So, the resulting HoG descriptors have variable lengths. I've extracted the features from all the training images into a cell. Each element i of the cell is a vector of HoG descriptors for image i in the dataset. My question is that how do I make it compatible for training the SVM classifier (using svmtrain function)?

Was it helpful?

Solution

As lejlot correctly mentioned, SVM cannot be trained with variable length vectors.

You can just normalize image size to one, i.e. 256x256. There are 3 possibilities to do this:

  1. Crop the 256x256 patch around center.
  2. Resize image to 256x256 discarding original aspect ratio.
  3. Resize image to 256xM where M < 256 - preserving original aspect ratio. Than add grey stripes at left and right (or top and bottom) to fill image to the 256x256.

All variants are used by different authors and you have to check which one suits your task best.

OTHER TIPS

SVM cannot be trained with variable length vectors. You have to use some kind of transformation which will map your data into constant length representation. You can for example perform well known dimensionality reduction techniques.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top