scieee Open visual document viewer

Design Methodology for Face Detection Acceleration

Acasandrei, Laurentiu; Barriga Barros, Ángel

Abstract

A design methodology to accelerate the face detection for embedded systems is described, starting from high level (algorithm optimization) and ending with low level (software and hardware codesign) by addressing the issues and the design decisions made at each level based on the performance measurements and system limitations. The implemented embedded face detection system consumes very little power compared with the traditional PC software implementations while maintaining the same detection accuracy. The proposed face detection acceleration methodology is suitable for real time applications.

Full text

Design Me hodology o Face De ec ion Accele a ion Lau en iu Acasand ei Ins i u o de Mic oelec onica de Se illa IMSE-CNM-CSIC Se illa, Spain lau en [email protected] Angel Ba iga Ins i u o de Mic oelec onica de Se illa/Uni . Se illa IMSE-CNM-CSIC/ Uni . Se illa Se illa, Spain [email p o ec ed] Abs ac —A design me hodology o accele a e he ace de ec ion o embedded sys ems is desc ibed, s a ing om high le el (algo i hm op imiza ion) and ending wi h low le el (so wa e and ha dwa e codesign) by add essing he issues and he design decisions made a each le el based on he pe o mance measu emen s and sys em limi a ions. The implemen ed embedded ace de ec ion sys em consumes e y li le powe compa ed wi h he adi ional PC so wa e implemen a ions while main aining he same de ec ion accu acy. The p oposed ace de ec ion accele a ion me hodology is sui able o eal ime applica ions. Keywo ds— ace de ec ion; embedded sys em; design me hodology; ha dwa e & so wa e codesign I. INTRODUCTION Face de ec ion is an impo an aspec o biome ics[1], ideo su eillance and human compu e [2] in e ac ion. De ec ion sys ems equi e huge compu a ional and memo y esou ces due o he complexi y o de ec ion algo i hms. A so wa e de ec ion ealiza ion implemen ed on a low speed, low esou ce, low powe SoC (Sys em on a Chip) i is no e icien . Ins ead a So wa e-Ha dwa e Codesign app oach can be used o build ha dwa e accele a o s o mos compu a ional consuming pa s o de ec ion algo i hms. Real ime ace de ec ion applica ion equi es a high amoun o mul iplie s and memo y esou ces unning a high speed. Due o high amoun o esou ces and high speed equi emen s a so wa e implemen a ion o he ace de ec ion algo i hm is no easible o a low speed, low esou ce, low powe SoC. Recen ly he e ha e been se e al ha dwa e ealiza ions ha accele a e he ace de ec ion p ocess by pa allelizing he de ec ion algo i hm. Thus some o he p oposals a e o speci ic ha dwa e ealiza ions on ASIC [3] while o he s a e implemen ed on FPGA [4-6]. Using he So wa e-Ha dwa e Codesign app oach we can accele a e he de ec ion p ocess by eplacing, wi h e y as dedica ed ha dwa e, some pa s o he so wa e ha usually consumes la ge amoun o clock cycles and/o memo y du ing he un ime. In [7] se e al pa s o he Viola-Jones de ec ion mechanism ha e been pa allelized in o de o un e icien ly on a GPU a chi ec u e. The pu pose o his communica ion is o desc ibe a design me hodology o accele a ing ace de ec ion applica ions. Taking in o conside a ion ha he OpenCV lib a y comes wi h wo baseline applica ions LBP (Local Bina y Pa e n) and Viola-Jones o ideo de ec ion, we ha e chosen Viola-Jones o de eloping a ace de ec ion applica ion o embedded sys ems. The same design me hodology is common o bo h algo i hms. The LBP and Viola-Jones ha e he same de ec ion mechanism, he only di e ence being in how o encode/decode he ea u es om an image. II. FACE DETECTION TECHNIQUE The ace de ec ion echnique is based on he ace de ec ion amewo k p oposed by Viola-Jones [8]. The p oposed amewo k is capable o p ocessing images ex emely apidly while achie ing high de ec ion a es. The speed o he ace de ec ion amewo k elies on h ee impo an key componen s. Fi s ly, he image is ans o med in o “In eg al Image” which allows he ea u es used by he de ec o o be compu ed e y quickly. Secondly, he used classi ie is simple and e icien which is build using he AdaBoos lea ning algo i hm [9] o selec a small numbe o c i ical isual ea u es om a e y la ge se o po en ial ea u es. And hi dly, he classi ie is o med by combining weak classi ie s in a “cascade” which allows backg ound egions o he image o be quickly disca ded while spending mo e compu a ion on p omising ace-like egions. Viola-Jones echnique is based on explo ing he image by means o a window looking o ea u es. This window is scaled o ind aces o di e en sizes. The sys em a chi ec u e is based on a cascade o de ec o s. The i s s ages consis o simple de ec o s, e y as and low cos , ha allows o elimina e hose windows ha do no con ain aces. In he successi e s ages he complexi y o de ec o s a e inc eased in o de o make a mo e de ailed analysis o ea u es. A ace is de ec ed only i i makes i h ough he en i e cascade. The Haa -like ea u es used by he classi ie consis o ec angula a eas whose p ocessing equi es simple a i hme ical ope a ions. The calcula ion is based on he sum o he pixels o each ec angula egion weighed by a weigh . A all scales, hese ea u es o m he “ aw ma e ial” ha will be used by he de ec o . The se o ec angle ea u es in he image is qui e la ge and o e comple e, so o educe ha numbe applies he AdaBoos lea ning algo i hm [9]. The Viola-Jones classi ie employs AdaBoos a each node in he cascade o lea n a high de ec ion a e a he cos o low ejec ion a e mul i ee (mos ly mul is ump) classi ie a each node o he cascade. To acili a e he p ocessing o he ea u es he ope a ions a e no made on he o iginal image bu on an in eg al image. The e o e he de ec ion algo i hm equi es a p ep ocessing s ep ha calcula es his in eg al image. The in eg a ion o he image consis s o adding o each pixel he alues o he p e ious pixels. III. DESIGN METHODOLOGY The s a ing poin o he design me hodology o he embedded sys em is he OpenCV’s Viola-Jones baseline ace de ec ion applica ion. OpenCV (Open Sou ce Compu e Vision), s a ed by In el in 1999, is a lib a y o p og amming unc ions o eal ime compu e ision [10]. OpenCV is eleased unde a BSD license and hence i is ee o bo h academic and comme cial use. I is w i en in C/C++ and was designed o compu a ional e iciency and wi h a s ong ocus on eal- ime applica ions. The hos a ge o he p oposed ace de ec ion sys em is an embedded en i onmen based on LEON3 AMBA Bus p ocesso . The LEON3 is a syn hesizable VHDL so co e o a 32-bi p ocesso complian wi h he SPARC V8 a chi ec u e [11]. The p ocesso is highly con igu able, and pa icula ly sui able o sys em-on-a-chip (SOC) designs. The ull sou ce code is a ailable unde he GNU GPL license. The p ocesso con ols and execu es he majo i y o so wa e applica ion asks while a speci ic IP (In ellec ual P ope y) module accele a e only hose asks ha equi e a high numbe o clock cycles. The design low is based on ou s ages, as shown in Figu e 1. In he i s s age an adap a ion o he so wa e applica ion o execu e on he embedded sys em has been made. In he nex s age an analysis o he new embedded so wa e applica ion is pe o med, in o de o de ec "bo lenecks" and hose asks ha a e sui able o accele a e h ough ha dwa e implemen a ion. In he hi d phase, as esul o he p e ious analysis, solu ions o op imize and accele a e some o he asks o he ace de ec ion p ocess will be p oposed. The ou h s age consis s in he ha dwa e implemen a ion o hose pa s ha consume a many esou ces and ha e la ge un imes. The idea is o o load o he ha dwa e he unc ions wi h a high deg ee o p ocessing and o pa allelize he execu ion o he de ec ion algo i hm. Wi h his he ace de ec ion p ocess can be d as ically accele a ed. Fig. 1. Design me hodology A each s age o he design p ocess he pe o mance o he ace de ec ion sys em is analyzed, in e ms o speed and de ec ion accu acy. The accu acy o ace de ec ion p ocess is analyzed using ROC (Recei e Ope a ing Cha ac e is ic) cu es. The ROC cu e o a gi en ace de ec o shows i s pe o mance as a ade-o be ween he alse accep ance a e and he ace de ec ion a e by a ying i s disc imina ion c i e ion (e.g. a h eshold pa ame e ). IV. EMBEDDED SOFTWARE FACE DETECTION IMPLEMENTATION Viola and Jones o ganized each boos ed classi ie g oup in o nodes o a ejec ion cascade. Each o he nodes con ains an en i e boos ed cascade o g oups o decision s umps (o ees) ained on he Haa -like ea u es om aces and non aces (o o he objec s he use has chosen o ain on). Typically, he nodes a e o de ed om leas o mos complex so ha compu a ions a e minimized (simple nodes a e ied i s ) when ejec ing easy egions o he image. Typically, he boos ing in each node is uned o ha e a e y high de ec ion a e (a he usual cos o many alse posi i es). When aining on aces, o example, almos all (99.9%) o he aces a e ound [12] bu many (abou 50%) o he non aces a e e oneously “de ec ed” a each node. Bu his is sa is ac o y because using, as an example, 20 nodes will s ill yield a ace de ec ion a e ( h ough he whole cascade) o 0.99920 ≈ 98% wi h a alse posi i e a e o only 0.520 ≈ 0.000001%! Du ing algo i hm execu ion, a sea ch window o di e en sizes is swep o e he o iginal image. In p ac ice, 70–80% o non aces a e ejec ed in he i s wo nodes o he ejec ion cascade, whe e each node uses abou en decision s umps. This quick and ea ly “a en ional ejec ” as ly speeds up ace de ec ion. The Haa -like ea u es a e ained o be applied o a e alua ing ec angula window o 20x20 pixel. Fo o he dimensions o he e alua ing window he Haa -like ea u es mus be scaled co espondingly. The OpenCV so wa e implemen a ion o ace de ec ion consis s o 22 cascade de ec o s, con aining 2135 Haa like ea u es. The i s ask o So wa e-Ha dwa e Codesign was adap ing and op imizing he OpenCV baseline applica ion o an embedded en i onmen . We ha e conside ed ha he majo i y o embedded en i onmen s a e capable o unning C/C++ applica ions wi h o wi hou Ope a ing Sys em (OS) suppo . This means ha he esul ing applica ion code has o be compa ible o bo h C, C++ compile s and in he same ime pla o m independen . Ano he conside a ion made is he ac ha mos o he SoC ha e no loa ing poin suppo . Fo i , he esul ing applica ion uses in ege ope a ions ins ead o loa ing poin ope a ions in o de o p ese e he gene ali y o he applica ion o he embedded sys em wo ld. An impo an momen in his s ep was inding an accep able scaling coe icien o he loa ing poin a iables and da a o in ege a iables and da a. A e ying di e en alues and compa ing he esul ed in ege applica ion wi h he loa ing poin applica ion we ound ha by scaling wi h 20 bi s (p ecision o 20 bi s o he loa ing poin decimals) he in ege and loa ing poin applica ions ob ain Pe o mance and de ec ion accu ac ya nalysis OpenCV So wa e Face De ec ion Applica ion Embedded So wa e Implemen a ion Embedded So wa e Anal y sis Algo i hm Op imiza ion Ha dwa e accele a ion iden ical esul s. Also he loa ing poin squa ed oo unc ion necessa y o calcula e a iance o he e alua ing window was eplaced wi h a as in ege squa ed oo e sion. In he end i was ob ained a ace de ec ion s and-alone applica ion compa ible wi h C/C++, using only in ege ype ope a ions and da a. V. EMBEDDED SOFTWARE FACE DETECTION ANALYSIS The nex s ep in applica ion de elopmen was analyzing di e en modes o de ec ion in o de o ind he un ime bo lenecks and op imize he de ec ion. Fo he embedded a ge we ha e decided o use he de ec ion mode whe e he de ec o (Haa -like ea u e) is scaled and he bigges egions con aining aces a e sea ched wi hin an image. In his mode he de ec ions s a s wi h he bigges e alua ion window and bigges e alua ion s ep and p og essi ely, he window oge he wi h he e alua ion s ep a e dec eased un il a egion con aining a ace is de ec ed. In he case ha a egion wi h ace o mul iple aces is de ec ed, he a en ion o he de ec o concen a es in ha egion. The ained classi ie cascade (Haa -like ea u e) is p o ided by OpenCV in an XML ile o ma . Using his XML o ma in an embedded sys em will p oduce memo y and un ime o e head. In o de o a oid he o e head we ha e de eloped an applica ion ha ecei es a XML ile, in e p e s he da a and sa es i in a simple o ma o a C heade ile. The esul ed embedded applica ion can be compiled wi h he cascade o classi ie o he da a can be ansmi ed du ing he execu ion o he applica ion ia an app op ia e in e ace. In o de o ob ain ele an insigh abou which pa s (o unc ions) o he ace de ec ion p og am a e aking mos o he execu ion ime we enable -gp lag in he Eclipse p ojec compila ion op ions in o de o gene a e p o iling in o ma ion ha can be in e p e ed wi h GNU gp o ool. This ool pe mi s one o lea n whe e he p og am spends i s ime and he unc ion calling ee du ing he execu ion. I can also ell which unc ions a e being called mo e o less han a e expec ed. Table I shows he ob ained esul s. As we can see he unc ion Se Ma Ze o() uses 24.64% o he execu ing ime e en su passing he ime spen applying he cascade Haa like- ea u es (20.16%) o he en i e image. The unc ion Se Ma Ze o() is used o se o ze o all he elemen s o a empo a y ma ix ha ing he same dimension o he image. In his ma ix he op le coo dina es o a de ec ed ace a e lagged wi h alue 1. In his mode he de ec ions s a s wi h he bigges e alua ion window and bigges s ep and p og essi ely, he window and he s ep a e dec eased un il a egion con aining a ace is de ec ed. The de ec ion is done in wo s eps:  Fi s S ep: The image is scanned wi h he e alua ion window by applying only he i s wo Haa -like ea u e s ages in o de o apidly de ec egions con aining po en ial aces. I a egion is ound o ha e a po en ial ace hen he coo dina es a e se o alue one in he empo a y ma ix.  Second s ep: Each po en ial ace (s a ing wi h hei coo dina es) om he empo a y ma ix is e alua ed wi h he emaining Haa -like ea u e s ages. I a ue ace is de ec ed hen he coo dina es, wid h and heigh a e s o ed in a lis . A he end o he second s ep, he empo a y ma ix is se o ze o in p epa a ion o he nex image whe e he e alua ing window has smalle dimensions. We can imp o e he speed by no using he unc ion Se Ma Ze o() a he end o he second s ep and ins ead each ime a e we ha e de ec ed a ace du ing he second s ep and ha ace is s o ed in o a lis , we se o ze o he coo dina es inside he empo a y ma ix. A e applying his change, he de ec ion ime is imp o ed wi h 24.64 %. TABLE I. ANALYSIS OF DETECTION SYSTEM BOTTLENECKS Time % # calls Func ion name 24.64 17 Se Ma Ze o() 20.16 3201 RunHaa Classi ie CascadeEmbedd() 14.81 16 Se ImagesFo Haa Classi ie CascadeEmbedd() 13.39 1 In eg al() 11.35 1 LinkDa aToEmbeddClassi ie Cascade() 4.22 511 HResizeLinea () 3.11 262144 sa u a e_ucha () 2.62 512 VResizeLinea () 1.80 296384 sum_elem_p () 1.10 3201 isq 64() VI. EMBEDDED FACE DETECTION OPTIMIZATION The OpenCV ace de ec ion baseline applica ion implemen s de ec ion in wo dis inc modes: Mode 1: Face de ec ion by scaling he image. In his mode he image is scaled using in e pola ion un il i eaches a p ede ined minimal dimension. Each ime he image is scaled he wo in eg al images (no mal= x and squa ed= 2 x), needed o a iance, a e ecalcula ed o he scaled image. The sea ch window has ixed dimension du ing he de ec ion p ocess. Mode 2: Face de ec ion by scaling he classi ie s. In his mode he in eg al images(no mal= x and squa ed= 2 x), needed o a iance, a e calcula ed only once o he o iginal image bu he Haa -Like ea u es o m he classi ie a e scaled p og essi ely un il hei dimensions a e close o he dimension o he o iginal window. This mode lacks he in e pola o used in mode 1. The sea ch window has a a iable dimension du ing de ec ion p ocess. In bo h de ec ion mode he Haa -like ea u es componen s (weigh s and dimensions) a e scaled p opo ionally wi h he dimensions o sea ch window. Tha means o a sea ch window o dimension WxH, he weigh o each ec angle o ming he Haa -like ea u es a e scaled wi h WxH. In he sea ch window, he sum o each applied Haa -like ea u e is calcula ed using:    3 1I scaled I I Sum Weigh A eaeHaa Fea u (1) A ea ep esen s he sum o all pixels inside a componen and I=1, 2 o 3 ep esen s he numbe o componen s o ha Haa -like ea u e. In o de o de e mine he nex weigh alue o he s age sum, each Haa Fea u eSum is compa ed wi h each no malized h eshold o he espec i e Haa -like ea u e as:         no m J Sum J Weigh J no m J Sum J Weigh J Th eseHaa Fea u i S ageS ageSum Th eseHaa Fea u i S ageS ageSum S ageSum , , 1 2 (2) whe e J=[1…2135] ep esen s he Haa -like ea u e indexes in a s age and Th es J no m=σTh esJ Haa Fea u e (σ is s anda d de ia ion o he windows sea ch a ea). I we do no scale he Haa -like ea u e weigh s and adjus he a iance compu a ion by using he o mula  )( 2 22   xxHW adjus ed  , i esul s ha he numbe o a i hme ic ope a ions (di ision, mul iplica ion) and memo y accesses a e dec eased subs an ially. This will make he algo i hm pe o m as e due o a educed numbe o ope a ions needed o compu a ion o he adjus ed a iance o he sea ch window [13]. Figu e 2 shows he p oposed op imiza ion o he de ec ion algo i hms in he wo de ec ion modes (scaling he image and scaling he classi ie s). Fig. 2. P oposed ace de ec ion accele a ion algo i hm In o de o compa e he pe o mance o he OpenCV 2.2 baseline ace de ec ion and he accele a ed Viola-Jones algo i hm, and o analyze he in luence o he con igu a ion pa ame e s, bo h implemen a ions ha e been compiled and speed op imized o 64 bi Win7 OS using Visual S udio 2010 P o esional edi ion. The e i ica ion PC has a Pen ium Dual- Co e CPU T4300, wi h L1 cache o 128KB, L2 uni ied cache 1024KB and he OS is Windows 7 Home Edi ion 64 bi s. Bo h implemen a ion (OpenCV’s implemen a ion and accele a ed Viola-Jones e sion) ha e ecei ed he same es VGA (640x480) images and he same con igu a ion pa ame e s. In Table II he con igu a ion ha e di e en scale ac o (s ) and minimum sea ch window dimensions (swd): s =1.1 and swd=20x20 (Con 1); s =1.2 and swd=20x20 (Con 2); s =1.1 and swd=30x30 (Con 3). TABLE II. P ERFORMANCES OF O PEN C V AND ACCELERATED V IOLA - J ONES IMPLEMENTATION FOR DIFFERENT PARAMETERS Mode 1. Img scaling Mode 2. Haa scaling OpenCV Baseline Op imized e sion OpenCV Baseline Op imized e sion Con 1 speed 708.8 ms 1.41 FPS 185.7ms 5.38FPS 843.9 ms 1.18FPS 188.1ms 5.3FPS Sea ch windows 602348 599816 697582 631343 Con 2 speed 409.5 ms 2.44FPS 164.8ms 6.06FPS 479.7ms 2.08FPS 140.1ms 7.1FPS Sea ch windows 354321 353935 381474 364635 Con 3 speed 348.1ms 2.87FPS 99.4ms 10FPS 456.7 ms 2.18FPS 130.6ms 7.6FPS Sea ch windows 352718 351184 402519 332917 As he p oposed implemen a ion has kep he con ol mechanism o sea ch windows iden ical wi h he one o m he OpenCV baseline i is di icul o make a compa ison wi h p e ious wo k done in accele a ing de ec ion due o he lack o se up in o ma ion and how many sea ch windows a e e alua ed. The e is one excep ion Cho e al [6] whe e hey use mode1 wi h a scaling ac o o 1.2, minimal sea ch window dimension o 20x20 and he sea ch window is applied wi h a e ical ho izon al s ep o 1. Table III shows he compa ison esul s. TABLE III. P ERFORMANCE OF THE O PEN CV BASELINE AND ACCELERATED V IOLA -J ONES USING THE C HO ET AL .[6] SETUP Implemen a ion Mode1-Image scaling Speed Sea ch Windows OpenCV 974.3 ms 1.02FPS 881484 Accele a e Viola-Jones 451.4 ms 2.21 FPS 880585 As shown in Tables II and III he numbe o sea ch windows depends hea ily on he con igu a ion se up and also o he con ol mechanism. Also measu ing he numbe o sea ched windows pe o med by he de ec ion sys em gi es mo e ealis ic in o ma ion abou he de ec ion pe o mance. The speeds ob ained by he accele a ed Viola-Jones implemen a ion in some con igu a ion a e as e ha any single GPU accele a ion [3], [7] and o he highes numbe o sea ch windows (Table III) i has close pe o mances o [3] and [7]. VII. HARDWARE ACCELERATION OF THE EMBEDDED FACE DETECTION SYSTEM A e a ca e ul analysis o he ace de ec ion applica ion i was ound ha he so wa e bo leneck esided in he huge amoun o memo y ead access, mul iplica ion, and squa ed oo ope a ions done by all he sea ch window e alua ions. In o de o de ec a ace om an image, hund eds o housands o sea ch windows a e e alua ed and his ep esen s he mos ime consuming pa o he applica ion. The e o e i was decided o accele a e he e alua ion o sea ch windows by employing a ha wa e IP module [14]. The p oposed IP module and all in e nal componen s a e clocked by he sys em clock (80 Mhz). In o de o keep a high deg ee o lexibly and sha e he ha dwa e esou ces wi h he es o he LEON3 sys em i was decided o he IMSE_OBJECT_DETECTION IP o ha e wo ope a ing modes: he ee mode in which LEON3 p ocesso can use he IP ha dwa e esou ces o implemen o he unc ionali ies, and he ace de ec ion mode. Figu e 3 shows he block diag am o he IP module. Fig. 3. IMSE_OBJECT_DETECTION IP block diag am As i was p e iously men ioned he IP module implemen s he sea ch window algo i hm. The so wa e applica ion will load he comp essed o m o Haa -like ea u es in o he Sha ed Memo y be o e any de ec ion ope a ion. Be o e s a ing any de ec ion ope a ion he con igu a ion egis e s (scale, x-y coo dina es, image dimension, e c.) mus be con igu ed wi h he desi ed con igu a ion alues. When he s a command is gi en he ace de ec ion p ocedu e is ully con olled by he componen Imse_s age_e alua o _uni (see Figu e 3). This uni is he co e engine o accele a ing ace de ec ion. A he end o he de ec ion he componen signalize i a ace is p esen , he S a us egis e is upda ed wi h he de ec ion esul and an in e up is gene a ed. The e alua o uni has a mul iple s a e machine con ol in o de o deal wi h a iable memo y access la encies. Beside he mul iple s a e machine con ol his uni con ains specialized modules. Haa _ ea u e_ ec _calc module is used o calcula e he a ea o in eg al ec angles using only he co ne s da a. Haa _ ea u e_scale is a pipelined module o Haa -like ea u e scaling and sea ch window add ess compu a ion. Sq 64_a ay_pipe16 is 64 bi pipelined in ege squa e oo uni ha has da a ou pu la ency o 16 clocks. Mul41x33signed is a 41x33 signed mul iplie . The Regis e Bank con ains APB bus accessible egis e s ha a e used o he co e con igu a ion and con ol. The APB Sla e In e ace connec s he IP module o he APB bus and enables he LEON3 p ocesso o access he egis e s om Regis e Bank. The AHB Mas e /Sla e In e ace is a simple DMA in e ace. The IP module has a sha ed memo y based on a dual-po RAM wi h AHB in e ace. The Sha ed Memo y is used by he IP module o s o e he comp essed Haa -like ea u es. When he module wo ks in “F ee Mode” LEON3 can use he Sha ed Memo y as addi ional on chip RAM memo y. VIII. RESULTS The p oposed LEON3 ace de ec ion sys em wo ks wi h images (colo ed o g ey) ha ing a esolu ion smalle han 1024x1024 pixels. I ully uses he OpenCV cascade o classi ie s o on al aces and i can s o e in o he IP Sha ed Memo y app oxima ely 2730 Haa -like classi ie s. I also wo ks wi h a g ea e numbe o Haa -like classi ie s bu he ex a classi ie s mus be s o e in o he p og am memo y and hen loaded in o he Sha ed Memo y a he app op ia e momen . The sys em was implemen ed on a Xilinx XC5VLX50 FPGA. The en i e LEON3 ace de ec ion sys em uses 6,435 slices (up o 89% o he de ice u iliza ion) and 10,962 o lip- lops (up o 38% o he de ice u iliza ion). The es ima ed s a ic powe consump ion (measu ed wi h Xpowe Analyze om Xilinx) o he LEON3 co e is 603 mW. The mos powe consuming componen s a e he DDR2 memo y con olle (216 mW), DVI in e ace (136.06 mW) and he clock gene a o s. The LEON3 p ocesso consumes 32.39 mW and e en hough he IMSE_OBJECT_DETECTION IP uses mo e lip lops and has app oxima ely he same amoun o logic, i s powe consump ion is 6 imes less (5.39 mW) han he LEON3 p ocesso . A. Pe o mance In o de o measu e he de ec ion pe o mances o he LEON3 embedded de ec ion sys em h ee dis inc so wa e implemen a ions o ace de ec ion we e compa ed:  Po ed OpenCV so wa e o embedded sys ems.  So wa e accele a ed e sion o he po ed so wa e.  Ha dwa e + So wa e accele a ed e sion o he po ed so wa e. The measu ed pe o mances me ics a e he execu ion ime and he numbe o sea ched windows pe o med. Fo he i s wo implemen a ions he pe o mances we e measu ed o wo dis inc modes o de ec ion (mode 1 and mode 2). Fo each mode, ou di e en se -up pa ame e s we e used (se up 1 o 4) o he minimum size sea ch window (S) and he scale s ep (s ep): 1) S=30x30, s ep=1.2; 2) S=30x30, s ep=1.1; 3) S=20x20, s ep=1.2; 4) S=20x20, s ep=1.1. F om Figu e 4 i esul s ha he accele a ed ace de ec ion applica ion is 3-4 imes as e han he po ed OpenCV applica ion o bo h modes. Using he ha dwa e accele a ion IP he ace de ec ion is 10-12 imes as e han he po ed ace de ec ion applica ion unning exclusi ely on LEON3 p ocesso co e. Fig. 4. De ec ion imes o h ee dis inc implemen a ions o VGA image. a) Scale Image mode (Mode 1), b) Scale Haa -like ea u es mode (Mode 2) B. De ec ion Accu acy In o de o analyze he de ec ion accu acy an speci ic so wa e has been de eloped. The PC based es bench so wa e con igu es LEON3 based de ec ion sys em and send he es images. Then i ecei es he de ec ion esul s o u he analysis. The es se up is based on 2409 on al ace images om he colo FERET da abase [15]. The accu acy o ace de ec ion can be desc ibed using ecei e ope a ing cha ac e is ic (ROC), which is a cu e widely adop ed in signal-de ec ion heo y. An ROC is essen ially a sca e plo ha shows he ela ionship be ween he alse accep ance a e and he ue accep ance a e. Because he numbe o e alua ed nega i e egions is e y high o de ec ion algo i hms, o analysis, i was adop ed a modi ied e sion o ROC cu e in oduced in FDDB[16] in which he ho izon al axis con ains only alse posi i e o he en i e es image se . Figu e 5 shows he ROC cu es o OpenCV so wa e and he IP module. Bo h ha e e y simila esul s. The e is a small di e ence be ween he wo ROC cu es because he da a esul (i.e de ec ed aces) agg ega ion mechanism is sligh ly di e en in he analysis ools. (a) (b) Fig. 5. ROC cu es: a) OpenCV ace de ec ion so wa e, b) IMSE_OBJECT_DETECTION IP based sys em IX. CONCLUSIONS This communica ion p esen s a design me hodology o ace de ec ion embedded implemen a ion. The s a ing poin was OpenCV lib a y esou ces o ideo ace de ec ion. Fo i some modi ica ions has been make adap ing and op imizing he OpenCV baseline applica ion o an embedded en i onmen . This modi ica ions can be summa ized in changing he loa ing poin ope a ions by in ege ones, analyzing he pe o mance in o de o de ec he sys em bo lenecks, and algo i hmic speed- up by no scaling he Haa -like ea u e weigh s and adjus ing he compu a ion o a iance. Finally, hose asks equi ing a g ea e compu a ion a e implemen ed in ha dwa e, accele a ing he ace de ec ion p ocess, and enabling i s applica ion in embedded sys ems ha equi e eal ime. ACKNOWLEDGEMENT This wo k was suppo ed in pa by Spanish Minis e io de Ciencia y Tecnología unde he P ojec TEC2011-24319, and by Jun a de Andalucía unde he P ojec P08-TIC-03674. Co- inanced by FEDER. REFERENCES [1] K. Suzuki, J. Kobayashi, T. Takeshima; K. Yamada, "De ec ion o unusual acial exp ession o human suppo sys ems," 34 h Annual Con e ence o IEEE Indus ial Elec onics. IECON 2008, pp.3414,3418, 10-13 No . 2008. [2] M. Pasche o, G. Del Vesco o, L. Benucci, A. Rizzi, M. San ello, G. Fabb i, F.M.F. Mascioli, "A eal ime classi ie o emo ion and s ess ecogni ion in a ehicle d i e ," IEEE In e na ional Symposium on Indus ial Elec onics (ISIE), pp.1690,1695, 28-31 May 2012. [3] T. Teocha ides, N. Vijayk ishnam, M.J. I win, “A Pa allel A chi ec u e o Ha dwa e Face De ec ion”, P oc. IEEE Compu e Socie y Annual Symposium Eme ging VLSI Technologies and A chi ec u es, pp. 452- 453, 2006. [4] V. Nai , P.O. Lap ise, J.J. Cla k, “An FPGA-Based People De ec ion Sys em”, EURASIP Jou nal on Applied Signal P ocessing, pp. 1047- 1061, 2005. [5] C. Gao, S.L. Lu, “No el FPGA Based Haa Classi ie Face De ec ion Algo i hm Accele a ion", P oc. In e na ional Con e ence on Field P og ammable Logic and Applica ions, 2008. [6] J.Cho, S. Mi zaei, J. Obe g, R. Kas ne , “FPGA-Based Face De ec ion Sys em Using Haa Classi ie s”, P oc. ACM/SIGDA In e na ional Symposium on Field P og ammable Ga e A ays (FPGA'09), pp. 103- 112, 2009. [7] D. He enb ock, J. Obe g, N.T.N. Thanh, R. Kas ne , S.B. Baden, “Accele a ing Viola-Jones Face De ec ion o FPGA-Le el using GPUs”, P oc. IEEE Annual In e na ional Symposium on Field-P og ammable Cus om Compu ing Machines, 2010. [8] P. Viola, M.J. Jones, “Robus Real-Time Face De ec ion”, In e na ional Jou nal o Compu e Vision, .57 n.2, pp.137-154, May 2004. [9] R.E. Schapi e, Y. F eund, P. Ba le , W.S. Lee, “Boos ing he Ma gin: A New Explana ion o he E ec i eness o Vo ing Me hods”, The Annals o S a is ics, pp. 1651-1686, 1998. [10] OpenCV, link: h p://sou ce o ge.ne /p ojec s/openc lib a y/ [11] LEON3, link: h p:// www.gaisle .com/ [12] G. B adski, A. Kaehle , “Lea ning OpenCV”, O’Reilly Media, pp.506- 516, Sep embe 2008. [13] L. Acasand ei, A. Ba iga: “Accele a ing Viola-Jones Face De ec ion o Embedded and SoC En i onmen s”, Fi h ACM/IEEE In e na ional Con e ence on Dis ibu ed Sma Came as (ICDSC’2011), Ghen , Belgium, Aug. 2011. [14] L. Acasand ei and A. Ba iga: ‘FPGA implemen a ion o an embedded ace de ec ion sys em based on LEON3’, In . Con . on Image P ocessing, Compu e Vision, and Pa e n Recogni ion, Jul. 2012. [15] P.J. Phillips, H. Wechsle , J. Huang, P. Rauss: "The FERET da abase and e alua ion p ocedu e o ace ecogni ion algo i hms," Image and Vision Compu ing J, Vol. 16, No. 5, pp. 295-306, 1998. [16] J. Vidi and E.L. Mille : "FDDB: A Benchma k o Face De ec ion in Uncons ained Se ings", Technical Repo UM-CS-2010-009, Dep . o Compu e Science, Uni e si y o Massachuse s, 2010. a) b)