Ask Your Question

Train Multiclass SVM for car plate recognition

asked 2015-02-04 03:02:21 -0500

seidju gravatar image

I'm trying to create a car plate recognition system, using OpenCV (C++). I've already seen this example on GitHub, but I want to use SVM, instead of K-nearest neighbours or Arificial Neural Networks.

I trained a SVM only for two classes (positive or negative), so how can I train to classify characters on the car plate?

I have 22 symbols (Y is the last one symbol) (i.e. 22 classes), should I create a bunch of binary SVMs? For example SVM(0,1), SVM(0,2)....SVM(Y,0), SVM(Y,1)...

If this is the case how can I merge all this files into one, to use it in recognition? I couldn't find any understandable information about it.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-04 03:32:32 -0500

berak gravatar image

updated 2015-02-04 04:08:49 -0500

whether you train 1 multi(22)class SVM or 22 one-against-all SVM's, the data is always the same.

what differs is the labels, and possibly the svm-params

you will have to 'flatten' your letter-images (via reshape(1,1)), push_back() that into a big data Mat, like this:

data:                   multiclass_labels:   single_class_lables(B)    single_class_labels(A)
l e t t e r A p i c             0                           -1                             1
l e t t e r B p i c             1                            1                            -1
l e t t e r A p i c             0                           -1                            -1
l e t t e r C p i c             2                           -1                            -1
l e t t e r Y p i c             21                          -1                            -1

in the multiclass case, you do one prediction, and use the return value as label,

in the one-against-all case, you do 22 predictions, and use the one that returns a value > 0

edit flag offensive delete link more


Wow, thanks for clearing thigs up! But how can do it in syntax of opencv? I have 22 folders with pictures of letters, i go to 1st folder - for example , folder A, so i reshape each picture in folder A and put it in data Mat with label 1, then i go to folder B, do the same steps, but what label i need to use 2, or -1? I'm really confused in that numbers...

seidju gravatar imageseidju ( 2015-02-04 03:41:58 -0500 )edit

for multiclass, use 0,1,2,3, etc, for single class use +1 for positive , -1 for negative(all others)

berak gravatar imageberak ( 2015-02-04 03:55:56 -0500 )edit

Question Tools

1 follower


Asked: 2015-02-04 03:02:21 -0500

Seen: 4,013 times

Last updated: Feb 04 '15