how can i train SVM

asked 2016-07-27 03:00:37 -0500

damiya14 gravatar image

updated 2016-07-28 01:39:16 -0500

I am new to this. I am trying to do machine learning on vehicle color recognition system. Can i know some useful links to learn about SVM training? I have watched some videos and red some stuff about SVM but still i can't understand how to train it.

image description

edit retag flag offensive close merge delete


  • type "SVM" into the search box...
  • what are your "features" here ?
  • "machine learning on vehicle color recognition system" - imho, you have to explain this. does it need machine learning to recognize a colour ? (probably not) . do you have to detect the vehicle first ? ( which probably should be done on shape, not color)
berak gravatar imageberak ( 2016-07-27 03:05:08 -0500 )edit

hahaa i have been searching SVM and i have read some articles too. but still i can't understand how can i train it.

damiya14 gravatar imagedamiya14 ( 2016-07-27 03:08:54 -0500 )edit

again, please clarify your context.

berak gravatar imageberak ( 2016-07-27 03:11:50 -0500 )edit

the data set that i have is image set which contain single car per image. i have tried simple methods like extracting a ROI from the vehicle and getting the histogram and then finding the maximum H value from that histogram. but it just give me 72% of accuracy.

damiya14 gravatar imagedamiya14 ( 2016-07-27 03:14:36 -0500 )edit

That is not really a problem for a SVM. To train a SVM you need features. This means you need to extract some information about the image. In your scenario such a feature would be the color of the car. And since you need to get the color of the car you don't need a SVM anymore. What is your solution to find the car in the image?

Missing gravatar imageMissing ( 2016-07-27 03:21:52 -0500 )edit

In my honest opinion, what you need is a basic course on image processing first. You want to jump into machine learning but an SVM is not something you are familiar with. Go the the OpenCV tutorials and start working through them! At the end you will be perfectly fine at training your own SVM setup!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-07-27 03:22:44 -0500 )edit

" finding the maximum H value from that histogram"

that's already a good idea, still there are "colours", that hsv can't handle properly, like silver,white,black.

maybe you need a "multiple" detection and voting scheme.

(and again, imho an SVM won't help, since all it can give you is "1 best item out of N")

berak gravatar imageberak ( 2016-07-27 03:27:08 -0500 )edit

Thanks for your advise! i have uploaded an image to the question. For this project i am getting images from a traffic database. and i am also getting the x,y coordinates of the top right corner of the license plate. From that reference i define a ROI on the vehicle as shown int the picture (On the bonnet). Then from that area i calculate histogram and then back project it on the image again to get the mask as shown in the picture. Then i calculate the histogram for that area and get the maximum bin from the histogram. Problems that i am having is,

  1. Some vehicle bonnets reflects the sky.
  2. As break said i am having trouble with silver,white and black.
damiya14 gravatar imagedamiya14 ( 2016-07-28 01:45:37 -0500 )edit

hmm, thinking twice, i think, i misunderstood it.

if your actual aim is classifying car colors into fixed "bins" like "silver", "yellow", "brown" , etc., the idea with the svm might not have been all that bad. maybe:

  • each car, sample several points, say the mean of a 16x16 roi
  • do that in more than one colorspace, to compensate outliers like silver
  • concatenate them to a single, 1d feature vector. say, 4 points x (rgb+hsv+lab+yuv+ycrcb) = 4x5x3 = 60 numbers per sample
  • train linear svm with ~500 cars

sure worth a try, imho !

berak gravatar imageberak ( 2016-07-30 04:45:48 -0500 )edit

where can i get an example for svm training? i couldn't find any good example yet. please help!!

damiya14 gravatar imagedamiya14 ( 2016-07-31 22:18:50 -0500 )edit