Escolar Documentos
Profissional Documentos
Cultura Documentos
KH Wong
Introduction
Face interface
Face database
Face detection
Face recognition
Output:
Mr.Chan
Face detection
Face recognition
Prof..Cheng
Detection rate
Total number of faces that are correctly detected/total number of
faces actually exist in the picture
Should be high > 95%.
False positive rate
The detector output is positive but it is false (there is actually no
face).Definition of False positive: A result that is erroneously positive when a situation is normal.
An example of a false positive: a particular test designed to detect cancer of the toenail is positive
but the person does not have toenail cancer.
(http://www.medterms.com/script/main/art.asp?articlekey=3377)
Should be low <10-6
Example
Answer
detected in the
picture, 9 actually
faces exit in the
image
detection rate=(6/9)*100%
false positive rate=(1/7)*100%
7 windows
reported to have
faces , but in 1
window it is not a
face
Face detection v.2d
Exercise 1
Answer
detection rate=?
false positive rate=?
Rectangle_Feature_value f=
(pixels values in white area)
(pixels values in shaded area)
Face detection v.2d
Example
1
Find the
Rectangle_Feature_value
(f) of the box enclosed by
3
the dotted line
Rectangle_Feature_value f=
(pixels values in white area)
(pixels values in shaded area)
f=(8+7)-(0+1)
=15-1= 14
10
Exercise 2
2
Find the
Rectangle_Feature_value
(f) of the box enclosed by
2
the dotted line
Rectangle_Feature_value f=
(pixels values in white area)
(pixels values in shaded area)
f=
10
11
Result
12
(x,y)
13
Examples
3
P
integral image of P is
=1+2+3+3+4+6
integral image of Q is
=1+2+3+3+4+6+5+2+
4+0+2+3
3 Q 6
y
Face detection v.2d
14
ii(x, y-1)
s(x-1, y)
i(x, y)
15
D
For the
Rectangle R
the Area is
Area_R
C
16
A
B
C
D
E
F
G
H
17
45
-1
216 102 78
Integral
White
area
Image
129 210 111
+2
F=Feat_val =
pixel sum in shared area - pixel sum in white
area
Example
Pixel sum in white area=
216+102+78+129+210+111=846
Pixel sum in shared area=
10+20+4+7+45+7=93
A face
Feat_val=F=846-93
If F>threshold,
feature=+1
Else
feature=-1 End if;
If we can choose threshold =768 , so feature is
18
+1.Face detection v.2d
1
F
3
A
19
Exercise 3
Definition: Area at X =pixel sum of the area from top-left corner to X=
Top-left corner
Area_X
1
F
3
A
20
Type 2) 2x1
Type 3) 1x3
Type 4) 3x1
Type 5) 2x2
21
As long as white/gray
areas have the relations
The followings are Type2
Rectangular Features
22
Exercise 4
Feature selection [Lazebnik09
]
Some examples and their types
5)
23
Exercise 5a : How
many rectangular
features of all 5 types
can be found a 24x24
pixel window?
Answer: 162,336
(explain)
Exercise 5b : How
many type 1 features in
a 24x24 (pixel) window?
Answer:_43200 (explain)
24
Exercise 6?
2x1,1x2,3x1,1x3,2x2)
5)
25
26
(x,y) 24x24Sub-window
X-axis 1280
(1,1)
27
Boosting
28
1 if pt f t ( x ) ptt
ht ( x )
0 otherwise
window
threshold
Pt=
polarity{+1,-1}
29
AdaBoost training
Testing
30
+2h2(image)}
Pick a window in the
image and rescale it to
24x24 as image
h1(image)
h2(image)
type3
H(face)=+1 face
H(face)=-1non-face
type2
Standard Types
1)
2)
3)
4)
Face detection v.2d
5)
31
Still not
good
enough!
False positive rate
X10-3
Face detection v.2d
32
33
Input image
Adaboost
Classifier1
True
False
Non-face
Adaboost
Classifier2
True
False
Non-face
Face detection v.2d
Adaboost True
Classifier3
Face
found
False
Non-face
34
An example
type3
2 features
Input image
Adaboost
Classifier1
10 features
True
False
Non-face
Adaboost
Classifier2
25 features
True
False
Non-face
Face detection v.2d
Adaboost True
Classifier3
50 features
Face
found
False
Non-face
35
% False Pos
0
50
100
?__
Receiver operating
characteristic
% Detection
Input image
Adaboost
Classifier1
True
False
Non-face
Adaboost
Classifier2
True
False
Non-face
Face detection v.2d
Adaboost True
Classifier3
Face
found
False
Non-face
36
Input image
Adaboost
Classifier1
True
False
Non-face
Adaboost
Classifier2
True
False
Non-face
Face detection v.2d
Adaboost True
Classifier3
Face
found
False
Non-face
37
Final detections
38
References
1.
2.
3.
4.
5.
6.
7.
8.
39
Appendix1
Advanced topics
40
Training
41
Given : (x1,y1 ),..(xn ,yn ),where xi X , Y {1,1} for negative and positive examples
Initialize weights:
w1,i 1/ 2 M, M number of positive example
w1,i 1/ 2 L, L number of positive example
For t 1,2 ,...,T
wt , j
j n
w
j 1
t, j
find t min f , p , wi h( xi , f , p, ) yi
i
t
1 t
}
T
1 T
1
1 if t ht ( x ) t
The final strong classifier is : C ( x )
,
where
log
2
t
t 1
t 1
t
0 Face detection v.2dotherwise
42
Step1
43
f , p , wi h( xi , f , p, ) yi
i
44
45
Step3
ht ( x) h( x, f t , pt ,t )
f t , pt ,t are minimizer of t at stage t
46
step4
47
step5
1 if
C ( x)
0
1 T
t ht ( x ) t
2 t 1
t 1
otherwise
where t log
48
Appendix2
Answers to exercises
49
Exercise 1
Answer
detection rate=?
false positive rate=?
50
Answer: Exercise 1
Answer
picture, 9 actually
faces exit in the
image
detection rate=(7/9)*100%
false positive rate=(3/10)*100%
10 windows
reported to have
faces , but in 3
windows they are
not faces.
Face detection v.2d
51
Answer: Exercise 2
2
Find the
Rectangle_Feature_value
(f) of the box enclosed by
2
the dotted line
Rectangle_Feature_value f=
(pixels values in white area)
(pixels values in shaded area)
f=(4+8)-(6+2)=12-8=4
10
52
Answer: Exercise 3
Definition: Area at X =pixel sum of the area from top-left corner to X=
Top-left corner
Area_X
1
F
3
A
53
Answer: Exercise 4
Feature selection [Lazebnik09
]
Some examples and their types
2
5
3
Standard Types
1)
2)
3)
4)
5)
54
temp=number_of_blocks_x*number_of_blocks_y+temp;
end
end
win_height=24
55
temp=0;
%Type3: aspect ratio of the feature block, width=3 units, height=1unit
for nx=1:win_width/3 %nx=no. of x pixels in white area.Min =1,max=win_width/3
for ny=1:win_height %ny=no. of y pixels in white area.Min =1,max=win_width
number_of_blocks_x=(win_width-3*nx+1);%no.of x Blocks fit in win_width
number_of_blocks_y=(win_height-ny+1);%no.of y Blocks fit in win_height
temp=number_of_blocks_x*number_of_blocks_y+temp;
end
end
N_Type3=temp %answer= 27600
56
temp=0; %-------------------------------------------------------------------%type5: aspect ratio of the feature block, width=2 units, height=2unit
for nx=1:win_width/2%nx=no. of x pixels in white area.Min =1,max=win_width/2
for ny=1:win_height/2%ny=no. of y pixels in white area.Min =1,max=win_width/2
number_of_blocks_x=(win_width-2*nx+1);%no.of x Blocks fit in win_width
number_of_blocks_y=(win_height-2*ny+1);%no.of y Blocks fit in win_height
temp=number_of_blocks_x*number_of_blocks_y+temp;
end
end
N_Type5=temp %=20736
win_height=24
57
Answer for Exercise 5 and 6:Matlab: fior a 24x24 windows, add all types
N_type1x2+N_type3x2+N_type5=(43200x2+27600x2+20736)=162336
clear; temp=0;
%--matlab program to find number of features %(5 types (columns x rows):
%type1: 2x1; type2: 1x2; type3: 3x1; type 4: 1x3; type 5: 2x2)
%in Viola-Jones face detection cascaded Adaboost algorithm%%%% 2x1 shape : (2 rows x 1 column, same as 1 row x 2 columns) , 2 types
%win_width=24%(you may choose 36 or 24 etc.)
win_width=24%(you may choose 36 or 24 or 12etc.)
temp=0;
%Type3: aspect ratio of the feature block, width=3 units, height=1unit
for nx=1:win_width/3%nx=no. of x pixels of each square.Min =1,max=win_width/3
for ny=1:win_height%ny=no. of y pixels of each square.Min =1,max=win_width
number_of_blocks_x=(win_width-3*nx+1);%no.of x Blocks fit in win_width
number_of_blocks_y=(win_height-ny+1);%no.of y Blocks fit in win_height
temp=number_of_blocks_x*number_of_blocks_y+temp;
end
end
N_Type3=temp
N_Type4=N_Type3 % same as 3 rows x 1 column
pause
%
temp=0; %-------------------------------------------------------------------%type5: aspect ratio of the feature block, width=2 units, height=2unit
for nx=1:win_width/2%nx=no. of x pixels of each square.Min =1,max=win_width/2
for ny=1:win_height/2%ny=no. of y pixels of each square.Min =1,max=win_width/2
number_of_blocks_x=(win_width-2*nx+1);%no.of x Blocks fit in win_width
number_of_blocks_y=(win_height-2*ny+1);%no.of y Blocks fit in win_height
temp=number_of_blocks_x*number_of_blocks_y+temp;
end
end
N_Type5=temp
'total'
N_ALL=N_Type1+N_Type2+N_Type3+N_Type4+N_Type5
%Result= 162336 if width =24
%Result= : 816264 if width =36 ( ??or 704004??)
58
(x,y) 24x24Sub-window
X-axis 1280
(1,1)
}}
Each (x,y) location, for i=1,2,3..obtain subimages: each has size (24ix24i) with leftExercise 7 : Discuss the number of
top corner at (x,y) as long as x+24i<1024
operations required.
For a sub-image, shrink it to a 24x24
Conclusion : too slow, solution use
window.
boosting
For each 24x24 window, it has 162336
features to be calculated.
Face detection v.2d
59