SVM in OpenCV: low fidelity OCR with RBF core

I keep working with my OCR project using MS Visual Studio 2008, OpenCV, C ++ and SVM. I have created a dataset of 2000 copies of machine typed characters. When I test the linear kernel, I always get an accuracy rate of 96.36%.

How can I use SVM in OpenCV can be referred to this thread .

Now I am trying to use RBF core and am facing these two problems:

(1) No matter what parameters (C and gamma) I used, all characters were always classified as 0 (zero). If I test MNIST all digits are 9.

I hope someone with experience in OpenCV and SVM can explain to me. I know there are still some good machine learning and image processing frameworks like ACCORD.NET, but I've already used C ++ and it would be difficult to turn the whole program into C # (OCR is only part of it).

OpenCV version - 2.3.1.

(2) I have moved this issue to another question like etarion's suggestion. If you have time, please check this: Visual Studio reports error C2664 using SVM method in openCV .

+3


source to share


2 answers


The theory assumes that with the right parameters, the RBF core works at least as well as the linear core. Therefore, I will list common sources of problems:



  • Perhaps you have numerical difficulties. Have you normalized your data? Each function from 0 to 1? or -1 and 1? What is the numerical range of the actual solution values? What is the range of values ​​for the function?

  • Is it possible that you are overestimating the performance of a linear classifier (i.e. testing and training on the same data?)

  • Maybe your view of multiple classes is messed up in some way. Does it make a performance difference for the problem with two classes instead of ten problems of a class?

+1


source


As for the first part, it is very likely that your options are disabled. There's a train_auto method for automatically estimating the parameters, you can expand the ranges of the parameters used if they don't yield pleasant results by passing custom parameter grids to the method (but try the default parameters first).



0


source







All Articles