How to use libsvm to train and classify images?

795 Views Asked by At

The classification using the libsvm is always wrong and it never changes the predicted label.(ex. I have 7 emotions, when i try to predict an image from outside the dataset it gives me 4. which is happy emotion, I tried an image from the dataset and the same label is the result)

I extratced the image features using the gabor filter with orientation 6 and scale 4. I used a script grid.py to find the optimal values for cost and gamma Finally i used the parameters in the last step in training and get model

./svm-train -c 8 -g 0.03214 svm.train model.model

I tried to change the kernal function and svm-type but it's still the same problem.

Is there any relation between number of features i use in training and number of images in dataset?

Note:I used the japanese women facial expression dataset.

1

There are 1 best solutions below

0
On

I don't think you want to use SVM for image classification. The task you describe (detecting emotions on image) require you to feed extremely good features to your SVM to learn from, gabor filter won't do this.

I suggest you to try a deep learning approach - for example you may wish to try a convolutional neural network for this. These thing is able to extract features out of raw image and then use them to classify the images.

Check this out: http://danielnouri.org/notes/2014/12/17/using-convolutional-neural-nets-to-detect-facial-keypoints-tutorial/

Here they use DNN to find the facial key points on image (i.e. location of eyes, nose tip etc.). You may want to adjust the code a little so that it just classifies your images.

Once again, the power of DNN is that it acts both as feature extractor and as a classifier. It is an incredibly powerful tool for image recognition tasks, unlike the SWM of any type.