1

I want to extract color histograms from the GTSRB dataset to train with them an SVM. Unfortunately, I get an accuracy of only 0.18. I'm using OpenCV version 3.4.2.

def make_color_histo(X):
    histo_list = []
    for i in range(0, len(X)):
        hsv =cv2.cvtColor(X[i], cv2.COLOR_BGR2HSV)
        hist = cv2.calcHist([hsv], [0,1,2], None, (8,8,8), [0,180,0,256,0,256])
        hist = cv2.normalize(hist, hist)
        hist = hist.flatten()
        histo_list.append(hist)
    return histo_list

Am I doing something wrong in determining the color histograms?

Code Now
  • 711
  • 2
  • 9
  • 20
  • Considering that the dataset has 40 classes, 18% is better than expected random (~2%). The histogram lacks a lot of data from the original image, so maybe it's just not enough. You should consider some more complex approaches. CNN should be interesting. – Yevhen Kuzmovych Nov 11 '19 at 13:35
  • When I train the SVM with HOG features, I get about 90% accuracy. Maybe I should combine the HOG features with the color histograms. In https://github.com/shravankumar147/gtsrb-smai/blob/master/docs/Colr%2BHistogram%2Bvs.%2Braw%2Bpixels%2Bas%2Bfeatures_classification_on_GTSRB/Colr%20Histogram%20vs.%20raw%20pixels%20as%20features_classification_on_GTSRB.md however, high accuracy was achieved with the color histograms. – Code Now Nov 11 '19 at 13:54

0 Answers0