dramatic speedup of SVM::predict in the case of linear SVM

This commit is contained in:
Vadim Pisarevsky
2013-03-19 18:28:17 +04:00
parent 79e0e948a7
commit a06af5ca25
3 changed files with 60 additions and 0 deletions

View File

@@ -691,7 +691,10 @@ int build_svm_classifier( char* data_filename )
CvMat *result = cvCreateMat(1, nsamples_all - ntrain_samples, CV_32FC1);
printf("Classification (may take a few minutes)...\n");
double t = (double)cvGetTickCount();
svm.predict(&sample, result);
t = (double)cvGetTickCount() - t;
printf("Prediction type: %gms\n", t/(cvGetTickFrequency()*1000.));
int true_resp = 0;
for (int i = 0; i < nsamples_all - ntrain_samples; i++)