- MATLAB (Tested in version 2013a)
- LIBLINEAR (version 1.94)
-
Compile LIBLINEAR MATLAB wrapper
- Download LIBLINEAR code
- Follow the FAQ and update linear.cpp file, change
int check_probability_model(const struct model *model_) { return (model_->param.solver_type==L2R_LR ||
into
int check_probability_model(const struct model *model_) { return 1;
This will allow probabilistic output for Linear SVM model.
- Specify MATLABDIR in
matlab/Makefile
, thenmake
to compile.mex
files. They will be used during training and testing.
-
Convert DTFV ASCII files into
.mat
binary files- Prepare the feature list of DTFVs in the following format:
[number of features listed] [groundtruth label] [truncated path to the features] ... [groundtruth label] [truncated path to the features]
If you have DTFV features for
HVC123456.mp4
stored in/temp/HVC123456.mp4.hog.fv.txt
,/temp/HVC123456.mp4.hof.fv.txt
, etc. The truncated path is just/temp/HVC123456.mp4
(i.e. excluding mode type andfv.txt
)- Call
function convert_mat(featList, outputFile)
featList is what you created in the previous step, outputFile is something like '/temp/train.mat'.
-
Training and testing with linear SVM
- Prepare training and testing
.mat
binary files - Call
function svm_pipeline(trainMat, testMat, eventID, saveDir)
trainMat and testMat are the paths to the .mat files. eventID is an integer identifier for event classes. saveDir is the path to store models and result files.
You can do training and testing separately by commenting outtrain_svm(trainMat, eventID, modelPath);
or
[confs, ap] = test_svm(testMat, eventID, modelPath);
in this function.
- Prepare training and testing
-
Understanding the output formats
- After training, a model
model.[eventID].[modeType].mat
is stored in binary format - After testing, a result file
result.[eventID]
is stored in ASCII. The i-th line gives the event confidence value (from 0 to 1) of the i-th item in testing list.
- After training, a model
- Weird behavior under 10EX setting