Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

C++ / mean of value CvSVM::predict()

I'm actually working on a project of logos classification using SURF + BOW + SVM. This is my first time i'm work on a kind of project and especially with SVM.

So i have two folders : train and eval which contains 4 classes of differents elements.My class are distinctive because i have a class of boat,class of car,class of plane and class of animals. Train has about 255 pictures (so 255/4) Eval has about 340 pictures (so 340/4)

I followed a tutorial which explain how use BoW. I think that's fine for me but i have a problem with the value of my svm.predict().

for (int i=0;i<logos_list_eval.size();i++){
      cv::Mat imgEval=cv::imread(path_to_eval + logos_list_eval.at(i),CV_LOAD_IMAGE_GRAYSCALE);
      ssm_ensure(imgEval.data, "Could not load the first image");
      //Debug::info("Eval : " + logos_list_eval.at(i));
      detector_training.detect(imgEval, keypoint2);
      bowDE.compute(imgEval, keypoint2, bowDescriptor2);

      evalData.push_back(bowDescriptor2);
      groundTruth.push_back((float) i);
      float response = svm.predict(bowDescriptor2);
      std::cout << "Reponse : " << response <<  std::endl;
      results.push_back(response);
      string info= logos_list_eval.at(i) + " |  response : " + convertInt(response) ;
      compute_info << info << std::endl;

  }

The result of my prediction is :

... Reponse : 242 Reponse : 242 Reponse : 178 Reponse : 242 Reponse : 178 Reponse : 175 Reponse : 121 Reponse : 190 Reponse : 191 Reponse : 186 Reponse : 188 Reponse : 207 Reponse : 189 Reponse : 189 Reponse : 179 Reponse : 178 Reponse : 201 Reponse : 173 Reponse : 188 Reponse : 178 Reponse : 179 Reponse : 186 Reponse : 189 Reponse : 189 Reponse : 189 Reponse : 209 Reponse : 178 Reponse : 179 ...

I don't understand theses values. How can i know if it's belong to class 1,2,3 or 4 ?