Update the changelog
[opencv] / apps / haartraining / doc / haartraining.htm
1 <html>
2
3 <head>
4 <meta http-equiv=Content-Type content="text/html; charset=windows-1251">
5 <meta name=Generator content="Microsoft Word 11 (filtered)">
6 <title>Object Detection Using Haar-like Features with Cascade of Boosted
7 Classifiers</title>
8 <style>
9 <!--
10  /* Style Definitions */
11  p.MsoNormal, li.MsoNormal, div.MsoNormal
12         {margin:0in;
13         margin-bottom:.0001pt;
14         text-align:justify;
15         font-size:12.0pt;
16         font-family:"Times New Roman";}
17 h1
18         {margin-top:12.0pt;
19         margin-right:0in;
20         margin-bottom:3.0pt;
21         margin-left:0in;
22         text-align:justify;
23         page-break-after:avoid;
24         font-size:16.0pt;
25         font-family:Arial;}
26 h2
27         {margin-top:12.0pt;
28         margin-right:0in;
29         margin-bottom:3.0pt;
30         margin-left:0in;
31         text-align:justify;
32         page-break-after:avoid;
33         font-size:14.0pt;
34         font-family:Arial;
35         font-style:italic;}
36 h3
37         {margin-top:12.0pt;
38         margin-right:0in;
39         margin-bottom:3.0pt;
40         margin-left:0in;
41         text-align:justify;
42         page-break-after:avoid;
43         font-size:13.0pt;
44         font-family:Arial;}
45 span.Typewch
46         {font-family:"Courier New";
47         font-weight:bold;}
48 @page Section1
49         {size:595.3pt 841.9pt;
50         margin:56.7pt 88.0pt 63.2pt 85.05pt;}
51 div.Section1
52         {page:Section1;}
53  /* List Definitions */
54  ol
55         {margin-bottom:0in;}
56 ul
57         {margin-bottom:0in;}
58 -->
59 </style>
60
61 </head>
62
63 <body lang=RU>
64
65 <div class=Section1>
66
67 <h1><span lang=EN-US>Rapid Object Detection With A Cascade of Boosted
68 Classifiers Based on Haar-like Features</span></h1>
69
70 <h2><span lang=EN-US>Introduction</span></h2>
71
72 <p class=MsoNormal><span lang=EN-US>This document describes how to train and
73 use a cascade of boosted classifiers for rapid object detection. A large set of
74 over-complete haar-like features provide the basis for the simple individual
75 classifiers. Examples of object detection tasks are face, eye and nose
76 detection, as well as logo detection. </span></p>
77
78 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
79
80 <p class=MsoNormal><span lang=EN-US>The sample detection task in this document
81 is logo detection, since logo detection does not require the collection of
82 large set of registered and carefully marked object samples. Instead we assume
83 that from one prototype image, a very large set of derived object examples can
84 be derived (</span><span class=Typewch><span lang=EN-US>createsamples</span></span><span
85 lang=EN-US> utility, see below).</span></p>
86
87 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
88
89 <p class=MsoNormal><span lang=EN-US>A detailed description of the training/evaluation
90 algorithm can be found in [1] and [2].</span></p>
91
92 <h2><span lang=EN-US>Samples Creation</span></h2>
93
94 <p class=MsoNormal><span lang=EN-US>For training a training samples must be
95 collected. There are two sample types: negative samples and positive samples.
96 Negative samples correspond to non-object images. Positive samples correspond
97 to object images.</span></p>
98
99 <h3><span lang=EN-US>Negative Samples</span></h3>
100
101 <p class=MsoNormal><span lang=EN-US>Negative samples are taken from arbitrary
102 images. These images must not contain object representations. Negative samples
103 are passed through background description file. It is a text file in which each
104 text line contains the filename (relative to the directory of the description
105 file) of negative sample image. This file must be created manually. Note that
106 the negative samples and sample images are also called background samples or
107 background samples images, and are used interchangeably in this document</span></p>
108
109 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
110
111 <p class=MsoNormal><span lang=EN-US>Example of negative description file:</span></p>
112
113 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
114
115 <p class=MsoNormal><span lang=EN-US>Directory structure:</span></p>
116
117 <p class=MsoNormal><span class=Typewch><span lang=EN-US>/img</span></span></p>
118
119 <p class=MsoNormal><span class=Typewch><span lang=EN-US>  img1.jpg</span></span></p>
120
121 <p class=MsoNormal><span class=Typewch><span lang=EN-US>  img2.jpg</span></span></p>
122
123 <p class=MsoNormal><span class=Typewch><span lang=EN-US>bg.txt</span></span></p>
124
125 <p class=MsoNormal><span class=Typewch><span lang=EN-US>&nbsp;</span></span></p>
126
127 <p class=MsoNormal><span class=Typewch><span style='font-family:"Times New Roman";
128 font-weight:normal'>File </span></span><span class=Typewch><span lang=EN-US>bg.txt:</span></span></p>
129
130 <p class=MsoNormal><span class=Typewch><span lang=EN-US>img/img1.jpg</span></span></p>
131
132 <p class=MsoNormal><span class=Typewch><span lang=EN-US>img/img2.jpg</span></span></p>
133
134 <h3><span lang=EN-US>Positive Samples</span></h3>
135
136 <p class=MsoNormal><span lang=EN-US>Positive samples are created by </span><span
137 class=Typewch><span lang=EN-US>createsamples</span></span><span lang=EN-US>
138 utility. They may be created from single object image or from collection of
139 previously marked up images.<br>
140 <br>
141 </span></p>
142
143 <p class=MsoNormal><span lang=EN-US>The single object image may for instance
144 contain a company logo. Then are large set of positive samples are created from
145 the given object image by randomly rotating, changing the logo color as well as
146 placing the logo on arbitrary background.</span></p>
147
148 <p class=MsoNormal><span lang=EN-US>The amount and range of randomness can be
149 controlled by command line arguments. </span></p>
150
151 <p class=MsoNormal><span lang=EN-US>Command line arguments:</span></p>
152
153 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
154 class=Typewch><span lang=EN-US>- vec &lt;vec_file_name&gt;</span></span><span
155 lang=EN-US> </span></p>
156
157 <p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>name of the
158 output file containing the positive samples for training</span></p>
159
160 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
161 class=Typewch><span lang=EN-US>- img &lt;image_file_name&gt;</span></span><span
162 lang=EN-US> </span></p>
163
164 <p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>source object
165 image (e.g., a company logo)</span></p>
166
167 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
168 class=Typewch><span lang=EN-US>- bg &lt;background_file_name&gt;</span></span><span
169 lang=EN-US> </span></p>
170
171 <p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>background
172 description file; contains a list of images into which randomly distorted
173 versions of the object are pasted for positive sample generation</span></p>
174
175 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
176 class=Typewch><span lang=EN-US>- num &lt;number_of_samples&gt;</span></span><span
177 lang=EN-US> </span></p>
178
179 <p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>number of
180 positive samples to generate </span></p>
181
182 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
183 class=Typewch><span lang=EN-US>- bgcolor &lt;background_color&gt;</span></span></p>
184
185 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
186 lang=EN-US>      background color (currently grayscale images are assumed); the
187 background color denotes the transparent color. Since there might be
188 compression artifacts, the amount of color tolerance can be specified by </span><span
189 class=Typewch><span lang=EN-US>\96bgthresh</span></span><span class=Typewch><span
190 lang=EN-US style='font-family:Arial;font-weight:normal'>. </span></span><span
191 lang=EN-US>All pixels between </span><span class=Typewch><span lang=EN-US>bgcolor-bgthresh</span></span><span
192 lang=EN-US> and </span><span class=Typewch><span lang=EN-US>bgcolor+bgthresh</span></span><span
193 lang=EN-US> are regarded as transparent.</span></p>
194
195 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
196 class=Typewch><span lang=EN-US>- bgthresh &lt;background_color_threshold&gt;</span></span></p>
197
198 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
199 class=Typewch><span lang=EN-US>- inv</span></span></p>
200
201 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
202 lang=EN-US>      if specified, the colors will be inverted</span></p>
203
204 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
205 class=Typewch><span lang=EN-US>- randinv</span></span><span lang=EN-US> </span></p>
206
207 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
208 lang=EN-US>      if specified, the colors will be inverted randomly</span></p>
209
210 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
211 class=Typewch><span lang=EN-US>- maxidev &lt;max_intensity_deviation&gt;</span></span></p>
212
213 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
214 class=Typewch><span lang=EN-US>  </span></span><span lang=EN-US>maximal
215 intensity deviation of foreground samples pixels</span></p>
216
217 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
218 class=Typewch><span lang=EN-US>- maxxangle &lt;max_x_rotation_angle&gt;,</span></span></p>
219
220 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
221 class=Typewch><span lang=EN-US>- maxyangle &lt;max_y_rotation_angle&gt;,</span></span></p>
222
223 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
224 class=Typewch><span lang=EN-US>- maxzangle &lt;max_z_rotation_angle&gt;</span></span></p>
225
226 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
227 lang=EN-US>      maximum rotation angles in radians</span></p>
228
229 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
230 class=Typewch><span lang=EN-US>-show</span></span></p>
231
232 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
233 lang=EN-US>      if specified, each sample will be shown. Pressing \91Esc\92 will
234 continue creation process without samples showing. Useful debugging option.</span></p>
235
236 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
237 class=Typewch><span lang=EN-US>- w &lt;sample_width&gt;</span></span></p>
238
239 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
240 class=Typewch><span lang=EN-US>  </span></span><span class=Typewch><span
241 lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>width (in
242 pixels) of the output samples</span></span></p>
243
244 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
245 class=Typewch><span lang=EN-US>- h &lt;sample_height&gt;</span></span></p>
246
247 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
248 class=Typewch><span lang=EN-US>  </span></span><span class=Typewch><span
249 lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>height (in
250 pixels) of the output samples</span></span></p>
251
252 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
253 class=Typewch><span lang=EN-US>&nbsp;</span></span></p>
254
255 <p class=MsoNormal><span lang=EN-US>For following procedure is used to create a
256 sample object instance:</span></p>
257
258 <p class=MsoNormal><span lang=EN-US>The source image is rotated random around
259 all three axes. The chosen angle is limited my</span><span class=Typewch><span
260 lang=EN-US> -max?angle</span></span><span lang=EN-US>. Next pixels of
261 intensities in the range of </span><span class=Typewch><span lang=EN-US>[bg_color-bg_color_threshold;
262 bg_color+bg_color_threshold]</span></span><span lang=EN-US> are regarded as
263 transparent. White noise is added to the intensities of the foreground. If </span><span
264 class=Typewch><span lang=EN-US>\96inv</span></span><span lang=EN-US> key is
265 specified then foreground pixel intensities are inverted. If </span><span
266 class=Typewch><span lang=EN-US>\96randinv</span></span><span lang=EN-US> key is
267 specified then it is randomly selected whether for this sample inversion will
268 be applied. Finally, the obtained image is placed onto arbitrary background
269 from the background description file, resized to the pixel size specified by </span><span
270 class=Typewch><span lang=EN-US>\96w</span></span><span lang=EN-US> and </span><span
271 class=Typewch><span lang=EN-US>\96h</span></span><span lang=EN-US> and stored
272 into the file specified by the </span><span class=Typewch><span lang=EN-US>\96vec</span></span><span
273 lang=EN-US> command line parameter.</span></p>
274
275 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
276
277 <p class=MsoNormal><span lang=EN-US>Positive samples also may be obtained from
278 a collection of previously marked up images. This collection is described by
279 text file similar to background description file. Each line of this file
280 corresponds to collection image. The first element of the line is image file
281 name. It is followed by number of object instances. The following numbers are
282 the coordinates of bounding rectangles (x, y, width, height).</span></p>
283
284 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
285
286 <p class=MsoNormal><span lang=EN-US>Example of description file:</span></p>
287
288 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
289
290 <p class=MsoNormal><span lang=EN-US>Directory structure:</span></p>
291
292 <p class=MsoNormal><span class=Typewch><span lang=EN-US>/img</span></span></p>
293
294 <p class=MsoNormal><span class=Typewch><span lang=EN-US>  img1.jpg</span></span></p>
295
296 <p class=MsoNormal><span class=Typewch><span lang=EN-US>  img2.jpg</span></span></p>
297
298 <p class=MsoNormal><span class=Typewch><span lang=EN-US>info.dat</span></span></p>
299
300 <p class=MsoNormal><span class=Typewch><span lang=EN-US>&nbsp;</span></span></p>
301
302 <p class=MsoNormal><span class=Typewch><span lang=EN-US style='font-family:
303 "Times New Roman";font-weight:normal'>File </span></span><span class=Typewch><span
304 lang=EN-US>info.dat:</span></span></p>
305
306 <p class=MsoNormal><span class=Typewch><span lang=EN-US>img/img1.jpg  1  140
307 100 45 45</span></span></p>
308
309 <p class=MsoNormal><span class=Typewch><span lang=EN-US>img/img2.jpg  2  100
310 200 50 50   50 30 25 25</span></span></p>
311
312 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
313
314 <p class=MsoNormal><span lang=EN-US>Image </span><span class=Typewch><span
315 lang=EN-US>img1.jpg</span></span><span lang=EN-US> contains single object
316 instance with bounding rectangle (140, 100, 45, 45). Image </span><span
317 class=Typewch><span lang=EN-US>img2.jpg</span></span><span lang=EN-US> contains
318 two object instances.</span></p>
319
320 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
321
322 <p class=MsoNormal><span lang=EN-US>In order to create positive samples from
323 such collection </span><span class=Typewch><span lang=EN-US>\96info</span></span><span
324 lang=EN-US> argument should be specified instead of </span><span class=Typewch><span
325 lang=EN-US>\96img</span></span><span class=Typewch><span style='font-family:"Times New Roman";
326 font-weight:normal'>:</span></span></p>
327
328 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
329 class=Typewch><span lang=EN-US>- info &lt;collection_file_name&gt;</span></span><span
330 lang=EN-US> </span></p>
331
332 <p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>description file
333 of marked up images collection</span></p>
334
335 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
336
337 <p class=MsoNormal><span lang=EN-US>The scheme of sample creation in this case
338 is as follows. The object instances are taken from images. Then they are
339 resized to samples size and stored in output file. No distortion is applied, so
340 the only affecting arguments are </span><span class=Typewch><span lang=EN-US>\96w</span></span><span
341 lang=EN-US>, </span><span class=Typewch><span lang=EN-US>-h</span></span><span
342 lang=EN-US>, </span><span class=Typewch><span lang=EN-US>-show</span></span><span
343 lang=EN-US> and </span><span class=Typewch><span lang=EN-US>\96num</span></span><span
344 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
345 normal'>.</span></span></p>
346
347 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
348
349 <p class=MsoNormal><span class=Typewch><span lang=EN-US>createsamples</span></span><span
350 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
351 normal'> utility may be used for examining samples stored in positive samples
352 file. In order to do this only </span></span><span class=Typewch><span
353 lang=EN-US>\96vec</span></span><span class=Typewch><span lang=EN-US
354 style='font-family:"Times New Roman";font-weight:normal'>, </span></span><span
355 class=Typewch><span lang=EN-US>\96w</span></span><span class=Typewch><span
356 lang=EN-US style='font-family:"Times New Roman";font-weight:normal'> and </span></span><span
357 class=Typewch><span lang=EN-US>\96h</span></span><span class=Typewch><span
358 lang=EN-US style='font-family:"Times New Roman";font-weight:normal'> parameters
359 should be specified.</span></span></p>
360
361 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
362
363 <p class=MsoNormal><span lang=EN-US>Note that for training, it does not matter
364 how positive samples files are generated. So the </span><span class=Typewch><span
365 lang=EN-US>createsamples</span></span><span lang=EN-US> utility is only one way
366 to collect/create a vector file of positive samples.</span></p>
367
368 <h2><span lang=EN-US>Training</span></h2>
369
370 <p class=MsoNormal><span lang=EN-US>The next step after samples creation is
371 training of classifier. It is performed by the </span><span class=Typewch><span
372 lang=EN-US>haartraining</span></span><span lang=EN-US> utility.</span></p>
373
374 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
375
376 <p class=MsoNormal><span lang=EN-US>Command line arguments:</span><span
377 class=Typewch><span lang=EN-US> </span></span></p>
378
379 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
380 class=Typewch><span lang=EN-US>- data &lt;dir_name&gt;</span></span><span
381 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
382 normal'> </span></span></p>
383
384 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
385 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
386 normal'>      directory name in which the trained classifier is stored</span></span></p>
387
388 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
389 class=Typewch><span lang=EN-US>- vec &lt;vec_file_name&gt;</span></span><span
390 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
391 normal'> </span></span></p>
392
393 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
394 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
395 normal'>      file name of positive sample file (created by </span></span><span
396 class=Typewch><span lang=EN-US>trainingsamples</span></span><span
397 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
398 normal'> utility or by any other means)</span></span></p>
399
400 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
401 class=Typewch><span lang=EN-US>- bg &lt;background_file_name&gt;</span></span></p>
402
403 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
404 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
405 normal'>      background description file</span></span></p>
406
407 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
408 class=Typewch><span lang=EN-US>- npos &lt;number_of_positive_samples&gt;,</span></span></p>
409
410 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
411 class=Typewch><span lang=EN-US>- nneg &lt;number_of_negative_samples&gt;</span></span><span
412 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
413 normal'> </span></span></p>
414
415 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
416 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
417 normal'>      number of positive/negative samples used in training of each
418 classifier stage. Reasonable values are npos = 7000 and nneg = 3000.</span></span></p>
419
420 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
421 class=Typewch><span lang=EN-US>- nstages &lt;number_of_stages&gt;</span></span></p>
422
423 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
424 class=Typewch><span lang=EN-US>  </span></span><span class=Typewch><span
425 lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>number of
426 stages to be trained</span></span></p>
427
428 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
429 class=Typewch><span lang=EN-US>- nsplits &lt;number_of_splits&gt;</span></span><span
430 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
431 normal'> </span></span></p>
432
433 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
434 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
435 normal'>      determines the weak classifier used in stage classifiers. If </span></span><span
436 class=Typewch><span lang=EN-US style='font-family:"Times New Roman"'>1</span></span><span
437 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
438 normal'>, then a simple stump classifier is used, if </span></span><span
439 class=Typewch><span lang=EN-US style='font-family:"Times New Roman"'>2</span></span><span
440 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
441 normal'> and more, then CART classifier with </span></span><span class=Typewch><span
442 lang=EN-US>number_of_splits</span></span><span class=Typewch><span lang=EN-US
443 style='font-family:"Times New Roman";font-weight:normal'> internal (split)
444 nodes is used</span></span></p>
445
446 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
447 class=Typewch><span lang=EN-US>- mem &lt;memory_in_MB&gt;</span></span><span
448 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
449 normal'> </span></span></p>
450
451 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
452 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
453 normal'>      Available memory in MB for precalculation. The more memory you
454 have the faster the training process</span></span></p>
455
456 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
457 class=Typewch><span lang=EN-US>- sym (default),</span></span></p>
458
459 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
460 class=Typewch><span lang=EN-US>- nonsym</span></span><span class=Typewch><span
461 lang=EN-US style='font-family:"Times New Roman";font-weight:normal'> </span></span></p>
462
463 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
464 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
465 normal'>      specifies whether the object class under training has vertical
466 symmetry or not. Vertical symmetry speeds up training process. For instance,
467 frontal faces show off vertical symmetry</span></span></p>
468
469 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
470 class=Typewch><span lang=EN-US>- minhitrate &lt;min_hit_rate&gt;</span></span></p>
471
472 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
473 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
474 normal'>      minimal desired hit rate for each stage classifier. Overall hit
475 rate may be estimated as </span></span><span class=Typewch><span lang=EN-US>(min_hit_rate^number_of_stages)</span></span></p>
476
477 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
478 class=Typewch><span lang=EN-US>- maxfalsealarm &lt;max_false_alarm_rate&gt;</span></span><span
479 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
480 normal'> </span></span></p>
481
482 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
483 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
484 normal'>      maximal desired false alarm rate for each stage classifier. </span></span><span
485 class=Typewch><span style='font-family:"Times New Roman";font-weight:normal'>Overall
486 false alarm rate may be estimated as</span></span><span class=Typewch><span
487 lang=EN-US> (max_false_alarm_rate^number_of_stages)</span></span></p>
488
489 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
490 class=Typewch><span lang=EN-US>- weighttrimming &lt;weight_trimming&gt;</span></span></p>
491
492 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
493 class=Typewch><span lang=EN-US>  </span></span><span class=Typewch><span
494 lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>Specifies
495 wheter and how much weight trimming should be used. A decent choice is 0.90.</span></span></p>
496
497 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
498 class=Typewch><span lang=EN-US>- eqw</span></span></p>
499
500 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
501 class=Typewch><span lang=EN-US>- mode &lt;BASIC (default) | CORE | ALL&gt;</span></span><span
502 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
503 normal'> </span></span></p>
504
505 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
506 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
507 normal'>      selects the type of haar features set used in training. BASIC use
508 only upright features, while ALL uses the full set of upright and 45 degree
509 rotated feature set. See [1] for more details.</span></span></p>
510
511 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
512 class=Typewch><span lang=EN-US>- w &lt;sample_width&gt;,</span></span></p>
513
514 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
515 class=Typewch><span lang=EN-US>- h &lt;sample_height&gt;</span></span><span
516 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
517 normal'> </span></span></p>
518
519 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
520 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
521 normal'>      Size of training samples (in pixels). Must have exactly the same
522 values as used during training samples creation (utility </span></span><span
523 class=Typewch><span lang=EN-US>trainingsamples</span></span><span
524 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
525 normal'>)</span></span></p>
526
527 <p class=MsoNormal><span class=Typewch><span lang=EN-US style='font-family:
528 "Times New Roman";font-weight:normal'>&nbsp;</span></span></p>
529
530 <p class=MsoNormal><span class=Typewch><span lang=EN-US style='font-family:
531 "Times New Roman";font-weight:normal'>Note: in order to use multiprocessor
532 advantage a compiler that supports OpenMP 1.0 standard should be used.</span></span></p>
533
534 <h2><span lang=EN-US>Application</span></h2>
535
536 <p class=MsoNormal><span lang=EN-US>OpenCV cvHaarDetectObjects() function (in
537 particular haarFaceDetect demo) is used for detection.</span></p>
538
539 <h3><span lang=EN-US>Test Samples</span></h3>
540
541 <p class=MsoNormal><span lang=EN-US>In order to evaluate the performance of
542 trained classifier a collection of marked up images is needed. When such
543 collection is not available test samples may be created from single object
544 image by </span><span class=Typewch><span lang=EN-US>createsamples</span></span><span
545 lang=EN-US> utility. The scheme of test samples creation in this case is
546 similar to training samples creation since each test sample is a background
547 image into which a randomly distorted and randomly scaled instance of the
548 object picture is pasted at a random position. </span></p>
549
550 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
551
552 <p class=MsoNormal><span lang=EN-US>If both </span><span class=Typewch><span
553 lang=EN-US>\96img</span></span><span lang=EN-US> and </span><span class=Typewch><span
554 lang=EN-US>\96info</span></span><span lang=EN-US> arguments are specified then
555 test samples will be created by </span><span class=Typewch><span lang=EN-US>createsamples</span></span><span
556 lang=EN-US> utility. The sample image is arbitrary distorted as it was
557 described below, then it is placed at random location to background image and
558 stored. The corresponding description line is added to the file specified by </span><span
559 class=Typewch><span lang=EN-US>\96info</span></span><span lang=EN-US> argument.</span></p>
560
561 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
562
563 <p class=MsoNormal><span lang=EN-US>The </span><span class=Typewch><span
564 lang=EN-US>\96w</span></span><span lang=EN-US> and </span><span class=Typewch><span
565 lang=EN-US>\96h</span></span><span lang=EN-US> keys determine the minimal size of
566 placed object picture.</span></p>
567
568 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
569
570 <p class=MsoNormal><span lang=EN-US>The test image file name format is as
571 follows:</span></p>
572
573 <p class=MsoNormal><span class=Typewch><span lang=EN-US>imageOrderNumber_x_y_width_height.jpg</span></span><span
574 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
575 normal'>, where </span></span><span class=Typewch><span lang=EN-US>x</span></span><span
576 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
577 normal'>, </span></span><span class=Typewch><span lang=EN-US>y</span></span><span
578 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
579 normal'>, </span></span><span class=Typewch><span lang=EN-US>width</span></span><span
580 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
581 normal'> and </span></span><span class=Typewch><span lang=EN-US>height</span></span><span
582 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
583 normal'> are the coordinates of placed object bounding rectangle.</span></span></p>
584
585 <p class=MsoNormal><span class=Typewch><span lang=EN-US style='font-family:
586 "Times New Roman";font-weight:normal'>Note that you should use a background
587 images set different from the background image set used during training.</span></span></p>
588
589 <h3><span class=Typewch><span lang=EN-US style='font-family:"Times New Roman"'>Performance
590 Evaluation</span></span></h3>
591
592 <p class=MsoNormal><span lang=EN-US>In order to evaluate the performance of the
593 classifier </span><span class=Typewch><span lang=EN-US>performance</span></span><span
594 lang=EN-US> utility may be used. It takes a collection of marked up images,
595 applies the classifier and outputs the performance, i.e. number of found
596 objects, number of missed objects, number of false alarms and other
597 information.</span></p>
598
599 <p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
600
601 <p class=MsoNormal><span lang=EN-US>Command line arguments:</span><span
602 class=Typewch><span lang=EN-US> </span></span></p>
603
604 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
605 class=Typewch><span lang=EN-US>- data &lt;dir_name&gt;</span></span><span
606 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
607 normal'> </span></span></p>
608
609 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
610 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
611 normal'>      directory name in which the trained classifier is stored</span></span></p>
612
613 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
614 class=Typewch><span lang=EN-US>- info &lt;collection_file_name&gt;</span></span><span
615 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
616 normal'> </span></span></p>
617
618 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
619 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
620 normal'>      file with test samples description</span></span></p>
621
622 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
623 class=Typewch><span lang=EN-US>- maxSizeDiff &lt;max_size_difference&gt;</span></span><span
624 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
625 normal'>,</span></span></p>
626
627 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
628 class=Typewch><span lang=EN-US>- maxPosDiff &lt;max_position_difference&gt;</span></span><span
629 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
630 normal'> </span></span></p>
631
632 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
633 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
634 normal'>      determine the criterion of reference and detected rectangles
635 coincidence. Default values are 1.5 and 0.3 respectively.</span></span></p>
636
637 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
638 class=Typewch><span lang=EN-US>- sf &lt;scale_factor&gt;</span></span><span
639 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
640 normal'>,</span></span></p>
641
642 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
643 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
644 normal'>      detection parameter. Default value is 1.2.</span></span></p>
645
646 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
647 class=Typewch><span lang=EN-US>- w &lt;sample_width&gt;,</span></span></p>
648
649 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
650 class=Typewch><span lang=EN-US>- h &lt;sample_height&gt;</span></span><span
651 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
652 normal'> </span></span></p>
653
654 <p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
655 class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
656 normal'>      Size of training samples (in pixels). Must have exactly the same
657 values as used during training (utility </span></span><span class=Typewch><span
658 lang=EN-US>haartraining</span></span><span class=Typewch><span lang=EN-US
659 style='font-family:"Times New Roman";font-weight:normal'>)</span></span></p>
660
661 <h2><span lang=EN-US>References</span></h2>
662
663 <p class=MsoNormal><span lang=EN-US>[1] Rainer Lienhart and Jochen Maydt. An
664 Extended Set of Haar-like Features for Rapid Object Detection. Submitted to
665 ICIP2002.</span></p>
666
667 <p class=MsoNormal><span lang=EN-US>[2] Alexander Kuranov, Rainer Lienhart, and
668 Vadim Pisarevsky. An Empirical Analysis of Boosting Algorithms for Rapid
669 Objects With an Extended Set of Haar-like Features. Intel Technical Report
670 MRL-TR-July02-01, 2002.</span></p>
671
672 </div>
673
674 </body>
675
676 </html>