Ask Your Question
2

How to scale data in Open CV LibSVM

asked 2013-06-11 14:17:22 -0500

Heshan Sandeepa gravatar image

hi,

i am developing English Handwriting OCR. I use Zone based approach for feature extraction. Here I use 64 X 64 images. So i have 64 features for one sample image. My SVM will be Multi-class SVM because i have 52 classes for both capital and simple letters. Here is the format of feature vector.

Class A image1 0:0.222000 1:0.0250222 ..... 63:0.000052 Class A image2 (some float values) .... Class A image400 (some float values)

likewise i have 400 images for both 52 classes. I have read as scaling data increase the accuracy of the prediction. But i have few things to be make clear. 01. Can i use Open CV LibSVM as a Multi-class SVM ? 02. How can i scale these feature values ? 03. Is there any function to get the matching probability of each test feature vector in Open CV LibSVM(i search the Open CV 2.4.5 documentation, but i couldn't find this)

can anyone explain these? , and also with some few code lines if possible.

Thank you

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2013-06-11 15:13:20 -0500

Guanta gravatar image
  1. Yes you can use OpenCV's SVM for multi-class classification. See also the example "letter_recog.cpp" under samples/cpp.

  2. What do you mean by scale the features? If you mean normalization: then yes, typically you normalize your data (see e.g. http://metaoptimize.com/qa/questions/8168/why-is-data-normalization-a-good-thing).

  3. Unfortunately not. You can compute them from the response-values and your labels using e.g. Platt's algorithm (see e.g. http://www.csie.ntu.edu.tw/~cjlin/papers/plattprob.pdf).

Imho the ML module and especially the SVM-part is not the strongest part of OpenCV (underlying libSVM is not a recent version and some functionality like the posterior probability is missing). If you have the choice, have a look at Python+ScikitLearn or WEKA or the statistic programming language 'R' (apparently not the best programming language but contains the reference implementations of the most ML-algorithms).

edit flag offensive delete link more

Comments

hi Guanta - thank you very much for considering my problem and for your effort. I thought to use the pure LibSVM instead of OpenCV integrated one. Both are same but i need to observe the posterior probability of my data. Thank you very much

Heshan Sandeepa gravatar imageHeshan Sandeepa ( 2013-06-13 06:57:38 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-06-11 14:17:22 -0500

Seen: 2,316 times

Last updated: Jun 11 '13