|
This page provides a manual for using the PmSVM software and
reproducing the experiments in our CVPR 2012 paper. PmSVM is
designed to solve large scale SVM problem, using the power mean
kernel.
The power mean kernel is the kernel to use when features
are histograms, which are common in computer vision. It can also be
used as an alternative for fast and accurate classification,
in place of linear SVM classifiers.
PmSVM can solve a binary classification problem with millions
of examples and tens of thousands of dense features in a few
seconds (excluding the time to read the input files.)
Important information is shown in this
color. This is a mirror page for those who cannot visit Google Sites. Note that all downloads contained in this page are now in this single archive.
Background and licensingThe Power Mean SVM (PmSVM) software aims at solving large scale
classification problems, especially those problems in computer
vision. Nowadays, a typical large scale computer vision
classification problem may have 1,000+ classes and more than 1
million examples. Efficient training and testing & accurate
classification results are the key to the success of many vision
problems.
Also, histograms are arguably the most popular visual
representation. When the features are histograms, additive kernels
are the most effective in SVM models. An additive kernel is a valid
kernel function of the form:
PmSVM provides
efficient classification with a special family of additive kernels,
namely the power mean kernels, in the form (for any p<0):
Note that this family
include as special cases the most popular additive kernels: when
p = -1, it is the χ2 kernel; and, when
p = -∞, it is the histogram intersection kernel
(HIK).
PmSVM is most effective when features are
histograms; but it can also be used as an alternative for large
scale linear SVM classification.
PmSVM is distributed
under the BSD license.
Technical papersFor
technical details, please refer to:
If you use PmSVM, please cite the above
paper.
InstallPmSVM is written in C++. It can be used in both Linux and
Windows. The first step is to download the PmSVM.zip file
from this page. Install in LinuxMake sure that gcc / g++ are installed. Unzip PmSVM.zip to a
directory. Then, run the following command from a command
prompt:
The output
is an executable named pmsvm.
Install in WindowsIf you prefer MSVC++, you may manually create a VC++ solution
project, and add PmSVM.cpp (inside PmSVM.zip) to this project. If
using MSVC++, you may need to modify the following line at the
beginning of PmSVM.cpp:
An easier alternative is to use a gcc / g++ build in Windows,
following these steps:
• Install TDM-GCC from
http://tdm-gcc.tdragon.net/. Choose ‘tdm-gcc’ for
creating a 32 bit executable; and ‘tdm64-gcc’ for the 64 bit
version.
• Open the ‘MinGW
Command Prompt’ from the Windows Start Menu.
• Run the following
command in the MinGW command prompt:
Data Format and RequirementPmSVM requires that training and testing data are stored in the
libsvm format, described as in the libsvm documentation:
The format of training and testing data
file is:<label>
<index1>:<value1> <index2>:<value2>
......Each line contains an instance and is
ended by a '\n' character.For classification, <label> is an
integer indicating the class label (multi-class is
supported). <index> is an integer starting from
1 and <value> is a real number. Indices must be in ASCENDING
order. Labels in the testing file are only used to calculate
accuracy or errors. If they are unknown, just fill the first column
with any numbers.In order to convert your data to the range [0, 1], you may use
the svm-scale tool in the libsvm software package (http://www.csie.ntu.edu.tw/~cjlin/libsvm/):
Command Prompt UsageWe assume that the training data is stored in the
file trainset.svm and testing data in
testset.svm; the executable has been compiled and put in the
current directory.
The following command train an SVM model from the training
data; and also test it on the testing set:
If you only have 1 dataset stored in trainset.svm,
5-fold cross-validation is performed using:
Two types of accuracy are reported by PmSVM. Suppose the
dataset has m classes, with n1,
n2, ⋯, nm examples,
respectively; n = n1 + n2 +
... + nm is the dataset size; and
ci is the number of examples in class i
that are correctly predicted. PmSVM reports the overall
accuracy as:
Overall accuracy is often used in machine learning
papers; while average accuracy is more popular in computer vision.
Thus, PmSVM reports both.
Changing ParametersPmSVM is designed mainly for source code level reuse. You can
change the parameters of PmSVM by first modifying the source code;
and recompile the software. The following parameters can be
adjusted in PmSVM:
HIK is slightly slower, but also slightly
more accurate than χ2 in PmSVM. Note that
p < 0 is required.
PmSVM is not sensitive to C. The default
value 0.01 works well for most problems. Note that a larger C
requires longer training time.
Then, NUMBER is of the double type. In most cases, it is not necessary to use double (which is 8 bytes while float is 4 byte.)
Note that a negative bias value is
treated as 0.
Using the Source Code DirectlyYou may want to use the functions of PmSVM directly. This
section provides instructions for this purpose.
The trained SVM model (binary or multi-class) is stored in model_. 1-vs-rest is used for multi-class classification.
Compare with the feature mapping approachWe provide our implementation of the feature mapping approach
by Vedaldi and Zisserman. This approach is compared
against PmSVM in the CVPR
2012 paper.
Our implementation first use the VLFeat C source code to generate a table
with 1000 row, each row will map a value between [0, 1] to a 3
dimensional short vector. This look-up table trick runs much faster
than generating the mappings on-the-fly. Note that you need to make
sure all feature values are within the [0, 1] range.
This mapping simulates either HIK or chi-square. Thus, a
d dimensional additive kernel problem is transformed into a
3d dimensional linear classification problem. Our
implementation then revise the LIBLINEAR source code to train and test a linear
SVM.
This implementation is provided in PmSVM only as a
reference. The BSD license applies to this implementation.
Please also refer to LIBLINEAR and VLFeat for their respective
licensing information.
It is only tested in Linux (Ubuntu 11.10, 64 bit) with gcc /
g++.
To build / compile this implementation, first download the source
code archive from this page. After unzip this archive, run
the following commands in the mapping_code directory:
Four files are
generated: hom_train_HIK, hom_predict_HIK
(these two for HIK);
and hom_train_Chi2, hom_predict_Chi2 (these
two for chi-square). Use the train commands to train SVM
models; and predict commands for prediction. Parameters can
be set by options of these commands. The list of supported options
are a subset of the LIBLIENAR software, which is displayed by running
the respective command without specifying any option.
PmSVM is also compared with LIBLINEAR and libHIK. LIBLINEAR can
be downloaded from here. libHIK can be downloaded from this
site.
Generate sample datasetsThis section provides instructions for generating the datasets
used for evaluating PmSVM in the CVPR
2012 paper.
Caltech 101
Also change static const int sizeCV = 5; at the beginning of this file to static const int sizeCV = 1;
Two files will be generated: train1.txt (the training set, 674,856,198 bytes in Ubuntu), and test1.txt (the testing set, 890,787,408 bytes) in the current directory. Indoor 67
ILSVRC 1000This is the largest dataset experimented in the CVPR
2012 paper. You may use the following steps to create the
dataset.
Prerequisites
StepsThe unprocessed data are available at http://www.image-net.org/challenges/LSVRC/2010/download-public; you need to first create a directory with the name ILSVRC/
ContactFor bug reports, inquiries, and / or suggestions, please send
to me through wujx2001 AT gmail.com. |



