Quantcast

training a HOG descriptor

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

training a HOG descriptor

chee yongway
Hi,

I am trying to train a car detector using the HOG descriptor in OpenCV2.2

These are my parameters for the HOG descriptor:
cellsize: 8x8 (wxh) (compute histogram in this cell)
winsize: 128x64 (wxh) (cropped window that contains the car)
binsize: 9 (unsigned angles)

After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)

I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.

I do not know whether I did this correctly. Can anyone please help. Thanks!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

chee yongway
Apparently I set config the descriptor wrongly.
After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.

        //hog descriptors
        HOGDescriptor hog(
                Size(128,64), //winSize
                Size(16,16), //blocksize
                Size(8,8), //blockStride,
                Size(8,8), //cellSize,
                9, //nbins,
                0, //derivAper,
                -1, //winSigma,
                0, //histogramNormType,
                0.2, //L2HysThresh,
                0 //gammal correction,
                                //nlevels=64
                );

       
        Size winStride(8,8);
        Size padding(0,0);


I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?








--- In [hidden email], "cheeyongway" <cheeyongway@...> wrote:

>
> Hi,
>
> I am trying to train a car detector using the HOG descriptor in OpenCV2.2
>
> These are my parameters for the HOG descriptor:
> cellsize: 8x8 (wxh) (compute histogram in this cell)
> winsize: 128x64 (wxh) (cropped window that contains the car)
> binsize: 9 (unsigned angles)
>
> After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
>
> I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
>
> I do not know whether I did this correctly. Can anyone please help. Thanks!
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

ehsan-2

First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.

Good luck!

Ehsan



--- In [hidden email], "cheeyongway" <cheeyongway@...> wrote:

>
> Apparently I set config the descriptor wrongly.
> After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
>
> //hog descriptors
> HOGDescriptor hog(
> Size(128,64), //winSize
> Size(16,16), //blocksize
> Size(8,8), //blockStride,
> Size(8,8), //cellSize,
> 9, //nbins,
> 0, //derivAper,
> -1, //winSigma,
> 0, //histogramNormType,
> 0.2, //L2HysThresh,
> 0 //gammal correction,
> //nlevels=64
> );
>
>
> Size winStride(8,8);
> Size padding(0,0);
>
>
> I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
>
>
>
>
>
>
>
>
> --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> >
> > Hi,
> >
> > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> >
> > These are my parameters for the HOG descriptor:
> > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > winsize: 128x64 (wxh) (cropped window that contains the car)
> > binsize: 9 (unsigned angles)
> >
> > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> >
> > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> >
> > I do not know whether I did this correctly. Can anyone please help. Thanks!
> >
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

chee yongway
Hi Ehsan,

Thanks for your prompt reply.
I have tried CvSVM for a linear SVM, but i cannot get anywhere.

I have looked into svmlight, and there were several options. Which type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?

I presume the output of svmlight is a model of a vector of floating numbers, which I can just basically dump and replace the OpenCV default pedestrian detector?

regards,
yongway



--- In [hidden email], "ehsan" <ehsanrza@...> wrote:

>
>
> First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
> For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
> they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.
>
> Good luck!
>
> Ehsan
>
>
>
> --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> >
> > Apparently I set config the descriptor wrongly.
> > After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
> >
> > //hog descriptors
> > HOGDescriptor hog(
> > Size(128,64), //winSize
> > Size(16,16), //blocksize
> > Size(8,8), //blockStride,
> > Size(8,8), //cellSize,
> > 9, //nbins,
> > 0, //derivAper,
> > -1, //winSigma,
> > 0, //histogramNormType,
> > 0.2, //L2HysThresh,
> > 0 //gammal correction,
> > //nlevels=64
> > );
> >
> >
> > Size winStride(8,8);
> > Size padding(0,0);
> >
> >
> > I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
> >
> >
> >
> >
> >
> >
> >
> >
> > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > >
> > > Hi,
> > >
> > > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> > >
> > > These are my parameters for the HOG descriptor:
> > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > binsize: 9 (unsigned angles)
> > >
> > > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> > >
> > > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> > >
> > > I do not know whether I did this correctly. Can anyone please help. Thanks!
> > >
> >
>


J H
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

J H
Hi yongway,
CvSVM is unsuited for that purpose, I use svmlight and libsvm for training my hog features.
With svmlight, use "Regression" as learning method, also you have to use a linear svm kernel and set the "C" value to 0.01 as proposed in the paper.

Svmlight will return a number of support vectors (in the model file).
Out of these you still first have to calculate a single detecting feature vector (of correct
size) and append the "b" (bias) value returned by the SVM:

The detecting feature vector at component i (where i is in the range e.g. 0-3779) is built out of the sum of the support
vectors at i * the alpha value of that support vector, e.g.
det[i] =
sum_j (sv_j[i] * alpha[j]) , where j is the number of the support vector, i
 is the number of the components of the support vector.
By the way, the default HOG window size is 64x128, not 128x64.

I hope that helps,
best regards,

Jan Hendriks



________________________________
Von: cheeyongway <[hidden email]>
An: [hidden email]
Gesendet: 6:35 Sonntag, 15.Mai 2011
Betreff: [OpenCV] Re: training a HOG descriptor


 
Hi Ehsan,

Thanks for your prompt reply.
I have tried CvSVM for a linear SVM, but i cannot get anywhere.

I have looked into svmlight, and there were several options. Which type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?

I presume the output of svmlight is a model of a vector of floating numbers, which I can just basically dump and replace the OpenCV default pedestrian detector?

regards,
yongway

--- In [hidden email], "ehsan" <ehsanrza@...> wrote:

>
>
> First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
> For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
> they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.
>
> Good luck!
>
> Ehsan
>
>
>
> --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> >
> > Apparently I set config the descriptor wrongly.
> > After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
> >
> > //hog descriptors
> > HOGDescriptor hog(
> > Size(128,64), //winSize
> > Size(16,16), //blocksize
> > Size(8,8), //blockStride,
> > Size(8,8), //cellSize,
> > 9, //nbins,
> > 0, //derivAper,
> > -1, //winSigma,
> > 0, //histogramNormType,
> > 0.2, //L2HysThresh,
> > 0 //gammal correction,
> > //nlevels=64
> > );
> >
> >
> > Size winStride(8,8);
> > Size padding(0,0);
> >
> >
> > I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
> >
> >
> >
> >
> >
> >
> >
> >
> > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > >
> > > Hi,
> > >
> > > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> > >
> > > These are my parameters for the HOG descriptor:
> > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > binsize: 9 (unsigned angles)
> > >
> > > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> > >
> > > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> > >
> > > I do not know whether I did this correctly. Can anyone please help. Thanks!
> > >
> >
>


 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

Marcin-3
Does anyone know how to obtain HOG features from an image?

--- In [hidden email], J H <dahoc3150@...> wrote:

>
> Hi yongway,
> CvSVM is unsuited for that purpose, I use svmlight and libsvm for training my hog features.
> With svmlight, use "Regression" as learning method, also you have to use a linear svm kernel and set the "C" value to 0.01 as proposed in the paper.
>
> Svmlight will return a number of support vectors (in the model file).
> Out of these you still first have to calculate a single detecting feature vector (of correct
> size) and append the "b" (bias) value returned by the SVM:
>
> The detecting feature vector at component i (where i is in the range e.g. 0-3779) is built out of the sum of the support
> vectors at i * the alpha value of that support vector, e.g.
> det[i] =
> sum_j (sv_j[i] * alpha[j]) , where j is the number of the support vector, i
>  is the number of the components of the support vector.
> By the way, the default HOG window size is 64x128, not 128x64.
>
> I hope that helps,
> best regards,
>
> Jan Hendriks
>
>
>
> ________________________________
> Von: cheeyongway <cheeyongway@...>
> An: [hidden email]
> Gesendet: 6:35 Sonntag, 15.Mai 2011
> Betreff: [OpenCV] Re: training a HOG descriptor
>
>
>  
> Hi Ehsan,
>
> Thanks for your prompt reply.
> I have tried CvSVM for a linear SVM, but i cannot get anywhere.
>
> I have looked into svmlight, and there were several options. Which type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?
>
> I presume the output of svmlight is a model of a vector of floating numbers, which I can just basically dump and replace the OpenCV default pedestrian detector?
>
> regards,
> yongway
>
> --- In [hidden email], "ehsan" <ehsanrza@> wrote:
> >
> >
> > First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
> > For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
> > they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.
> >
> > Good luck!
> >
> > Ehsan
> >
> >
> >
> > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > >
> > > Apparently I set config the descriptor wrongly.
> > > After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
> > >
> > > //hog descriptors
> > > HOGDescriptor hog(
> > > Size(128,64), //winSize
> > > Size(16,16), //blocksize
> > > Size(8,8), //blockStride,
> > > Size(8,8), //cellSize,
> > > 9, //nbins,
> > > 0, //derivAper,
> > > -1, //winSigma,
> > > 0, //histogramNormType,
> > > 0.2, //L2HysThresh,
> > > 0 //gammal correction,
> > > //nlevels=64
> > > );
> > >
> > >
> > > Size winStride(8,8);
> > > Size padding(0,0);
> > >
> > >
> > > I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> > > >
> > > > These are my parameters for the HOG descriptor:
> > > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > > binsize: 9 (unsigned angles)
> > > >
> > > > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> > > >
> > > > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> > > >
> > > > I do not know whether I did this correctly. Can anyone please help. Thanks!
> > > >
> > >
> >
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

Marcin-3
In reply to this post by J H
Hi all HOG training veterans.

I've been training my own HOG detector for the last couple of days and am
confused with the strange padding parameter. Why does increasing padding size
also increases the number of HOG features generated? What's the exact function
of this parameter?

--- In [hidden email], J H <dahoc3150@...> wrote:

>
> Hi yongway,
> CvSVM is unsuited for that purpose, I use svmlight and libsvm for training my hog features.
> With svmlight, use "Regression" as learning method, also you have to use a linear svm kernel and set the "C" value to 0.01 as proposed in the paper.
>
> Svmlight will return a number of support vectors (in the model file).
> Out of these you still first have to calculate a single detecting feature vector (of correct
> size) and append the "b" (bias) value returned by the SVM:
>
> The detecting feature vector at component i (where i is in the range e.g. 0-3779) is built out of the sum of the support
> vectors at i * the alpha value of that support vector, e.g.
> det[i] =
> sum_j (sv_j[i] * alpha[j]) , where j is the number of the support vector, i
>  is the number of the components of the support vector.
> By the way, the default HOG window size is 64x128, not 128x64.
>
> I hope that helps,
> best regards,
>
> Jan Hendriks
>
>
>
> ________________________________
> Von: cheeyongway <cheeyongway@...>
> An: [hidden email]
> Gesendet: 6:35 Sonntag, 15.Mai 2011
> Betreff: [OpenCV] Re: training a HOG descriptor
>
>
>  
> Hi Ehsan,
>
> Thanks for your prompt reply.
> I have tried CvSVM for a linear SVM, but i cannot get anywhere.
>
> I have looked into svmlight, and there were several options. Which type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?
>
> I presume the output of svmlight is a model of a vector of floating numbers, which I can just basically dump and replace the OpenCV default pedestrian detector?
>
> regards,
> yongway
>
> --- In [hidden email], "ehsan" <ehsanrza@> wrote:
> >
> >
> > First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
> > For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
> > they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.
> >
> > Good luck!
> >
> > Ehsan
> >
> >
> >
> > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > >
> > > Apparently I set config the descriptor wrongly.
> > > After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
> > >
> > > //hog descriptors
> > > HOGDescriptor hog(
> > > Size(128,64), //winSize
> > > Size(16,16), //blocksize
> > > Size(8,8), //blockStride,
> > > Size(8,8), //cellSize,
> > > 9, //nbins,
> > > 0, //derivAper,
> > > -1, //winSigma,
> > > 0, //histogramNormType,
> > > 0.2, //L2HysThresh,
> > > 0 //gammal correction,
> > > //nlevels=64
> > > );
> > >
> > >
> > > Size winStride(8,8);
> > > Size padding(0,0);
> > >
> > >
> > > I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> > > >
> > > > These are my parameters for the HOG descriptor:
> > > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > > binsize: 9 (unsigned angles)
> > > >
> > > > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> > > >
> > > > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> > > >
> > > > I do not know whether I did this correctly. Can anyone please help. Thanks!
> > > >
> > >
> >
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

Seongwook Park
This post has NOT been accepted by the mailing list yet.
In reply to this post by chee yongway
Hi, I have a question.

I know for human detection the size of hog descriptor is 3780(7X15X36).

How could you extract the descriptor of 1152(8X16X9)?

Greetings,

Seongwook.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

Cosmin
In reply to this post by J H
Hey,

For example after I obtained the SV vectors with the libsvm for example something like this:

0.001 1:0.01 2:0.02 3:0.03
0.002 1:0.04 2:0.05 3:0.06
0.003 1:0.07 2:0.08 4:0.09

This was just an example

after this I have to obtain a single vector by doing this, correct?

c[0]=0.01*0.001+ 0.04*0.002+ 0.07*0.003
c[1]=0.02*0.001+ 0.05*0.002+ 0.08*0.003
c[2]=0.03*0.001+ 0.06*0.002+ 0.09*0.003

after that on the position c[4] i put the b ,correct?

Pls reply,
Thx in advance



--- In [hidden email], J H <dahoc3150@...> wrote:

>
> Hi yongway,
> CvSVM is unsuited for that purpose, I use svmlight and libsvm for training my hog features.
> With svmlight, use "Regression" as learning method, also you have to use a linear svm kernel and set the "C" value to 0.01 as proposed in the paper.
>
> Svmlight will return a number of support vectors (in the model file).
> Out of these you still first have to calculate a single detecting feature vector (of correct
> size) and append the "b" (bias) value returned by the SVM:
>
> The detecting feature vector at component i (where i is in the range e.g. 0-3779) is built out of the sum of the support
> vectors at i * the alpha value of that support vector, e.g.
> det[i] =
> sum_j (sv_j[i] * alpha[j]) , where j is the number of the support vector, i
>  is the number of the components of the support vector.
> By the way, the default HOG window size is 64x128, not 128x64.
>
> I hope that helps,
> best regards,
>
> Jan Hendriks
>
>
>
> ________________________________
> Von: cheeyongway <cheeyongway@...>
> An: [hidden email]
> Gesendet: 6:35 Sonntag, 15.Mai 2011
> Betreff: [OpenCV] Re: training a HOG descriptor
>
>
>  
> Hi Ehsan,
>
> Thanks for your prompt reply.
> I have tried CvSVM for a linear SVM, but i cannot get anywhere.
>
> I have looked into svmlight, and there were several options. Which type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?
>
> I presume the output of svmlight is a model of a vector of floating numbers, which I can just basically dump and replace the OpenCV default pedestrian detector?
>
> regards,
> yongway
>
> --- In [hidden email], "ehsan" <ehsanrza@> wrote:
> >
> >
> > First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
> > For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
> > they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.
> >
> > Good luck!
> >
> > Ehsan
> >
> >
> >
> > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > >
> > > Apparently I set config the descriptor wrongly.
> > > After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
> > >
> > > //hog descriptors
> > > HOGDescriptor hog(
> > > Size(128,64), //winSize
> > > Size(16,16), //blocksize
> > > Size(8,8), //blockStride,
> > > Size(8,8), //cellSize,
> > > 9, //nbins,
> > > 0, //derivAper,
> > > -1, //winSigma,
> > > 0, //histogramNormType,
> > > 0.2, //L2HysThresh,
> > > 0 //gammal correction,
> > > //nlevels=64
> > > );
> > >
> > >
> > > Size winStride(8,8);
> > > Size padding(0,0);
> > >
> > >
> > > I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> > > >
> > > > These are my parameters for the HOG descriptor:
> > > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > > binsize: 9 (unsigned angles)
> > > >
> > > > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> > > >
> > > > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> > > >
> > > > I do not know whether I did this correctly. Can anyone please help. Thanks!
> > > >
> > >
> >
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

Cosmin

Hey,

I have a bit of a strange question, maybe someone can answer it.
I have a set of positives and negatives. I train the SVM. I test it and it gives a lot of false positives. So I get some of the false positives and I use them to retrain the SVM again using the positives and negatives+(false positives) and after I test it again I get MORE false positives.
So what am I supposed to do?

Thanks in advance,


--- In [hidden email], "Cosmin" <cosmin.comarniceanu@...> wrote:

>
> Hey,
>
> For example after I obtained the SV vectors with the libsvm for example something like this:
>
> 0.001 1:0.01 2:0.02 3:0.03
> 0.002 1:0.04 2:0.05 3:0.06
> 0.003 1:0.07 2:0.08 4:0.09
>
> This was just an example
>
> after this I have to obtain a single vector by doing this, correct?
>
> c[0]=0.01*0.001+ 0.04*0.002+ 0.07*0.003
> c[1]=0.02*0.001+ 0.05*0.002+ 0.08*0.003
> c[2]=0.03*0.001+ 0.06*0.002+ 0.09*0.003
>
> after that on the position c[4] i put the b ,correct?
>
> Pls reply,
> Thx in advance
>
>
>
> --- In [hidden email], J H <dahoc3150@> wrote:
> >
> > Hi yongway,
> > CvSVM is unsuited for that purpose, I use svmlight and libsvm for training my hog features.
> > With svmlight, use "Regression" as learning method, also you have to use a linear svm kernel and set the "C" value to 0.01 as proposed in the paper.
> >
> > Svmlight will return a number of support vectors (in the model file).
> > Out of these you still first have to calculate a single detecting feature vector (of correct
> > size) and append the "b" (bias) value returned by the SVM:
> >
> > The detecting feature vector at component i (where i is in the range e.g. 0-3779) is built out of the sum of the support
> > vectors at i * the alpha value of that support vector, e.g.
> > det[i] =
> > sum_j (sv_j[i] * alpha[j]) , where j is the number of the support vector, i
> >  is the number of the components of the support vector.
> > By the way, the default HOG window size is 64x128, not 128x64.
> >
> > I hope that helps,
> > best regards,
> >
> > Jan Hendriks
> >
> >
> >
> > ________________________________
> > Von: cheeyongway <cheeyongway@>
> > An: [hidden email]
> > Gesendet: 6:35 Sonntag, 15.Mai 2011
> > Betreff: [OpenCV] Re: training a HOG descriptor
> >
> >
> >  
> > Hi Ehsan,
> >
> > Thanks for your prompt reply.
> > I have tried CvSVM for a linear SVM, but i cannot get anywhere.
> >
> > I have looked into svmlight, and there were several options. Which type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?
> >
> > I presume the output of svmlight is a model of a vector of floating numbers, which I can just basically dump and replace the OpenCV default pedestrian detector?
> >
> > regards,
> > yongway
> >
> > --- In [hidden email], "ehsan" <ehsanrza@> wrote:
> > >
> > >
> > > First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
> > > For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
> > > they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.
> > >
> > > Good luck!
> > >
> > > Ehsan
> > >
> > >
> > >
> > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > >
> > > > Apparently I set config the descriptor wrongly.
> > > > After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
> > > >
> > > > //hog descriptors
> > > > HOGDescriptor hog(
> > > > Size(128,64), //winSize
> > > > Size(16,16), //blocksize
> > > > Size(8,8), //blockStride,
> > > > Size(8,8), //cellSize,
> > > > 9, //nbins,
> > > > 0, //derivAper,
> > > > -1, //winSigma,
> > > > 0, //histogramNormType,
> > > > 0.2, //L2HysThresh,
> > > > 0 //gammal correction,
> > > > //nlevels=64
> > > > );
> > > >
> > > >
> > > > Size winStride(8,8);
> > > > Size padding(0,0);
> > > >
> > > >
> > > > I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> > > > >
> > > > > These are my parameters for the HOG descriptor:
> > > > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > > > binsize: 9 (unsigned angles)
> > > > >
> > > > > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> > > > >
> > > > > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> > > > >
> > > > > I do not know whether I did this correctly. Can anyone please help. Thanks!
> > > > >
> > > >
> > >
> >
>


J H
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

J H
Hi,
first make sure you do not input the same image as positive and negative training sample, which certainly gives bad results (and happened to me once, btw.)
Then you can - just to test the SVM part - change the SVM parameters (e.g. the "c" parameter and/or the type of kernel used).
It may also be that your training aims at the wrong features if your training set is not diverse enough (e.g. if you only provide persons with blue jeans for training, it may be that the SVM learns to detect blue jeans).

Best regards,

Jan Hendriks


________________________________
Von: Cosmin <[hidden email]>
An: [hidden email]
Gesendet: 10:14 Mittwoch, 28.September 2011
Betreff: [OpenCV] Re: training a HOG descriptor


 

Hey,

I have a bit of a strange question, maybe someone can answer it.
I have a set of positives and negatives. I train the SVM. I test it and it gives a lot of false positives. So I get some of the false positives and I use them to retrain the SVM again using the positives and negatives+(false positives) and after I test it again I get MORE false positives.
So what am I supposed to do?

Thanks in advance,

--- In [hidden email], "Cosmin" <cosmin.comarniceanu@...> wrote:

>
> Hey,
>
> For example after I obtained the SV vectors with the libsvm for example something like this:
>
> 0.001 1:0.01 2:0.02 3:0.03
> 0.002 1:0.04 2:0.05 3:0.06
> 0.003 1:0.07 2:0.08 4:0.09
>
> This was just an example
>
> after this I have to obtain a single vector by doing this, correct?
>
> c[0]=0.01*0.001+ 0.04*0.002+ 0.07*0.003
> c[1]=0.02*0.001+ 0.05*0.002+ 0.08*0.003
> c[2]=0.03*0.001+ 0.06*0.002+ 0.09*0.003
>
> after that on the position c[4] i put the b ,correct?
>
> Pls reply,
> Thx in advance
>
>
>
> --- In [hidden email], J H <dahoc3150@> wrote:
> >
> > Hi yongway,
> > CvSVM is unsuited for that purpose, I use svmlight and libsvm for training my hog features.
> > With svmlight, use "Regression" as learning method, also you have to use a linear svm kernel and set the "C" value to 0.01 as proposed in the paper.
> >
> > Svmlight will return a number of support vectors (in the model file).
> > Out of these you still first have to calculate a single detecting feature vector (of correct
> > size) and append the "b" (bias) value returned by the SVM:
> >
> > The detecting feature vector at component i (where i is in the range e.g. 0-3779) is built out of the sum of the support
> > vectors at i * the alpha value of that support vector, e.g.
> > det[i] =
> > sum_j (sv_j[i] * alpha[j]) , where j is the number of the support vector, i
> >  is the number of the components of the support vector.
> > By the way, the default HOG window size is 64x128, not 128x64.
> >
> > I hope that helps,
> > best regards,
> >
> > Jan Hendriks
> >
> >
> >
> > ________________________________
> > Von: cheeyongway <cheeyongway@>
> > An: [hidden email]
> > Gesendet: 6:35 Sonntag, 15.Mai 2011
> > Betreff: [OpenCV] Re: training a HOG descriptor
> >
> >
> >  
> > Hi Ehsan,
> >
> > Thanks for your prompt reply.
> > I have tried CvSVM for a linear SVM, but i cannot get anywhere.
> >
> > I have looked into svmlight, and there were several options. Which type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?
> >
> > I presume the output of svmlight is a model of a vector of floating numbers, which I can just basically dump and replace the OpenCV default pedestrian detector?
> >
> > regards,
> > yongway
> >
> > --- In [hidden email], "ehsan" <ehsanrza@> wrote:
> > >
> > >
> > > First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
> > > For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
> > > they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.
> > >
> > > Good luck!
> > >
> > > Ehsan
> > >
> > >
> > >
> > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > >
> > > > Apparently I set config the descriptor wrongly.
> > > > After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
> > > >
> > > > //hog descriptors
> > > > HOGDescriptor hog(
> > > > Size(128,64), //winSize
> > > > Size(16,16), //blocksize
> > > > Size(8,8), //blockStride,
> > > > Size(8,8), //cellSize,
> > > > 9, //nbins,
> > > > 0, //derivAper,
> > > > -1, //winSigma,
> > > > 0, //histogramNormType,
> > > > 0.2, //L2HysThresh,
> > > > 0 //gammal correction,
> > > > //nlevels=64
> > > > );
> > > >
> > > >
> > > > Size winStride(8,8);
> > > > Size padding(0,0);
> > > >
> > > >
> > > > I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> > > > >
> > > > > These are my parameters for the HOG descriptor:
> > > > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > > > binsize: 9 (unsigned angles)
> > > > >
> > > > > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> > > > >
> > > > > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> > > > >
> > > > > I do not know whether I did this correctly. Can anyone please help. Thanks!
> > > > >
> > > >
> > >
> >
>


 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

Cosmin

Hi,

So now it detects the cars ok, at a distance it detects them perfectly, I mean it bounds them in a rectangle perfectly, but when they get close the rectangle is too small, it only bounds the inner part of the car or the upper part of the car.
what could be the cause?
Thanks

--- In [hidden email], J H <dahoc3150@...> wrote:

>
> Hi,
> first make sure you do not input the same image as positive and negative training sample, which certainly gives bad results (and happened to me once, btw.)
> Then you can - just to test the SVM part - change the SVM parameters (e.g. the "c" parameter and/or the type of kernel used).
> It may also be that your training aims at the wrong features if your training set is not diverse enough (e.g. if you only provide persons with blue jeans for training, it may be that the SVM learns to detect blue jeans).
>
> Best regards,
>
> Jan Hendriks
>
>
> ________________________________
> Von: Cosmin <cosmin.comarniceanu@...>
> An: [hidden email]
> Gesendet: 10:14 Mittwoch, 28.September 2011
> Betreff: [OpenCV] Re: training a HOG descriptor
>
>
>  
>
> Hey,
>
> I have a bit of a strange question, maybe someone can answer it.
> I have a set of positives and negatives. I train the SVM. I test it and it gives a lot of false positives. So I get some of the false positives and I use them to retrain the SVM again using the positives and negatives+(false positives) and after I test it again I get MORE false positives.
> So what am I supposed to do?
>
> Thanks in advance,
>
> --- In [hidden email], "Cosmin" <cosmin.comarniceanu@> wrote:
> >
> > Hey,
> >
> > For example after I obtained the SV vectors with the libsvm for example something like this:
> >
> > 0.001 1:0.01 2:0.02 3:0.03
> > 0.002 1:0.04 2:0.05 3:0.06
> > 0.003 1:0.07 2:0.08 4:0.09
> >
> > This was just an example
> >
> > after this I have to obtain a single vector by doing this, correct?
> >
> > c[0]=0.01*0.001+ 0.04*0.002+ 0.07*0.003
> > c[1]=0.02*0.001+ 0.05*0.002+ 0.08*0.003
> > c[2]=0.03*0.001+ 0.06*0.002+ 0.09*0.003
> >
> > after that on the position c[4] i put the b ,correct?
> >
> > Pls reply,
> > Thx in advance
> >
> >
> >
> > --- In [hidden email], J H <dahoc3150@> wrote:
> > >
> > > Hi yongway,
> > > CvSVM is unsuited for that purpose, I use svmlight and libsvm for training my hog features.
> > > With svmlight, use "Regression" as learning method, also you have to use a linear svm kernel and set the "C" value to 0.01 as proposed in the paper.
> > >
> > > Svmlight will return a number of support vectors (in the model file).
> > > Out of these you still first have to calculate a single detecting feature vector (of correct
> > > size) and append the "b" (bias) value returned by the SVM:
> > >
> > > The detecting feature vector at component i (where i is in the range e.g. 0-3779) is built out of the sum of the support
> > > vectors at i * the alpha value of that support vector, e.g.
> > > det[i] =
> > > sum_j (sv_j[i] * alpha[j]) , where j is the number of the support vector, i
> > >  is the number of the components of the support vector.
> > > By the way, the default HOG window size is 64x128, not 128x64.
> > >
> > > I hope that helps,
> > > best regards,
> > >
> > > Jan Hendriks
> > >
> > >
> > >
> > > ________________________________
> > > Von: cheeyongway <cheeyongway@>
> > > An: [hidden email]
> > > Gesendet: 6:35 Sonntag, 15.Mai 2011
> > > Betreff: [OpenCV] Re: training a HOG descriptor
> > >
> > >
> > >  
> > > Hi Ehsan,
> > >
> > > Thanks for your prompt reply.
> > > I have tried CvSVM for a linear SVM, but i cannot get anywhere.
> > >
> > > I have looked into svmlight, and there were several options. Which type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?
> > >
> > > I presume the output of svmlight is a model of a vector of floating numbers, which I can just basically dump and replace the OpenCV default pedestrian detector?
> > >
> > > regards,
> > > yongway
> > >
> > > --- In [hidden email], "ehsan" <ehsanrza@> wrote:
> > > >
> > > >
> > > > First of all, OpenCv does not have any built in function for training HOG SVMlight vector, so you should calculate the descriptors of positive and negative samples, and then use SVMlight software http://svmlight.joachims.org/ to train the detector.
> > > > For visualization, you can look into publicly available matlab codes provided by a research group in U of Chicago http://people.cs.uchicago.edu/~pff/latent/
> > > > they have a function in their codes (voc-release4.tgz) that can visualize HOG descriptors for you.
> > > >
> > > > Good luck!
> > > >
> > > > Ehsan
> > > >
> > > >
> > > >
> > > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > > >
> > > > > Apparently I set config the descriptor wrongly.
> > > > > After I changed to this setting, the descriptor size is 3780 for a 128x64 window size.
> > > > >
> > > > > //hog descriptors
> > > > > HOGDescriptor hog(
> > > > > Size(128,64), //winSize
> > > > > Size(16,16), //blocksize
> > > > > Size(8,8), //blockStride,
> > > > > Size(8,8), //cellSize,
> > > > > 9, //nbins,
> > > > > 0, //derivAper,
> > > > > -1, //winSigma,
> > > > > 0, //histogramNormType,
> > > > > 0.2, //L2HysThresh,
> > > > > 0 //gammal correction,
> > > > > //nlevels=64
> > > > > );
> > > > >
> > > > >
> > > > > Size winStride(8,8);
> > > > > Size padding(0,0);
> > > > >
> > > > >
> > > > > I am thinking of drawing the gradients of a HOG descriptor for visualisation. Does anybody knows how to do that? Or is there a function already available?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I am trying to train a car detector using the HOG descriptor in OpenCV2.2
> > > > > >
> > > > > > These are my parameters for the HOG descriptor:
> > > > > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > > > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > > > > binsize: 9 (unsigned angles)
> > > > > >
> > > > > > After I extracted the hog, i store it in a training matrix. Each row contains a hog descriptor of 1 image. So for 400 images, there are 400 rows of (16x8x9=1152)
> > > > > >
> > > > > > I have set aside 400 positive images and 400 negative images. When I tried to create the training matrix, opencv complained of out of memory.
> > > > > >
> > > > > > I do not know whether I did this correctly. Can anyone please help. Thanks!
> > > > > >
> > > > >
> > > >
> > >
> >
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

swetha1910
Hi Cosmin,

I am a beginner to OpenCV. I am currently working on car detection and
tracking. And I need to train the system for the same purpose. i have been
looking out at various links and sites for the data set. Can you share your
the training set,classifier?? Please it would be of great help.
Thanks

On Thu, Oct 13, 2011 at 1:07 PM, Cosmin <[hidden email]>wrote:

> **
>
>
>
> Hi,
>
> So now it detects the cars ok, at a distance it detects them perfectly, I
> mean it bounds them in a rectangle perfectly, but when they get close the
> rectangle is too small, it only bounds the inner part of the car or the
> upper part of the car.
> what could be the cause?
> Thanks
>
>
> --- In [hidden email], J H <dahoc3150@...> wrote:
> >
> > Hi,
> > first make sure you do not input the same image as positive and negative
> training sample, which certainly gives bad results (and happened to me once,
> btw.)
> > Then you can - just to test the SVM part - change the SVM parameters
> (e.g. the "c" parameter and/or the type of kernel used).
> > It may also be that your training aims at the wrong features if your
> training set is not diverse enough (e.g. if you only provide persons with
> blue jeans for training, it may be that the SVM learns to detect blue
> jeans).
> >
> > Best regards,
> >
> > Jan Hendriks
> >
> >
> > ________________________________
> > Von: Cosmin <cosmin.comarniceanu@...>
>
> > An: [hidden email]
> > Gesendet: 10:14 Mittwoch, 28.September 2011
> > Betreff: [OpenCV] Re: training a HOG descriptor
> >
> >
> > Â
> >
> > Hey,
> >
> > I have a bit of a strange question, maybe someone can answer it.
> > I have a set of positives and negatives. I train the SVM. I test it and
> it gives a lot of false positives. So I get some of the false positives and
> I use them to retrain the SVM again using the positives and negatives+(false
> positives) and after I test it again I get MORE false positives.
> > So what am I supposed to do?
> >
> > Thanks in advance,
> >
> > --- In [hidden email], "Cosmin" <cosmin.comarniceanu@> wrote:
> > >
> > > Hey,
> > >
> > > For example after I obtained the SV vectors with the libsvm for example
> something like this:
> > >
> > > 0.001 1:0.01 2:0.02 3:0.03
> > > 0.002 1:0.04 2:0.05 3:0.06
> > > 0.003 1:0.07 2:0.08 4:0.09
> > >
> > > This was just an example
> > >
> > > after this I have to obtain a single vector by doing this, correct?
> > >
> > > c[0]=0.01*0.001+ 0.04*0.002+ 0.07*0.003
> > > c[1]=0.02*0.001+ 0.05*0.002+ 0.08*0.003
> > > c[2]=0.03*0.001+ 0.06*0.002+ 0.09*0.003
> > >
> > > after that on the position c[4] i put the b ,correct?
> > >
> > > Pls reply,
> > > Thx in advance
> > >
> > >
> > >
> > > --- In [hidden email], J H <dahoc3150@> wrote:
> > > >
> > > > Hi yongway,
> > > > CvSVM is unsuited for that purpose, I use svmlight and libsvm for
> training my hog features.
> > > > With svmlight, use "Regression" as learning method, also you have to
> use a linear svm kernel and set the "C" value to 0.01 as proposed in the
> paper.
> > > >
> > > > Svmlight will return a number of support vectors (in the model file).
> > > > Out of these you still first have to calculate a single detecting
> feature vector (of correct
> > > > size) and append the "b" (bias) value returned by the SVM:
> > > >
> > > > The detecting feature vector at component i (where i is in the range
> e.g. 0-3779) is built out of the sum of the support
> > > > vectors at i * the alpha value of that support vector, e.g.
> > > > det[i] =
> > > > sum_j (sv_j[i] * alpha[j]) , where j is the number of the support
> vector, i
> > > > is the number of the components of the support vector.
> > > > By the way, the default HOG window size is 64x128, not 128x64.
> > > >
> > > > I hope that helps,
> > > > best regards,
> > > >
> > > > Jan Hendriks
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > Von: cheeyongway <cheeyongway@>
> > > > An: [hidden email]
> > > > Gesendet: 6:35 Sonntag, 15.Mai 2011
> > > > Betreff: [OpenCV] Re: training a HOG descriptor
> > > >
> > > >
> > > > ÂÂ
> > > > Hi Ehsan,
> > > >
> > > > Thanks for your prompt reply.
> > > > I have tried CvSVM for a linear SVM, but i cannot get anywhere.
> > > >
> > > > I have looked into svmlight, and there were several options. Which
> type of svm should I use, Inductive SVM, Transductive SVM or Ranking SVM?
> > > >
> > > > I presume the output of svmlight is a model of a vector of floating
> numbers, which I can just basically dump and replace the OpenCV default
> pedestrian detector?
> > > >
> > > > regards,
> > > > yongway
> > > >
> > > > --- In [hidden email], "ehsan" <ehsanrza@> wrote:
> > > > >
> > > > >
> > > > > First of all, OpenCv does not have any built in function for
> training HOG SVMlight vector, so you should calculate the descriptors of
> positive and negative samples, and then use SVMlight software
> http://svmlight.joachims.org/ to train the detector.
> > > > > For visualization, you can look into publicly available matlab
> codes provided by a research group in U of Chicago
> http://people.cs.uchicago.edu/~pff/latent/
> > > > > they have a function in their codes (voc-release4.tgz) that can
> visualize HOG descriptors for you.
> > > > >
> > > > > Good luck!
> > > > >
> > > > > Ehsan
> > > > >
> > > > >
> > > > >
> > > > > --- In [hidden email], "cheeyongway" <cheeyongway@> wrote:
> > > > > >
> > > > > > Apparently I set config the descriptor wrongly.
> > > > > > After I changed to this setting, the descriptor size is 3780 for
> a 128x64 window size.
> > > > > >
> > > > > > //hog descriptors
> > > > > > HOGDescriptor hog(
> > > > > > Size(128,64), //winSize
> > > > > > Size(16,16), //blocksize
> > > > > > Size(8,8), //blockStride,
> > > > > > Size(8,8), //cellSize,
> > > > > > 9, //nbins,
> > > > > > 0, //derivAper,
> > > > > > -1, //winSigma,
> > > > > > 0, //histogramNormType,
> > > > > > 0.2, //L2HysThresh,
> > > > > > 0 //gammal correction,
> > > > > > //nlevels=64
> > > > > > );
> > > > > >
> > > > > >
> > > > > > Size winStride(8,8);
> > > > > > Size padding(0,0);
> > > > > >
> > > > > >
> > > > > > I am thinking of drawing the gradients of a HOG descriptor for
> visualisation. Does anybody knows how to do that? Or is there a function
> already available?
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --- In [hidden email], "cheeyongway" <cheeyongway@>
> wrote:
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > I am trying to train a car detector using the HOG descriptor in
> OpenCV2.2
> > > > > > >
> > > > > > > These are my parameters for the HOG descriptor:
> > > > > > > cellsize: 8x8 (wxh) (compute histogram in this cell)
> > > > > > > winsize: 128x64 (wxh) (cropped window that contains the car)
> > > > > > > binsize: 9 (unsigned angles)
> > > > > > >
> > > > > > > After I extracted the hog, i store it in a training matrix.
> Each row contains a hog descriptor of 1 image. So for 400 images, there are
> 400 rows of (16x8x9=1152)
> > > > > > >
> > > > > > > I have set aside 400 positive images and 400 negative images.
> When I tried to create the training matrix, opencv complained of out of
> memory.
> > > > > > >
> > > > > > > I do not know whether I did this correctly. Can anyone please
> help. Thanks!
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
>  
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

darksid3r
Hello everybody,
I am trying to create a custom detector using OpenCV (like everybody else here) . I extract HOG features from the training data and then use CvSVM train to train the classifier. My aim is to use the learned model with detectMultiScale. Here I have 2 questions:
1. Using train method to learn a regression model, the program crashes. However, it works well when i use it to learn a classification model. The function call is: SVMmodel.train(descriptors, mask, Mat(), Mat(), SVMParms); where descriptors are the extracted HOGs, mask is a vector with 1’s for the positive examples and -1’s for negative examples. In SVMParms, I use:  SVMParms.svm_type = CvSVM::EPS_SVR; SVMParms.kernel_type = CvSVM::LINEAR; SVMParms.C = 0.01. Any Ideea why this is happening?
2. I’m currently trying to compute the single SV vector used by detectMultiScale, by summing the Support Vectors weighted by the alpha values. However, I cannot access the alpha values stored in SVModel.decision_func, as it is protected. Any ideeas on how I can access the alpha values?
An advice would be greatly appreciated

Thank you
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

Cosmin
Hey,

I created a car detector, and until now it detects the cars like intended. The annoying part is that the most false positives it detects is between 2 cars. For example I have one car on the right, on car on the left and it detects another car exactly between them(it takes a small part of the car on the left and a small part of the car on the right), and I can not understand why or how to eliminate this.

Thx in advance

J H
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

J H
Hi,
HOG subdivides into blocks and cells.
One of the aims of histogram generation of a cell is to be tolerant against local changes, e.g. it does not matter at which position inside the cell region the pixel values reside, by generating a histogram you consider a statistic over pixel values neglecting their exact position (which seems to happen in your case to some extent).
To increase local dependency, you can try to decrease the cell size (and the block size respectively, which should result in larger feature vectors) and explicitly train the unwanted false positives as negative samples.

Best regards,
Jan Hendriks


________________________________
 Von: Cosmin <[hidden email]>
An: [hidden email]
Gesendet: 11:34 Mittwoch, 21.Dezember 2011
Betreff: [OpenCV] Re: training a HOG descriptor
 

 
Hey,

I created a car detector, and until now it detects the cars like intended. The annoying part is that the most false positives it detects is between 2 cars. For example I have one car on the right, on car on the left and it detects another car exactly between them(it takes a small part of the car on the left and a small part of the car on the right), and I can not understand why or how to eliminate this.

Thx in advance


 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: training a HOG descriptor

jeansong
This post has NOT been accepted by the mailing list yet.
In reply to this post by J H
Hey Jan,

I'm working on the HOG descriptor for people detection. And I'm using svmlight for training. But I don't understand why we should use "regression" as learning method. Since it's a detection problem, why not use "classification"? Thank you very much.

Regards,
Jean
Loading...