0
votes

I want to generate training data using LIBSVM and HOG within MatLab.

I have computed the HOG Descriptor for one image which is 3780 x 1 (double) short snippet:

0
     0
0.0181
0.7746
     0
     0
     0
     0
0.4692
0.5279
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
0.4692
0.5279
0.0016
0.0018
0.2826
0.2535
     0
     0
0.2728
0.0451
     0
     0
0.1788
0.0209
     0
     0
0.0501
0.0059
     0
     0
0.1320
0.0137

which I assume is the training_instance_matrix:

svmtrain(training_label_vector, training_instance_matrix [, 'libsvm_options']);

How do I classify the elements in this vector to generate

training_label_vector

?

1
SVM is a binary supervised method. Hence, it is separating your dataset into two groups. For the training, you need to provide paired data, i.e. (observations,label), in order to give value to the model parameters. Basically, your training_label_vector could be a binary vector saying to which group belongs each sample. Reference: cs229.stanford.edu/notes/cs229-notes3.pdf - tashuhka
Thank you for your response and I understand the premise of it, however I'm still rather confused. For my training_instance_matrix I have generated the HOG Descriptor of one image which is a 3780 x 1 feature descriptor vector - my problem is I don't know how to classify the elements. - Gwenji
For example, if your picture has a person that you want to detect, create a matrix of the same size with 1's in the pixels of the person, and 0's otherwise. Then resize the matrix to fit the features vector. - tashuhka
Thanks again. Just to verify, if I extract the HOG Descriptors of a 100 images, 50 being human beings to be detected and 50 not human beings, concatenate the vectors so I have a matrix size 100 x 3780 as my training_instance_matrix. I then have a matrix size 1 x 3780 containing 1s and 0s for my training_label_vector - 1s if the first image is a human, 0 if not? - Gwenji
Nop. I assumed that you wanted to detect the exact position, but you just want to classify each picture as Person or NonPerson. Thus, you have 100 samples, and each sample has 3780 features. Finally, your feature matrix has dimensions 100x3780, while the label vector has dimensions 100x1. - tashuhka

1 Answers

0
votes

Summary:

SVM is a binary supervised method. Hence, it is separating your dataset into two groups. For the training, you need to provide paired data, i.e. (observations,label), in order to give value to the model parameters. Basically, your *training_label_vector* could be a binary vector saying to which group belongs each sample.

If you want to classify each picture as containing or not a person on it: Person or NonPerson. You have N=100 samples, and each sample has M=3780 features. Finally, your feature matrix has dimensions NxM=100x3780, while the label vector has dimensions Nx1=100x1. The label vector has 1's for the pictures with a person, and 0's otherwise (this configuration is actually arbitrary).