Weak Classifier in Adaboost

110 views
Skip to first unread message

Mohsen Afshin

unread,
Dec 31, 2009, 2:05:42 AM12/31/09
to Face Recognition Research Community
Hi.
I've just tried to implement Adaboost Face Detection in C#, but no
working source was found on net, so I port a C code as follows which
doesn't work correctly.
I think the problem is in calculating errors :

WeakClassifier findWeakClassifier(int[] f, List<int> fxIdx)
{
double e1 = 0.0;
double e2 = 0.0;
double min1;
double min2;
int min1Idx = 0;
int min2Idx = 0;
int i, j;
WeakClassifier cls = new WeakClassifier();
double Tp = 0, Tn = 0, Sp = 0, Sn = 0;

for (i = 0; i < pos_count; i++)
Tp += w[i];
for (i = pos_count; i < img_count; i++)
Tn += w[i];
e2 = 1 - e1;
min1 = e1;
min2 = e2;
for (i = 0; i < img_count; i++)
{
if (labels[i] == 1)
Sp += w[i] * fxIdx[i];
else
Sn += w[i] * fxIdx[i];

e1 = (Sp + (Tn - Sn));
e2 = (Sn + (Tp - Sp));

if (e1 < min1)
{
min1 = e1;
min1Idx = i;
}
if (e2 < min2)
{
min2 = e2;
min2Idx = i;
}
}
if (min1 < min2)
{
cls.parity = 1;
cls.theta = ApplyFeature(f, images[min1Idx]);
cls.error = min1;
if (min1 != 0.0)
cls.alpha = Math.Log(Math.Abs((1 - min1) / min1));
}
else
{
cls.parity = -1;
cls.theta = ApplyFeature(f, images[min2Idx]);
cls.error = min2;
if (min2 != 0.0)
cls.alpha = Math.Log(Math.Abs((1 - min2) / min2));
}
cls.feature = f;
return cls;
}

Also somewhere else in code we have :

beta = (double)min_error / (1 - min_error);
if (beta != 0.0)
alfa[t] = Math.Log(Math.Abs(1 / beta));

Which usually cause alfa goes infinity , so I added the IF to prevent.

And what is input to Adaboost for detection , I mean should I
calculate gray scale values ( R+G+B / 3) and then Integral Image or
something else.


I really need your help ....

jain sekhar

unread,
Jan 6, 2010, 8:27:26 PM1/6/10
to face...@googlegroups.com
hello 
       i've gone through your mail and i'm sorry to say that i'm not well experienced with c/c#. i'm doing my project in matlab.thanks for your reply.
 good luck

GoGo

unread,
Jan 20, 2010, 1:03:49 AM1/20/10
to Face Recognition Research Community
calculate gray gray scale values ( R+G+B / 3) ? I doubt about it...

nilima kachare (Patil)

unread,
Jan 20, 2010, 1:05:22 AM1/20/10
to face...@googlegroups.com

Hello friends,
Any body is working on block based SVD for watermarking.... pls reply i need help in my mtech project.

Thanks n regards,


--
Nilima Kachare
MTech -CSE,
College of Engg, Pune

Kourosh Meshgi

unread,
Jan 20, 2010, 3:30:04 AM1/20/10
to face...@googlegroups.com

Conversion of a color image to grayscale is not unique; different weighting of the color channels effectively represent the effect of shooting black-and-white film with different-colored photographic filters on the cameras. A common strategy is to match the luminance of the grayscale image to the luminance of the color image.

To convert any color to a grayscale representation of its luminance, first one must obtain the values of its red, green, and blue (RGB) primaries in linear intensity encoding, by gamma expansion. Then, add together 30% of the red value, 59% of the green value, and 11% of the blue value (these weights depend on the exact choice of the RGB primaries, but are typical). The formula (11*R + 16*G + 5*B) /32 is also popular since it can be efficiently implemented using only integer operations. Regardless of the scale employed (0.0 to 1.0, 0 to 255, 0% to 100%, etc.), the resultant number is the desired linear luminance value; it typically needs to be gamma compressed to get back to a conventional grayscale representation.

This is not the method used to obtain the luma in the Y'UV and related color models, used in standard color TV and video systems as PAL and NTSC, as well as in the L*a*b color model. These systems directly compute a gamma-compressed luma as a linear combination of gamma-compressed primary intensities, rather than use linearization via gamma expansion and compression.

To convert a gray intensity value to RGB, simply set all the three primary color components red, green and blue to the gray value, correcting to a different gamma if necessary.

http://en.wikipedia.org/wiki/Grayscale



--
You received this message because you are subscribed to the Google Groups "Face Recognition Research Community" group.
To post to this group, send email to face...@googlegroups.com.
To unsubscribe from this group, send email to face-rec+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/face-rec?hl=en.




Reply all
Reply to author
Forward
0 new messages