haartraining.htm 33 KB
Newer Older
wester committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1251">
<meta name=Generator content="Microsoft Word 11 (filtered)">
<title>Object Detection Using Haar-like Features with Cascade of Boosted
Classifiers</title>
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	text-align:justify;
	font-size:12.0pt;
	font-family:"Times New Roman";}
h1
	{margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	text-align:justify;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:Arial;}
h2
	{margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	text-align:justify;
	page-break-after:avoid;
	font-size:14.0pt;
	font-family:Arial;
	font-style:italic;}
h3
	{margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	text-align:justify;
	page-break-after:avoid;
	font-size:13.0pt;
	font-family:Arial;}
span.Typewch
	{font-family:"Courier New";
	font-weight:bold;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:56.7pt 88.0pt 63.2pt 85.05pt;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>

</head>

<body lang=RU>

<div class=Section1>

<h1><span lang=EN-US>Rapid Object Detection With A Cascade of Boosted
Classifiers Based on Haar-like Features</span></h1>

<h2><span lang=EN-US>Introduction</span></h2>

<p class=MsoNormal><span lang=EN-US>This document describes how to train and
use a cascade of boosted classifiers for rapid object detection. A large set of
over-complete haar-like features provide the basis for the simple individual
classifiers. Examples of object detection tasks are face, eye and nose
detection, as well as logo detection. </span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>The sample detection task in this document
is logo detection, since logo detection does not require the collection of
large set of registered and carefully marked object samples. Instead we assume
that from one prototype image, a very large set of derived object examples can
be derived (</span><span class=Typewch><span lang=EN-US>createsamples</span></span><span
lang=EN-US> utility, see below).</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>A detailed description of the training/evaluation
algorithm can be found in [1] and [2].</span></p>

<h2><span lang=EN-US>Samples Creation</span></h2>

<p class=MsoNormal><span lang=EN-US>For training a training samples must be
collected. There are two sample types: negative samples and positive samples.
Negative samples correspond to non-object images. Positive samples correspond
to object images.</span></p>

<h3><span lang=EN-US>Negative Samples</span></h3>

<p class=MsoNormal><span lang=EN-US>Negative samples are taken from arbitrary
images. These images must not contain object representations. Negative samples
are passed through background description file. It is a text file in which each
text line contains the filename (relative to the directory of the description
file) of negative sample image. This file must be created manually. Note that
the negative samples and sample images are also called background samples or
background samples images, and are used interchangeably in this document</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Example of negative description file:</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Directory structure:</span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>/img</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US> img1.jpg</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US> img2.jpg</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>bg.txt</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>&nbsp;</span></span></p>

<p class=MsoNormal><span class=Typewch><span style='font-family:"Times New Roman";
font-weight:normal'>File </span></span><span class=Typewch><span lang=EN-US>bg.txt:</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>img/img1.jpg</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>img/img2.jpg</span></span></p>

<h3><span lang=EN-US>Positive Samples</span></h3>

<p class=MsoNormal><span lang=EN-US>Positive samples are created by </span><span
class=Typewch><span lang=EN-US>createsamples</span></span><span lang=EN-US>
utility. They may be created from single object image or from collection of
previously marked up images.<br>
<br>
</span></p>

<p class=MsoNormal><span lang=EN-US>The single object image may for instance
contain a company logo. Then are large set of positive samples are created from
the given object image by randomly rotating, changing the logo color as well as
placing the logo on arbitrary background.</span></p>

<p class=MsoNormal><span lang=EN-US>The amount and range of randomness can be
controlled by command line arguments. </span></p>

<p class=MsoNormal><span lang=EN-US>Command line arguments:</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- vec &lt;vec_file_name&gt;</span></span><span
lang=EN-US> </span></p>

<p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>name of the
output file containing the positive samples for training</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- img &lt;image_file_name&gt;</span></span><span
lang=EN-US> </span></p>

<p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>source object
image (e.g., a company logo)</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- bg &lt;background_file_name&gt;</span></span><span
lang=EN-US> </span></p>

<p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>background
description file; contains a list of images into which randomly distorted
versions of the object are pasted for positive sample generation</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- num &lt;number_of_samples&gt;</span></span><span
lang=EN-US> </span></p>

<p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>number of
positive samples to generate </span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- bgcolor &lt;background_color&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
lang=EN-US> background color (currently grayscale images are assumed); the
background color denotes the transparent color. Since there might be
compression artifacts, the amount of color tolerance can be specified by </span><span
class=Typewch><span lang=EN-US>bgthresh</span></span><span class=Typewch><span
lang=EN-US style='font-family:Arial;font-weight:normal'>. </span></span><span
lang=EN-US>All pixels between </span><span class=Typewch><span lang=EN-US>bgcolor-bgthresh</span></span><span
lang=EN-US> and </span><span class=Typewch><span lang=EN-US>bgcolor+bgthresh</span></span><span
lang=EN-US> are regarded as transparent.</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- bgthresh &lt;background_color_threshold&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- inv</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
lang=EN-US> if specified, the colors will be inverted</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- randinv</span></span><span lang=EN-US> </span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
lang=EN-US> if specified, the colors will be inverted randomly</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- maxidev &lt;max_intensity_deviation&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US> </span></span><span lang=EN-US>maximal
intensity deviation of foreground samples pixels</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- maxxangle &lt;max_x_rotation_angle&gt;,</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- maxyangle &lt;max_y_rotation_angle&gt;,</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- maxzangle &lt;max_z_rotation_angle&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
lang=EN-US> maximum rotation angles in radians</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>-show</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
lang=EN-US> if specified, each sample will be shown. Pressing Esc will
continue creation process without samples showing. Useful debugging option.</span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- w &lt;sample_width&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US> </span></span><span class=Typewch><span
lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>width (in
pixels) of the output samples</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- h &lt;sample_height&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US> </span></span><span class=Typewch><span
lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>height (in
pixels) of the output samples</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>&nbsp;</span></span></p>

<p class=MsoNormal><span lang=EN-US>For following procedure is used to create a
sample object instance:</span></p>

<p class=MsoNormal><span lang=EN-US>The source image is rotated random around
all three axes. The chosen angle is limited my</span><span class=Typewch><span
lang=EN-US> -max?angle</span></span><span lang=EN-US>. Next pixels of
intensities in the range of </span><span class=Typewch><span lang=EN-US>[bg_color-bg_color_threshold;
bg_color+bg_color_threshold]</span></span><span lang=EN-US> are regarded as
transparent. White noise is added to the intensities of the foreground. If </span><span
class=Typewch><span lang=EN-US>inv</span></span><span lang=EN-US> key is
specified then foreground pixel intensities are inverted. If </span><span
class=Typewch><span lang=EN-US>randinv</span></span><span lang=EN-US> key is
specified then it is randomly selected whether for this sample inversion will
be applied. Finally, the obtained image is placed onto arbitrary background
from the background description file, resized to the pixel size specified by </span><span
class=Typewch><span lang=EN-US>w</span></span><span lang=EN-US> and </span><span
class=Typewch><span lang=EN-US>h</span></span><span lang=EN-US> and stored
into the file specified by the </span><span class=Typewch><span lang=EN-US>vec</span></span><span
lang=EN-US> command line parameter.</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Positive samples also may be obtained from
a collection of previously marked up images. This collection is described by
text file similar to background description file. Each line of this file
corresponds to collection image. The first element of the line is image file
name. It is followed by number of object instances. The following numbers are
the coordinates of bounding rectangles (x, y, width, height).</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Example of description file:</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Directory structure:</span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>/img</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US> img1.jpg</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US> img2.jpg</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>info.dat</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>&nbsp;</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US style='font-family:
"Times New Roman";font-weight:normal'>File </span></span><span class=Typewch><span
lang=EN-US>info.dat:</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>img/img1.jpg 1 140
100 45 45</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>img/img2.jpg 2 100
200 50 50 50 30 25 25</span></span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Image </span><span class=Typewch><span
lang=EN-US>img1.jpg</span></span><span lang=EN-US> contains single object
instance with bounding rectangle (140, 100, 45, 45). Image </span><span
class=Typewch><span lang=EN-US>img2.jpg</span></span><span lang=EN-US> contains
two object instances.</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>In order to create positive samples from
such collection </span><span class=Typewch><span lang=EN-US>info</span></span><span
lang=EN-US> argument should be specified instead of </span><span class=Typewch><span
lang=EN-US>img</span></span><span class=Typewch><span style='font-family:"Times New Roman";
font-weight:normal'>:</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- info &lt;collection_file_name&gt;</span></span><span
lang=EN-US> </span></p>

<p class=MsoNormal style='margin-left:17.1pt'><span lang=EN-US>description file
of marked up images collection</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>The scheme of sample creation in this case
is as follows. The object instances are taken from images. Then they are
resized to samples size and stored in output file. No distortion is applied, so
the only affecting arguments are </span><span class=Typewch><span lang=EN-US>w</span></span><span
lang=EN-US>, </span><span class=Typewch><span lang=EN-US>-h</span></span><span
lang=EN-US>, </span><span class=Typewch><span lang=EN-US>-show</span></span><span
lang=EN-US> and </span><span class=Typewch><span lang=EN-US>num</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'>.</span></span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>createsamples</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> utility may be used for examining samples stored in positive samples
file. In order to do this only </span></span><span class=Typewch><span
lang=EN-US>vec</span></span><span class=Typewch><span lang=EN-US
style='font-family:"Times New Roman";font-weight:normal'>, </span></span><span
class=Typewch><span lang=EN-US>w</span></span><span class=Typewch><span
lang=EN-US style='font-family:"Times New Roman";font-weight:normal'> and </span></span><span
class=Typewch><span lang=EN-US>h</span></span><span class=Typewch><span
lang=EN-US style='font-family:"Times New Roman";font-weight:normal'> parameters
should be specified.</span></span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Note that for training, it does not matter
how positive samples files are generated. So the </span><span class=Typewch><span
lang=EN-US>createsamples</span></span><span lang=EN-US> utility is only one way
to collect/create a vector file of positive samples.</span></p>

<h2><span lang=EN-US>Training</span></h2>

<p class=MsoNormal><span lang=EN-US>The next step after samples creation is
training of classifier. It is performed by the </span><span class=Typewch><span
lang=EN-US>haartraining</span></span><span lang=EN-US> utility.</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Command line arguments:</span><span
class=Typewch><span lang=EN-US> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- data &lt;dir_name&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> directory name in which the trained classifier is stored</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- vec &lt;vec_file_name&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> file name of positive sample file (created by </span></span><span
class=Typewch><span lang=EN-US>trainingsamples</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> utility or by any other means)</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- bg &lt;background_file_name&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> background description file</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- npos &lt;number_of_positive_samples&gt;,</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- nneg &lt;number_of_negative_samples&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> number of positive/negative samples used in training of each
classifier stage. Reasonable values are npos = 7000 and nneg = 3000.</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- nstages &lt;number_of_stages&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US> </span></span><span class=Typewch><span
lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>number of
stages to be trained</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- nsplits &lt;number_of_splits&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> determines the weak classifier used in stage classifiers. If </span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman"'>1</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'>, then a simple stump classifier is used, if </span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman"'>2</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> and more, then CART classifier with </span></span><span class=Typewch><span
lang=EN-US>number_of_splits</span></span><span class=Typewch><span lang=EN-US
style='font-family:"Times New Roman";font-weight:normal'> internal (split)
nodes is used</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- mem &lt;memory_in_MB&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> Available memory in MB for precalculation. The more memory you
have the faster the training process</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- sym (default),</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- nonsym</span></span><span class=Typewch><span
lang=EN-US style='font-family:"Times New Roman";font-weight:normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> specifies whether the object class under training has vertical
symmetry or not. Vertical symmetry speeds up training process. For instance,
frontal faces show off vertical symmetry</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- minhitrate &lt;min_hit_rate&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> minimal desired hit rate for each stage classifier. Overall hit
rate may be estimated as </span></span><span class=Typewch><span lang=EN-US>(min_hit_rate^number_of_stages)</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- maxfalsealarm &lt;max_false_alarm_rate&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> maximal desired false alarm rate for each stage classifier. </span></span><span
class=Typewch><span style='font-family:"Times New Roman";font-weight:normal'>Overall
false alarm rate may be estimated as</span></span><span class=Typewch><span
lang=EN-US> (max_false_alarm_rate^number_of_stages)</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- weighttrimming &lt;weight_trimming&gt;</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US> </span></span><span class=Typewch><span
lang=EN-US style='font-family:"Times New Roman";font-weight:normal'>Specifies
whether and how much weight trimming should be used. A decent choice is 0.90.</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- eqw</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- mode &lt;BASIC (default) | CORE | ALL&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> selects the type of haar features set used in training. BASIC use
only upright features, while ALL uses the full set of upright and 45 degree
rotated feature set. See [1] for more details.</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- w &lt;sample_width&gt;,</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- h &lt;sample_height&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> Size of training samples (in pixels). Must have exactly the same
values as used during training samples creation (utility </span></span><span
class=Typewch><span lang=EN-US>trainingsamples</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'>)</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US style='font-family:
"Times New Roman";font-weight:normal'>&nbsp;</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US style='font-family:
"Times New Roman";font-weight:normal'>Note: in order to use multiprocessor
advantage a compiler that supports OpenMP 1.0 standard should be used.</span></span></p>

<h2><span lang=EN-US>Application</span></h2>

<p class=MsoNormal><span lang=EN-US>OpenCV cvHaarDetectObjects() function (in
particular haarFaceDetect demo) is used for detection.</span></p>

<h3><span lang=EN-US>Test Samples</span></h3>

<p class=MsoNormal><span lang=EN-US>In order to evaluate the performance of
trained classifier a collection of marked up images is needed. When such
collection is not available test samples may be created from single object
image by </span><span class=Typewch><span lang=EN-US>createsamples</span></span><span
lang=EN-US> utility. The scheme of test samples creation in this case is
similar to training samples creation since each test sample is a background
image into which a randomly distorted and randomly scaled instance of the
object picture is pasted at a random position. </span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>If both </span><span class=Typewch><span
lang=EN-US>img</span></span><span lang=EN-US> and </span><span class=Typewch><span
lang=EN-US>info</span></span><span lang=EN-US> arguments are specified then
test samples will be created by </span><span class=Typewch><span lang=EN-US>createsamples</span></span><span
lang=EN-US> utility. The sample image is arbitrary distorted as it was
described below, then it is placed at random location to background image and
stored. The corresponding description line is added to the file specified by </span><span
class=Typewch><span lang=EN-US>info</span></span><span lang=EN-US> argument.</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>The </span><span class=Typewch><span
lang=EN-US>w</span></span><span lang=EN-US> and </span><span class=Typewch><span
lang=EN-US>h</span></span><span lang=EN-US> keys determine the minimal size of
placed object picture.</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>The test image file name format is as
follows:</span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US>imageOrderNumber_x_y_width_height.jpg</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'>, where </span></span><span class=Typewch><span lang=EN-US>x</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'>, </span></span><span class=Typewch><span lang=EN-US>y</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'>, </span></span><span class=Typewch><span lang=EN-US>width</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> and </span></span><span class=Typewch><span lang=EN-US>height</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> are the coordinates of placed object bounding rectangle.</span></span></p>

<p class=MsoNormal><span class=Typewch><span lang=EN-US style='font-family:
"Times New Roman";font-weight:normal'>Note that you should use a background
images set different from the background image set used during training.</span></span></p>

<h3><span class=Typewch><span lang=EN-US style='font-family:"Times New Roman"'>Performance
Evaluation</span></span></h3>

<p class=MsoNormal><span lang=EN-US>In order to evaluate the performance of the
classifier </span><span class=Typewch><span lang=EN-US>performance</span></span><span
lang=EN-US> utility may be used. It takes a collection of marked up images,
applies the classifier and outputs the performance, i.e. number of found
objects, number of missed objects, number of false alarms and other
information.</span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

<p class=MsoNormal><span lang=EN-US>Command line arguments:</span><span
class=Typewch><span lang=EN-US> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- data &lt;dir_name&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> directory name in which the trained classifier is stored</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- info &lt;collection_file_name&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> file with test samples description</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- maxSizeDiff &lt;max_size_difference&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'>,</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- maxPosDiff &lt;max_position_difference&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> determine the criterion of reference and detected rectangles
coincidence. Default values are 1.5 and 0.3 respectively.</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- sf &lt;scale_factor&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'>,</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> detection parameter. Default value is 1.2.</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- w &lt;sample_width&gt;,</span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US>- h &lt;sample_height&gt;</span></span><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> </span></span></p>

<p class=MsoNormal style='margin-left:17.1pt;text-indent:-17.1pt'><span
class=Typewch><span lang=EN-US style='font-family:"Times New Roman";font-weight:
normal'> Size of training samples (in pixels). Must have exactly the same
values as used during training (utility </span></span><span class=Typewch><span
lang=EN-US>haartraining</span></span><span class=Typewch><span lang=EN-US
style='font-family:"Times New Roman";font-weight:normal'>)</span></span></p>

<h2><span lang=EN-US>References</span></h2>

<p class=MsoNormal><span lang=EN-US>[1] Rainer Lienhart and Jochen Maydt. An
Extended Set of Haar-like Features for Rapid Object Detection. Submitted to
ICIP2002.</span></p>

<p class=MsoNormal><span lang=EN-US>[2] Alexander Kuranov, Rainer Lienhart, and
Vadim Pisarevsky. An Empirical Analysis of Boosting Algorithms for Rapid
Objects With an Extended Set of Haar-like Features. Intel Technical Report
MRL-TR-July02-01, 2002.</span></p>

</div>

</body>

</html>