LibSVM -> OpenCV SVM model conversion
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!
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)
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.
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.