First time here? Check out the FAQ!

Ask Your Question
0

LibSVM -> OpenCV SVM model conversion

asked Jun 15 '17

ThorbjornSomod gravatar image

updated Jun 15 '17

Hi!

I have trained some SVM classifier models for an object recognition by the use of LibSVM. I trained them using LibSVM even though I planned to use them with OpenCV because I thought that since OpenCV's SVM implementations are (or were?) based on LibSVM this would be fine. However, OpenCV uses the .yml format for SVM models while LibSVM uses their own .model format. Is there any way to convert between the two? Does anyone know of any convenient tool that could do said conversion for me? Any help would be appreciated. Cheers!

Preview: (hide)

Comments

what kind of SVM models did you train there ?

problem here is not so much different text formats, but different internal data representation (libsvm uses "sparse" vectors.

maybe it's easier , to use libsvm with opencv data (and your pretrained models)

berak gravatar imageberak (Jun 16 '17)edit
1

I trained C-SVM models using an RBF kernel. I have also used LIBLINEAR to train models using the L2 regularized primal solver. As for LIBSVM I don't think they use a sparse representation unless you explicitly set a flag when training? The reason why I wanted to use the OpenCV implementation is that they have a lot of optimized functions that I could make use of :) So far what I have done is to extract feature vectors on a format recognized by libSVM and make wrapper functions. It works fine, but is less optimal when trying to obtain real-time performance.

ThorbjornSomod gravatar imageThorbjornSomod (Jun 16 '17)edit
1

i had a quick look at it yesterday, and i do not think, it's possible to convert the data.

opencv has "decision functions", libsvm doesn't, while libsvm has "probA and probB" values, which do not appear in opencv's svm. also the handling of the (uncompressed vs. compressed) support vectors differ.

berak gravatar imageberak (Jun 17 '17)edit

1 answer

Sort by » oldest newest most voted
0

answered Jun 18 '17

ThorbjornSomod gravatar image

Ah alright! Well thank you for taking a look at it! :)

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Jun 15 '17

Seen: 634 times

Last updated: Jun 15 '17