How to increase trainvectorclassifier speed for svm?

Hi everyone
I am running svm with the graphic version of mapla.bat in Windows, which is very time consuming. I’m not sure if the software uses all the cores of the system. How can I enable multiple threads for Windows(mapla.bat or monteverdi.bat)?
Thank you in advance

Hello,

I don’t think this is possible, as the implementation of this algorithm is not multithreaded (as far as I know). The SVM implementation is based on libsvm

Cédric

Thank you very much for the answer cedric. As I understood from your answer, the type of algorithm implementation is important. Please advise how can I enable multiple threads in general? I saw a typichttps://forum.orfeo-toolbox.org/t/is-otbcli-trainvectorclassifier-supporting-multi-core-processing/112 that openmp should be enabled to use all system cores, but I did not understand how to enable it for Windows and mapla. Is it possible at all?

This is a compilation option when compiling OTB from sources, when configuring the CMake project the OTB_USE_OPENMP should be set to on (and OpenMP should be available). OpenMP is only used in a few applications in OTB, for example by VectorClassifier, or in some algorithms of TrainVectorClassifier (e.g. SharkRandomForest)

Note that most OTB applications rely on ITK multi-threading, not on OpenMP.

Cédric

Thank you very much for your explanation cedric
The time consuming svm is due to the activation of the Optimize option. (I enable the Optimize option because the svm input is only C and gamma cannot be entered). Is there a way for me to enter the gamma and C parameters myself, so that I do not need to enable the Optimize option? Can anyone send me the trainvectorclassifier Python code or command-line code for libsvm? Maybe that’s the only solution, and unfortunately my knowledge of the programming language is zero.
Thanks in advance

Indeed you can set -classifier.libsvm.c … but the gamma parameter is missing.

I don’t know very well SVM but I feeel like the answer to this comment is “yes”. And maybe rbf isn’t the only kernel with missing parameters… This smells like a feature request (just did that here). This feature should be available in the next release, we’ll keep you updated!

1 Like

Thank you very much for your response and help in requesting the feature
It would be perfect if gamma could be entered manually. Will the new update take a long time? Do you have an estimate of the time required for the update? Because I do not have much opportunity.

It should be fixed soon (days)

Thanks again remi
best regards

Hi, this is fixed!
The new OTB revision with the fix should be available soon (see this post, I believe that you should be able to download the latest package soon here)
Hope that solves your issue.

Hi,remi
This is really great and exciting news. Thank you very much and the otb team. You helped a lot
thanks again
best regards