title: libsvm - training data format for multiclass classification
body: <p>I did <strong>prohibitory</strong> traffic sign detection in OpenCV. Now, I want to do recognize them. For example, I need to distinguish between speed limit 20km/h and speed limit 30km/h when I detect them.</p>
  
  <p>In order to save time, I decided to use pre-calculated features of German Traffic Sign Recognition (GTSRB) benchmark for classification training. <strong><em>In GTSRB there are 12 different prohibitory traffic sign classes, the rest of them are other classes</em></strong>. For each training image, HOG, HAAR, and Hue histogram features are calculated and stored in different folders. I am using pre-calculated HOG features that has vector dimension of 1568 for each training image.</p>
  
  <p>I have two ideas about preparing the training data matrix in LIBSVM format. I am not sure which format I should use for multiclass classification. I already wrote C++ program to convert the features in different files to LIBSVM format.</p>
  
  <p><strong>Question 1</strong>: Which of the following ideas is right way to do recognize prohibitory traffic signs?</p>
  
  <p><strong>Question 2</strong>: I need to visualize the recognized signs in real time. However, the examples in libsvm only shows the accuracy level. Is libsvm the right choice or should I create training data matrix in OpenCV while running my traffic sign detection program? </p>
  
  <p><strong>IDEA 1: Assign +1 label to all prohibitory classes and -1 to other classes</strong></p>
  
  <pre><code> +1 1:0.32 2:0.27 3: 0.01 ... 1568:0.04 //class 1 - speed limit 20
   .                                      //features of training images
   .                                      
   .                                     
   +1 1:0.44 2:0.12 3: 0.23 ... 1568:0.03 //class 2 - speed limit 30
   .                                      //features of training images
   .                       
   .               
   +1 1:0.32 2:0.27 3: 0.01 ... 1568:0.04 //class 12 - speed limit 80
   .                                      //features of training images
   . 
   .
   -1 1:0.32 2:0.27 3: 0.01 ... 1568:0.04 //other classes
   .                                     //features of training images
   . 
   .
  </code></pre>
  
  <p><strong>IDEA 2: Assign 12 different labels to each prohibitory class and -1 for all other classes.</strong></p>
  
  <pre><code> +1 1:0.32 2:0.27 3: 0.01 ... 1568:0.04 //class 1 - speed limit 20
   .                                      //features of training images
   .                                      
   .                                     
   +2 1:0.44 2:0.12 3: 0.23 ... 1568:0.03 //class 2 - speed limit 30
   .                                      //features of training images
   .                       
   .               
   +12 1:0.32 2:0.27 3: 0.01 ... 1568:0.04 //class 12 - speed limit 80
   .                                       //features of training images
   . 
   .
   -1  1:0.65 2:0.72 3: 0.12 ... 1568:0.12 //all other classes 
   .                                       //features of training images
   . 
   .
  </code></pre>
  
  <p>Thanks in advance,</p>