2

I have a set of facial features that i have obtained and would like to classify using SVM. I intend to use libsvm package and use MATLAB to carry out the training.I have already read up on SVM by watching the Stanford lecture. But I am not sure how to use libsvm to start.. Need some guidance...

3
  • What is the part that you did not understand in the matlab/readme?
    – Oli
    Dec 19, 2011 at 21:48
  • how come there is both .c files as well as .m files together under the matlab folder?
    – user999450
    Dec 19, 2011 at 21:54
  • Are you using linux or windows?
    – Oli
    Dec 19, 2011 at 21:56

1 Answer 1

2

In matlab you can link your matlab code with some programs implemented in c. This a called a mex-file.

However you need to compile them, to make it work.

You can read the readme file to know how to compile them:

Installation

On Unix systems, we recommend using GNU g++ as your compiler and type 'make' to build 'svmtrain.mexglx' and 'svmpredict.mexglx'. Note that we assume your MATLAB is installed in '/usr/local/matlab', if not, please change MATLABDIR in Makefile.

Example: linux> make

To use Octave, type 'make octave':

Example: linux> make octave

On Windows systems, pre-built binary files are already in the directory `..\windows', so no need to conduct installation. Now we include both 32bit binary files and 64bit binary files, but in future releases, we will provide binary files only for 64bit MATLAB on Windows. If you have modified the sources and would like to re-build the package, type 'mex -setup' in MATLAB to choose a compiler for mex first. Then type 'make' to start the installation.

Example:

    matlab> mex -setup

(ps: MATLAB will show the following messages to setup default compiler.) Please choose your compiler for building external interface (MEX) files: Would you like mex to locate installed compilers [y]/n? y Select a compiler: 1 Microsoft Visual C/C++ version 7.1 in C:\Program Files\Microsoft Visual Studio [0] None Compiler: 1 Please verify your choices: Compiler: Microsoft Visual C/C++ 7.1 Location: C:\Program Files\Microsoft Visual Studio Are these correct?([y]/n): y

    matlab> make

For list of supported/compatible compilers for MATLAB, please check the following page:

http://www.mathworks.com/support/compilers/current_release/

7
  • is that all u need to start SVM?
    – user999450
    Dec 20, 2011 at 13:19
  • after that you can run the sample code provided in the remaining of the README
    – Oli
    Dec 20, 2011 at 13:31
  • Try to install Microsoft Visual Studio Express Edition, it will install lcc. Use that as a compiler for mex.
    – Oli
    Dec 22, 2011 at 16:56
  • Ok, if you don't manaage to compile it. You should try to copy the precompiled version.... it's in libsvm-3.1/windows/ ... copy all of that in the same directory than your .m files. And try again
    – Oli
    Dec 22, 2011 at 17:31
  • copy to the same folder as the m files you mean?
    – user999450
    Dec 22, 2011 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.