problem with detecting an object after training

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with detecting an object after training

lombardijoseph
I m trying to train my own cascade of boosted classifiers according to
the step by step tutorial by Florian Adolf's "How-to build a cascade of
boosted classifiers based on Haar-like features". I m trying to detect
a chair in a room from a webcam view, thus i took a number of photos in
different positions of this chair, and some photos (as negative) of the
background. The problem is that when i'm trying to run the facedetect
program with the object.xml that i has just created, the images from
the webcam are showing a large number of squares allover it and not
identifying the chair in the room.
I tried to change the background photos but i ve got the same bad
result.

Any body has any ideas on what can i do to solve this problem please?
Thanks for your help

Reply | Threaded
Open this post in threaded view
|

Re: problem with detecting an object after training

omegatttop
--- In [hidden email], "lombardijoseph" <lombardijoseph@...>
wrote:
>
> I m trying to train my own cascade of boosted classifiers according
to
> the step by step tutorial by Florian Adolf's "How-to build a cascade
of
> boosted classifiers based on Haar-like features". I m trying to
detect
> a chair in a room from a webcam view, thus i took a number of photos
in
> different positions of this chair, and some photos (as negative) of
the
> background. The problem is that when i'm trying to run the
facedetect
> program with the object.xml that i has just created, the images from
> the webcam are showing a large number of squares allover it and not
> identifying the chair in the room.
> I tried to change the background photos but i ve got the same bad
> result.
>
> Any body has any ideas on what can i do to solve this problem
please?
> Thanks for your help
>
Hi,
Can you provide more detail on your detection such as how much the
positive samples, negative samples, number of stages in the training?
However, you can try to increase the number of stages or/and number of
training samples in the training. Hope this may help.

Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with detecting an object after training

lombardijoseph
i tried with about 80 positive photos of the same chair, each photo different from the other by turning a bit the chair and changing the light in the room. I will be using the same chair and the same background also. As negative photos i took about 5 photos of the background of the room. I tried this by doing the training with a totally different background from the one which will be used in the application. The camera will be stationary always in the same position also about eye level. Number of stages in the training i tried with 20 and 30 stages. What i m not sure about is the value of the sample size, stated in the tutorial as -w 24 -h 24. I assume these represent pixels, but in my case the sample size varies when i turn the chair at different angles. And i set the parameter for training as -nonsym as the chair is not symetrical when set at an angle.

Any help please?




________________________________
From: omegatttop <wei91my@gmail..com>
To: [hidden email]
Sent: Tuesday, 30 December, 2008 3:52:08
Subject: [OpenCV] Re: problem with detecting an object after training


--- In OpenCV@yahoogroups. com, "lombardijoseph" <lombardijoseph@ ....>
wrote:
>
> I m trying to train my own cascade of boosted classifiers according
to
> the step by step tutorial by Florian Adolf's "How-to build a cascade
of
> boosted classifiers based on Haar-like features". I m trying to
detect
> a chair in a room from a webcam view, thus i took a number of photos
in
> different positions of this chair, and some photos (as negative) of
the
> background. The problem is that when i'm trying to run the
facedetect
> program with the object.xml that i has just created, the images from
> the webcam are showing a large number of squares allover it and not
> identifying the chair in the room.
> I tried to change the background photos but i ve got the same bad
> result.
>
> Any body has any ideas on what can i do to solve this problem
please?
> Thanks for your help
>
Hi,
Can you provide more detail on your detection such as how much the
positive samples, negative samples, number of stages in the training?
However, you can try to increase the number of stages or/and number of
training samples in the training. Hope this may help.

 


     

[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: problem with detecting an object after training

get_imaginary
Do you mean you rotated the chair through 360 degrees and sampled from
these rotations as positives? Or do you mean you rotated it by just a
few degrees and captured 80 positives from a small number of viewing
angles? Or something else? (If the first of these, then yeah, that
probably won't work well for training a Haar detector because there
won't be much commonality in the chair's appearance among all views).

In addition, five background images is probably way too few. Something
on the order of thousands or tens of thousands is typical. In your
case, you'd probably at least want many combinations of scale X image
location X lighting. To get these, take all your positive images and
random sample them at many scales and locations, but skip any that
have a high overlap with the chair's ROI.

Since camera position is fixed, you may be able to eliminate some FPs
by limiting the minimum scale in your call to the detector. Similarly,
you may be able to filter out detections that are too large, too high
in the image for their scale, etc. as a post processing step.

Given that this is a fixed setting, with known lighting variations,
you may want to consider other options such as histogram
backprojection to complement haar detection. You can evaluate this
possibility easily by running the camshift example program and viewing
the histogram backprojection (probability) view to see how distinctive
your chair's histogram is.

Finally, if your background is relatively static, you may be able to
use simple background subtraction with a moderately high threshold to
eliminate FPs

Hope this helps,
Robin


--- In [hidden email], joseph lombardi <lombardijoseph@...> wrote:
>
> i tried with about 80 positive photos of the same chair, each photo
different from the other by turning a bit the chair and changing the
light in the room. I will be using the same chair and the same
background also. As negative photos i took about 5 photos of the
background of the room. I tried this by doing the training with a
totally different background from the one which will be used in the
application. The camera will be stationary always in the same
position also about eye level. Number of stages in the training i
tried with 20 and 30 stages. What i m not sure about is the value of
the sample size, stated in the tutorial as -w 24 -h 24. I assume these
represent pixels, but in my case the sample size varies when i turn
the chair at different angles. And i set the parameter for training as
-nonsym as the chair is not symetrical when set at an angle.

>
> Any help please?
>
>
>
>
> ________________________________
> From: omegatttop <wei91my@...>
> To: [hidden email]
> Sent: Tuesday, 30 December, 2008 3:52:08
> Subject: [OpenCV] Re: problem with detecting an object after training
>
>
> --- In OpenCV@yahoogroups. com, "lombardijoseph" <lombardijoseph@ ....>
> wrote:
> >
> > I m trying to train my own cascade of boosted classifiers according
> to
> > the step by step tutorial by Florian Adolf's "How-to build a cascade
> of
> > boosted classifiers based on Haar-like features". I m trying to
> detect
> > a chair in a room from a webcam view, thus i took a number of photos
> in
> > different positions of this chair, and some photos (as negative) of
> the
> > background. The problem is that when i'm trying to run the
> facedetect
> > program with the object.xml that i has just created, the images from
> > the webcam are showing a large number of squares allover it and not
> > identifying the chair in the room.
> > I tried to change the background photos but i ve got the same bad
> > result.
> >
> > Any body has any ideas on what can i do to solve this problem
> please?
> > Thanks for your help
> >
> Hi,
> Can you provide more detail on your detection such as how much the
> positive samples, negative samples, number of stages in the training?
> However, you can try to increase the number of stages or/and number of
> training samples in the training. Hope this may help.
>
>  
>
>
>      
>
> [Non-text portions of this message have been removed]
>


Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with detecting an object after training

lombardijoseph
thanks a lot for your help.

In fact i rotated the through 360 degrees and took the photos with different lighting conditions.
I would like to ask you three questions: if the background will be always the same, what kind of photos do i need to include as negative photos, all of them of the room background, or other photos which totally don't have anything to do with the room?
Second question, can you please explain me what you mean by this sentence: "To get these, take all your positive images and
random sample them at many scales and locations, but skip any that have a high overlap with the chair's ROI." What does it mean high overlap with the chair's Region Of Interest?
Third question: When stating the -w and -h values for the haar training, do these values represent the size of the square marked with the objectmarker.exe (this varies with each photo according to the angle of the chair, or the distance from the camera) or represent the size of the photos?

thanks
joseph




________________________________
From: Robin <[hidden email]>
To: [hidden email]
Sent: Tuesday, 30 December, 2008 23:39:58
Subject: [OpenCV] Re: problem with detecting an object after training


Do you mean you rotated the chair through 360 degrees and sampled from
these rotations as positives? Or do you mean you rotated it by just a
few degrees and captured 80 positives from a small number of viewing
angles? Or something else? (If the first of these, then yeah, that
probably won't work well for training a Haar detector because there
won't be much commonality in the chair's appearance among all views).

In addition, five background images is probably way too few. Something
on the order of thousands or tens of thousands is typical. In your
case, you'd probably at least want many combinations of scale X image
location X lighting. To get these, take all your positive images and
random sample them at many scales and locations, but skip any that
have a high overlap with the chair's ROI.

Since camera position is fixed, you may be able to eliminate some FPs
by limiting the minimum scale in your call to the detector. Similarly,
you may be able to filter out detections that are too large, too high
in the image for their scale, etc. as a post processing step.

Given that this is a fixed setting, with known lighting variations,
you may want to consider other options such as histogram
backprojection to complement haar detection. You can evaluate this
possibility easily by running the camshift example program and viewing
the histogram backprojection (probability) view to see how distinctive
your chair's histogram is.

Finally, if your background is relatively static, you may be able to
use simple background subtraction with a moderately high threshold to
eliminate FPs

Hope this helps,
Robin

--- In OpenCV@yahoogroups. com, joseph lombardi <lombardijoseph@ ...> wrote:
>
> i tried with about 80 positive photos of the same chair, each photo
different from the other by turning a bit the chair and changing the
light in the room. I will be using the same chair and the same
background also. As negative photos i took about 5 photos of the
background of the room. I tried this by doing the training with a
totally different background from the one which will be used in the
application. The camera will be stationary always in the same
position also about eye level. Number of stages in the training i
tried with 20 and 30 stages. What i m not sure about is the value of
the sample size, stated in the tutorial as -w 24 -h 24. I assume these
represent pixels, but in my case the sample size varies when i turn
the chair at different angles. And i set the parameter for training as
-nonsym as the chair is not symetrical when set at an angle.

>
> Any help please?
>
>
>
>
> ____________ _________ _________ __
> From: omegatttop <wei91my@... >
> To: OpenCV@yahoogroups. com
> Sent: Tuesday, 30 December, 2008 3:52:08
> Subject: [OpenCV] Re: problem with detecting an object after training
>
>
> --- In OpenCV@yahoogroups. com, "lombardijoseph" <lombardijoseph@ ....>
> wrote:
> >
> > I m trying to train my own cascade of boosted classifiers according
> to
> > the step by step tutorial by Florian Adolf's "How-to build a cascade
> of
> > boosted classifiers based on Haar-like features". I m trying to
> detect
> > a chair in a room from a webcam view, thus i took a number of photos
> in
> > different positions of this chair, and some photos (as negative) of
> the
> > background. The problem is that when i'm trying to run the
> facedetect
> > program with the object.xml that i has just created, the images from
> > the webcam are showing a large number of squares allover it and not
> > identifying the chair in the room.
> > I tried to change the background photos but i ve got the same bad
> > result.
> >
> > Any body has any ideas on what can i do to solve this problem
> please?
> > Thanks for your help
> >
> Hi,
> Can you provide more detail on your detection such as how much the
> positive samples, negative samples, number of stages in the training?
> However, you can try to increase the number of stages or/and number of
> training samples in the training. Hope this may help.
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

 


     

[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: problem with detecting an object after training

get_imaginary
Before trying to answer, let me say that I think it's unlikely you'll
see good results with a single OpenCV Haar detector given that your
positives are from widely different viewpoints. You might be able to
train several detectors and run each of them on every image, but there
are probably much better ways to do what you want (gradient
statistics, HoG, edgelet bagging, and so on).

1) For the background, you only need to include examples that the
detector will actually encounter -- i.e., from the view of the room
that your camera has. Remember though that it searches over all
scales, so you'll need examples from all scales. Also, if people will
be in the room, you'll benefit from having examples of that situtation
in your backgrounds.)

2) There's no exact definition for high overlap. I've seen folks use
80% of area, 70% of area, and so on. You could start with one of these
(say 70% of area) and experiment to see what works best....

3) Don't know. (I've never used OpenCV's Haar detector. I have my own
classifier and training, which I use instead.) However, I'd guess they
mean the width and height to use during training. I presume the ROIs
are extracted and rescaled to -w X -h. Someone else can probably
answer that one for you....

Robin


--- In [hidden email], joseph lombardi <lombardijoseph@...> wrote:
>
> thanks a lot for your help.
>
> In fact i rotated the through 360 degrees and took the photos with
different lighting conditions.
> I would like to ask you three questions: if the background will be
always the same, what kind of photos do i need to include as negative
photos, all of them of the room background, or other photos which
totally don't have anything to do with the room?
> Second question, can you please explain me what you mean by this
sentence: "To get these, take all your positive images and
> random sample them at many scales and locations, but skip any that
have a high overlap with the chair's ROI." What does it mean high
overlap with the chair's Region Of Interest?
> Third question: When stating the -w and -h values for the haar
training, do these values represent the size of the square marked with
the objectmarker.exe (this varies with each photo according to the
angle of the chair, or the distance from the camera) or represent the
size of the photos?

>
> thanks
> joseph
>
>
>
>
> ________________________________
> From: Robin <rhewitt@...>
> To: [hidden email]
> Sent: Tuesday, 30 December, 2008 23:39:58
> Subject: [OpenCV] Re: problem with detecting an object after training
>
>
> Do you mean you rotated the chair through 360 degrees and sampled from
> these rotations as positives? Or do you mean you rotated it by just a
> few degrees and captured 80 positives from a small number of viewing
> angles? Or something else? (If the first of these, then yeah, that
> probably won't work well for training a Haar detector because there
> won't be much commonality in the chair's appearance among all views).
>
> In addition, five background images is probably way too few. Something
> on the order of thousands or tens of thousands is typical. In your
> case, you'd probably at least want many combinations of scale X image
> location X lighting. To get these, take all your positive images and
> random sample them at many scales and locations, but skip any that
> have a high overlap with the chair's ROI.
>
> Since camera position is fixed, you may be able to eliminate some FPs
> by limiting the minimum scale in your call to the detector. Similarly,
> you may be able to filter out detections that are too large, too high
> in the image for their scale, etc. as a post processing step.
>
> Given that this is a fixed setting, with known lighting variations,
> you may want to consider other options such as histogram
> backprojection to complement haar detection. You can evaluate this
> possibility easily by running the camshift example program and viewing
> the histogram backprojection (probability) view to see how distinctive
> your chair's histogram is.
>
> Finally, if your background is relatively static, you may be able to
> use simple background subtraction with a moderately high threshold to
> eliminate FPs
>
> Hope this helps,
> Robin
>
> --- In OpenCV@yahoogroups. com, joseph lombardi <lombardijoseph@
...> wrote:

> >
> > i tried with about 80 positive photos of the same chair, each photo
> different from the other by turning a bit the chair and changing the
> light in the room. I will be using the same chair and the same
> background also. As negative photos i took about 5 photos of the
> background of the room. I tried this by doing the training with a
> totally different background from the one which will be used in the
> application. The camera will be stationary always in the same
> position also about eye level. Number of stages in the training i
> tried with 20 and 30 stages. What i m not sure about is the value of
> the sample size, stated in the tutorial as -w 24 -h 24. I assume these
> represent pixels, but in my case the sample size varies when i turn
> the chair at different angles. And i set the parameter for training as
> -nonsym as the chair is not symetrical when set at an angle.
> >
> > Any help please?
> >
> >
> >
> >
> > ____________ _________ _________ __
> > From: omegatttop <wei91my@ >
> > To: OpenCV@yahoogroups. com
> > Sent: Tuesday, 30 December, 2008 3:52:08
> > Subject: [OpenCV] Re: problem with detecting an object after training
> >
> >
> > --- In OpenCV@yahoogroups. com, "lombardijoseph" <lombardijoseph@
....>
> > wrote:
> > >
> > > I m trying to train my own cascade of boosted classifiers according
> > to
> > > the step by step tutorial by Florian Adolf's "How-to build a
cascade
> > of
> > > boosted classifiers based on Haar-like features". I m trying to
> > detect
> > > a chair in a room from a webcam view, thus i took a number of
photos
> > in
> > > different positions of this chair, and some photos (as negative) of
> > the
> > > background. The problem is that when i'm trying to run the
> > facedetect
> > > program with the object.xml that i has just created, the images
from

> > > the webcam are showing a large number of squares allover it and not
> > > identifying the chair in the room.
> > > I tried to change the background photos but i ve got the same bad
> > > result.
> > >
> > > Any body has any ideas on what can i do to solve this problem
> > please?
> > > Thanks for your help
> > >
> > Hi,
> > Can you provide more detail on your detection such as how much the
> > positive samples, negative samples, number of stages in the training?
> > However, you can try to increase the number of stages or/and
number of

> > training samples in the training. Hope this may help.
> >
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>  
>
>
>      
>
> [Non-text portions of this message have been removed]
>