Locating Facial Features with Active Shape Models

³¯«p¶v ¤ý®Ñ¤Z

«ü¾É±Ð±Â¡G¿à©|§»

1. ºK­n

³o¦¸±MÃDªº¤º®e¡A¬O¥HStephen Milborrow ªº STASM v1.5 [1] ¬°®Ö¤ß¥h¥[¥H§ï¨}¡A¦]¬°STASM v1.5 ³o­Óµ{¦¡¥D­n¬O°w¹ïµLªí±¡ªº¥¿¦V¤HÁy¥h§ä¥X¯S¼xÂI¡A¦b§PÂ_¤@¨Ç¤ñ¸û¸Ø±iªºªí±¡®É¤@¨Ç¯S¼xÂIªº·Ç½T²v¨Ã¤£¬O«Ü²z·Q¡A³o¦¸±MÃD¥D­n´N¬O§Æ±æ ¯à°÷´£°ª¦³ªí±¡¤HÁyªº¯S¼xÂI·Ç½T²v¡C

ÁÙ§â­ì¥»Command Lineªºµ{¦¡¥[¤W GUI¡A¨Ï¨ä¸û¬°®e©ö³Q¨Ï¥ÎªÌ¾Þ§@¡A¤]§ó®e©öÆ[¬Ýµ²ªG¡C¥t¥~ÁÙ°µ¤F¹ï³sÄò¼v¹³ªº³B²z¡A¹Á¸Õ¥hÁYµu³B²zªº®É¶¡¡C

2. STASM

2.1 STASM Version 1.5

STASM ªº¥þ¦W¬° Stacked Trimmed Active Shape Model ¬O Stephen Milborrow ¦b½×¤å [1] ¤¤©Ò´£¥X¨Óªº¤@­Ó¤èªk¥Î¥H§ä¥X¤HÁy¤¤ªº¯S¼xÂI¡C¦b½×¤å¤¤¦³¸Ô²Óªº¤¶²Ð»P»¡©ú¡A¦b³oÃä¨Ã¤£·|¸Ô­z¡C

¥H¤Wªººtºâªk¸`¿ý¦Û½×¤å [1] ªº Section 2.3¡A¥D­n´N¬O¨Ï¥Î Face Detector¡]Rowley [2] ©Î Viola Jones [3]¡^ §ä¨ì¤HÁyªº¦ì¸m¤§«á¡A·|®Ú¾Ú Training ¥X¨Óªº Models µ¹¥¦¤@­Ó Start Shape¡A¤§«á¦b±q³o­Ó Start Shape ¥h°µ Translation, Rotation, Scaling ¨Ï³o­Ó Shape ¥h²Å¦X©Ò¿é¤Jªº¤HÁy¡C

Figure 2 ´N¬O ASM Search ¹ê»Ú°õ¦æªº¹Lµ{¡A±q¤@¶}©lªº Shape ©¹¤HÁy¥h°µ¦¬ÀÄ¡C

2.2 STASM Version 1.5 ªºµ²ªG

¦bÆ[¹î¹L STASM ¹ï©ó¤@¨Ç¦³ªí±¡ªº¤HÁyªº°õ¦æµ²ªG¤§«áµo²{¡A¦³®É­Ô¯S¼xÂIªº»~®tÁÙ¤£¤p¡A¤ñ¸û©úÅ㪺³¡¦ì´N¬O¼L¤ÚªþªñªºÂI¡C

Figure 3 ¬°¤@²Õ Database ¤¤¡u§Ö¼Ö¡vªí±¡ªº¨ä¤¤´X±i¹Ï¡A¥i¥H¬Ý¥X¨Ó¡A¦b²´·ú¡B»ó¤l¸ò½ü¹øªºµ²ªG³£Áٺ⤣¿ù¡A»~®t¤ñ¸û¤jªº´N¥u¦³¦b¼L¤Úªþªñ¡A³o¬O¦]¬° STASM ­ì¥»ªº³]­p´N¬Oµ¹¡uµLªí±¡ªº¥¿¦V¤HÁy¡v°µ§PÂ_¥Îªº¡A©Ò¥H¦b§PÂ_ªí±¡¤ñ¸û¸Ø±iªº¤HÁy®É´N·|«Ü®e©ö²£¥Í»~®t¡C

Figure 4 ´N¬O¨S¦³ªí±¡ªº°õ¦æµ²ªG¡A¥i¥H¬Ý¥X¨Ó»~®t¤ñ°_ Figure 3 ¤p¤F¤£¤Ö¡C´î¤Ö¼L¤Úªþªñªº¯S¼xÂIªº»~®t´N¬O³o¦¸±MÃDªº¤@­Ó­«ÂI¡C

3. §ï¶i¤èªk

3.1 ¼L¨¤

¦b¼L¤Úªþªñªº¯S¼xÂI¤¤¡A§Ú­Ì¿ï¾Ü¥ý±q¼L¨¤¶}©l½Õ¾ã¡C¥ý¥H­ì¥»¯S¼xÂIªº®y¼Ð§ä¥X¥]§t¾ã­Ó¼L¤Úªº¤@­Ó¯x§Î¡]§Q¥Î­ì¥»ªº¨â­Ó¼L¨¤¥H¤Î»ó¤l³Ì¤U­±ªº¤@­ÓÂI¥i¥Hºâ¥X¯x§Îªºªø¸ò¼e¡^¡A¨Ã±N¨äÂà´«¬°¦Ç¶¥¼v¹³¡A¦p Figure 5¡C

¦A¹ï³o±i¹Ï°µ Histogram Stretch¡A§â¼v¹³¤¤ªº¦Ç¶¥­È½d³ò©Ô¨ì 0~255¡A¨Ï¨ä¹ï¤ñ§ó¥[©úÅã¡AFigure 6 ¬° Figure 5 °µ Histogram Stretch ªºµ²ªG¡C

¥Ñ Figure 6 ¥i¥H©úÅ㪺¬Ý¥X¨Ó¦b¾ã±i¼v¹³¤¤¡A¼L¨¤¬OÃC¦â³Ì²`ªº³¡¥÷¡A¬°¤F¨Ï¼L¨¤§ó©úÅã¡A§Ú­Ì¿ï¾Ü¦b 0~255 ¤§¶¡§ä¥X¤@­Ó Threshold ­È¡A¦Ç¶¥­È¤ñThreshold¤pªºÂI³£·|³Q³]¬° 0¡A¦Ó¤ñ Threshold¤jªº³£·|³Q³]¬°255¡A¦p¦¹¥i¥H§â¤@±i¦Ç¶¥¹ÏÂà´«¬°¤@±i¥u¦³¶Â¸ò¥Õ¨âºØÃC¦âªº Binary Image¡C

¦b¹ê°µ®É¡A§Ú­Ì¬O®Ú¾Ú Otsu ªººtºâªk [4] ¨Ó§ä¥X Threshold ­È¡C¸g¹L¹êÅ礧«áµo²{¡A¦pªGª½±µ¥Î­ì¥»ªº Threshold ¨Ó°µ Binary Image ªº¸Ü®ÄªG¨Ã¤£²z·Q¡A¸g¹L½Õ¾ã¡A³Ì«á¿ï¾Ü¥Î­ì¥» Threshold ªº¤@¥b¨Ó°µ Binary Image ®ÄªG·|¤ñ¸û¦n¡AFigure 7 ´N¬O³o­Óºtºâªk³B²z¤§«áªºµ²ªG¡C

¦b Figure 7 ¤¤¡A³Ì¥ª¤Î³Ì¥kÃ䪺ÂI¤À§O´N¬O¨âÃ䪺¼L¨¤¡A¦]¦¹¦b¹³ Figure 7 ³o¼Ëªº Binary Image ¤¤­n§ä¨ì¼L¨¤¡A¥u­n¤À§O±q³Ì¥ªÃä¸ò³Ì¥kÃä¶}©l¥Ñ¤W©¹¤U¤@¦æ¦æ§ä¡A©Ò§ä¨ìªº²Ä¤@­ÓÂI´N·|¬O¼L¨¤¡C

3.2 ¼L®B

§ä¨ì¤F¼L¨¤¤§«á¡A±µ¤U¨Ó­n­×¥¿ªº¬O¼L®B¡A¦b STASM ©Òµ¹ªº Model ¤¤¡A¼L®BÁ`¦@¦³16­ÓÂI¡A¦ý§Ú­Ì¹ê»Ú¥h­×¥¿ªº¥u¦³9­ÓÂI¡A¨ä¾lªºÂI³£¬O¥Î³o¤E­ÓÂI¥H¤Î¼L¨¤ªº¨â­ÓÂIªº¬Û¹ï¦ì¸m¥h¼Ð©w¥X¨Ó¡C

³o¤E­ÓÂI¤À§O¬O¤W¼L®Bªº¤W½t¡B¤W¼L®Bªº¤U½t¥H¤Î¤U¼L®Bªº¤W½t¦U¤T­Ó¡C¦]¬°¼L®BªºÃC¦âÅܤƨS¦³·Q¼L¨¤¨º»ò¦h¡A©Ò¥H¨S¦³¿ìªk«Ü²³æªº±q Binary Image ¤¤¬Ý¥X¨Ó¡C¦b³oÃä§Ú­Ì¬O¨Ï¥Î Gradient ¨ÓÆ[¹î¨Ã§ä¥X¼v¹³¤¤ªºÃä½t©Ò¦b¡CFigure 8 ¬°­ì¥»¼v¹³¥H¤Î¨ä Gradient ªº¹ï·Ó¹Ï¡C

¦b³oÃä¨Ï¥Îªº­pºâ Gradient ¤èªk¡A¦p Figure 9 ©Ò¥Ü¡AX ¤è¦Vªº¤À¶q¬O¥Î«á¤@¦æ°Å«e¤@¦æ¡AY ¤è¦Vªº¬O¥Î«á¤@¦C´î«e¤@¦C¡A³Ì«á¤@¦C»P³Ì«á¤@¦æ³£³]¬°0¡A³Ì«á¦A¨ú¥­¤è©Mªº¥­¤è®Ú¡C¦b Figure 8 ¤¤¥i¥H¬Ý¥X¨Ó¡AGradient ´N¬O¥Î¨Ó¥YÅãÃä½t¥Îªº¡AÃC¦âÅܤƶV¤jªº¦a¤è¦b Gradient ªº¼v¹³¤¤·|¶V©úÅã¡C

±µ¤U¨Ó§Ú­Ì´N¥i¥H¥Î­ì¥»¼L®Bªº®y¼Ð¦b³o±i Gradient Image ¤¤§ä¨ì·sªº®y¼ÐÂI¡C¥H¤W¼L®Bªº¤W½t¬°¨Ò¡A¥i¥H¨D¥X¤T­ÓÂIªº®y¼Ð¦b Gradient Image ¤¤ªº­È¡A¦A§â¥¦¥[°_¨Ó¡A´N¬O³o¤T­ÓÂIªº Gradient ¤§©M¡C¦b¤T­ÓÂIªº¬Û¹ï¦ì¸m¨S¦³§ïÅܪº±¡ªp¤§¤U¡A¨C¦¸©¹¤W²¾°Ê¤@­Ó Pixel ¦Aºâ¤@¦¸ Gradient ªº©M¡A¦b§ä¥X³o¨Ç©M¸Ì­±ªº³Ì¤j­È¡A´N¬O·sªº¤W¼L®B¤W½t¡C³o­Ó°j°éªº°õ¦æ¦¸¼Æ¬° Figure 5 ¤¤¯x§Î¤§°ªªº¤K¤À¤§¤@¡C¥H¦P¼Ëªº¤èªk¡A¨Ï¤W¼L®Bªº¤U½t¤]©¹¤W²¾°Ê¡A¦Ó¤U¼L®Bªº¤W½t¬O©¹¤U²¾°Ê¡A¦p¦¹´N¯à¨D±o·sªº®y¼Ð¡C

3.3 ¾ãÅé

­×¥¿§¹¼L¤Ú³¡¦ì¤§«á¡A±µ¤U¨Óªº¨BÆJ¬O¹ï©Ò¦³ªºÂI¡]¦@68­ÓÂI¡^¦A°µ¤@¦¸­×¥¿¡A­×¥¿ªº¤èªk¤]¬O°ò©ó Gradient Image¡C

¸ò¼L®Bªº¤èªkÃþ¦ü¡A³£¬O¥h§äªþªñ Gradient ­È¤ñ¦Û¤v¤jªºÂI§@¬°·s®y¼Ð¡C¦b³o­Ó³¡¥÷¡A·j´Mªº½d³ò¡A¬O¥H¨C­ÓÂI¬°¤¤¤ß¡A´M§ä¦b X¡Ó2¥H¤ÎY¡Ó2 ªº½d³ò¸Ì Gradient ­È¤ñ¦Û¤v¤jªºÂI¡A¥H¨ä§@¬°·s®y¼Ð¡C

¦b Figure 10 ¤¤¡A¥ªÃ䪺¹Ï¬O­ì¥»ªºµ²ªG¡A¥kÃä¬O­×¥¿¤§«áªºµ²ªG¡A¬Ý±o¥X¨Ó®t²§³Ì¦hªº³¡¦ì´N¬O¼L¤Ú¡A¤£¹L¦b³o±i¹Ï¤¤¤W¼L®Bªº³¡¦ìÁÙ¬O¤£°÷·Ç½T¡C

4. ²Î­pµ²ªG

Figure 11 ¬°¹ï¤@²Õ205±i¤HÁy¼v¹³ªº³B²zµ²ªG¡A¦]¬°¨C¤@±i¼v¹³³£¦³¤â°Ê¼Ð©wªº¯S¼xÂI¡A©Ò¥H´N¥H¦¹¬°°ò·Ç¨Ó¤ñ¸û­×¥¿«e«áªº®t²§¡C

¤â°Ê¼Ð©wªº¯S¼xÂI¦³83­Ó¡A¦ÓSTASM ªº¿é¥XÂI¦³68­Ó¡A¸g¹L¤ñ¸û¤§«á¡A§Ú­Ì¿ï¾Ü¤F46­ÓÂI¬°¥¦­Ìªº¥æ¶°¡A¬O¥H¤H¤u§PÂ_ªº¤è¦¡§ä¥X³o¨Ç¬Û¹ï¦ì¸m®t¤£¦hªº¯S¼xÂI¡A¤]´N¬O»¡¨S¦³¿ï¨ìªºÂI¬O¦]¬°¨S¦³¬Û¹ïÀ³ªºÂI¡C

Figure 11.1 ¬° newPointMean ¡V oriPointMean¡CnewPointMean ªº·N¸q¬°·s±o¨ìªº®y¼Ð»P¤â°Ê¼Ð©wªº®y¼Ð¤§¶ZÂ÷¡A¦Ó oriPointMean ¬°­ì¥» STASM ªº®y¼Ð»P¤â°Ê¼Ð©wªº®y¼Ð¤§¶ZÂ÷¡A¨âªÌ¬Û´î´N¬O­×¥¿«e«áªº®t¶Z¡C¹Ï¤¤ªº¾î¶b¤À§O¬°²Ä1~²Ä46­ÓÂI¡A¬Û¹ïÀ³ªºÁa¶b§Y¬°¸ÓÂIªº¥­§¡­×¥¿¶q¡A³æ¦ì¬° Pixel¡A¦pªG¤j©ó¹s´Nªí¥Ü­×¥¿«á¶ZÂ÷ÅÜ»·¡A¦Ó¤p©ó¹s´Nªí¥Ü­×¥¿«áªº¶ZÂ÷Åܪñ¡A³æ¦ì¬O Pixel¡C¥HFigure 11.1 ªº46­Ó­È¦Ó¨¥¡A¹ï©ó¨C­ÓÂI¥­§¡¤U¨Ó¬O­×¥¿¡]Åܪñ¡^¤F 0.02 ­Ó Pixel¡C

Figure 11.2 ¬° newPicMean ¡V oriPicMean¡CnewPicMean ªº·N¸q¬°­×¥¿¤§«á¡A¹ï©ó¨C±i¼v¹³¦Ó¨¥¡A·s±o¨ìªº®y¼Ð»P¤â°Ê¼Ð©wªº®y¼Ð¤§¥­§¡¶ZÂ÷¡A¦Ó oriPicMean ¥Nªíªº«h¬O­×¥¿¤§«eªº­È¡C¹Ï¤¤¾î¶b©Ò¥Nªíªº´N¬O²Ä1~²Ä205¼v¹³¡A¬Û¹ïÀ³ªºÁa¶b§Y¬°¸Ó¼v¹³ªº¥­§¡­×¥¿¶q¡A³æ¦ì¸ò Figure 11.1 ¤@¼Ë³£¬O Pixel¡C¦]¬°¬O¦P¤@¥÷¸ê®Æ°µªº²Î­p¡A©Ò¥H¥­§¡¤U¨Ó¤]¬O Ÿì0.02¡C

5. ¥[³t³sÄò¼v¹³ªº³B²z

³o³¡¥÷­n§ï¶iªº¬O¹ï©ó³sÄò¼v¹³ªº³B²z³t«×¡A¥iÀ³¥Î©óªí±¡°Ê§@¼v¹³ªº°lÂÜ¡C­ì¥»ªºµ{¦¡¬O§â¨C¤@±i¿é¤Jªº¼v¹³³£µø¬°¿W¥ßªº¡A¤À§O¹ï¥¦­Ì¥h°µ³B²z¡A©¼¦¹¤¬¤£¬Û¤z¡C¦pªG²{¦bªº¿é¤J¬O³sÄòªº¦n´X±i¼v¹³¡A¤]´N¬O³sÄòªº Frame ªº¸Ü¡A¹ï©ó¨C¤@±i¼v¹³³£·|°µ¤@¦¸ Figure 2 ªº¨BÆJ¡A±q³Ì¤@¶}©lªº Shape¥h°µ¦¬ÀÄ¡C

¦]¬°¬O³sÄòªº¼v¹³¡A©Ò¥H«e«á¨â±i Frame ªº®t²§¤£·|¤Ó¤j¡C°ò©ó³o­Ó·Qªk¡A§Ú­Ì¥t¥~´£¥X°w¹ï³sÄò¼v¹³ªº³B²z¤è¦¡¡C¤]¬O´N¥u¦³²Ä¤@­Ó Frame ·|±q¤@¶}©lªº Shape ¶}©l°µ¦¬ÀÄ¡A¦b²Ä¤@±i Frame ¤§«áªº¼v¹³¡A³£¬O¥Î«e¤@±i¼v¹³¦¬ÀĤ§«áªºµ²ªG§@¬°¨ä Start Shape¡C¥Î³o­Ó¤èªk¨Ó¬Ù²¤¤HÁy°»´ú¥H¤Î«e­±¦¬ÀĪº¨BÆJ¡A¤w¹F¨ì§ó§Öªº³B²z³t«×¡C

¦b³o­Ó¤èªk¤¤¡A§Ú­Ì¤]¥u­n¹ï²Ä¤@±i Frame °µ Face Detection¡A¤§«áªº Frame ³£¤£»Ý­n¦A°µ¦Ó¬Oª½±µ¥Î²Ä¤@±i Frame ªºµ²ªG¡C³o¼Ë³B²zªº®ÄªG¡A¦b¤HÁy¨S¦³¤Ó¤jªº¦ì²¾®É¬O¬Û·í¤£¿ùªº¡C

Figure 12 ¬O¹ï³sÄòªº12±i¼v¹³³B²z©Ò¤À§O¯Ó¶Oªº®É¶¡¡A²`¦â( Ind¡A¥Nªíªº¬OIndependent )ªº¬O­ì¥»ªº¤èªk¡A§â³o12±i¼v¹³µø¬°¿W¥ßªº¡A¤À§O¥h°µ³B²z¡C²L¦â( Seq¡A¥Nªíªº¬OSequential )ªº¬O¥Î¤W­z¤èªkªº°õ¦æµ²ªG¡C

¤£¬Ý²Ä¤@±i¼v¹³ªº¸Ü¡A¨ä¥Lªº¼v¹³¤j·§³£ÁYµu¤F30%~40% ªº®É¶¡¡AÁ`Åé¦Ó¨¥ÁYµu¤F29%ªº®É¶¡¡C²Ä¤@±i¼v¹³¦]¬°¨âºØ¤èªk©Ò°µªº³£®t¤£¦h¡A©Ò¥H®É¶¡¨S¦³¤Ó¤jªº®t¶Z¡C

¦Ü©ó¬°¤°»ò­ì¥»ªº¤èªk¤]·|¨Ï±o²Ä¤G­Ó¥H«áªº³B²z®É¶¡¤]ÁYµu¡A§Ú­Ì²q´ú¥i¯à¬O¦]¬°²Ä¤G­Ó¥H«áª½±µ¨Ï¥Î²Ä¤@­Óªº°O¾ÐÅéªÅ¶¡¡A¤£¥Î¦Aªá¤Ó¦h®É¶¡°t¸m¡A©Ò¥H¨Ï¦s¨úªº®É¶¡ÁYµu¡C

6. ¨Ï¥ÎªÌ¹Ï§Î¤¶­±

¦¹µ{¦¡ªº®Ö¤ß¬O STASM v1.5¡A¦Ó¹Ï§Î¤¶­±¬O­×§ï¦Û The Yovav (Horror) PictureShow Version 1.00 [5]¡C¦¹¥~ÁÙ¥[¤W¤@¨Ç¥i¥HÅý¨Ï¥ÎªÌ¿ï¾Üªº¿ï¶µ¡A¦p Figure 13 ªº¥k¹Ï©Ò¥Ü¡A¨Ï¥ÎªÌ¥i¥H¿ï¾Ü¿é¤Jªº¼v¹³ºØÃþ¡B¤HÁy°»´ú¾¹¡B¿é¥X°£¤F¼v¹³¤§¥~ÁÙ­n¤£­n¿é¥X¯S¼xÂIªº®y¼Ð¡C

7. µ²½×

¦]¬°¥Ø«e¥u¦³¾Ç¹L²³æªº¼v¹³³B²z§Þ¥©¡A±q²Î­p¤Wªºµ²ªG¨Ó»¡ÁöµM¬O¦³§ï¶i¡A¦ý¬O§ï¶iªº´T«×¨Ã¨S¦³«Ü¤j¡A¦pªG·Q­nÅý§PÂ_¯S¼xÂIªº·Ç½T«×¦³§ó©úÅ㪺´£°ª¡A´N­n¹ïµ{¦¡¶i¦æ¸û¤j³W¼Ò¥B¸û²`¤Jªº­×§ï¡A¹ï©ó²{¶¥¬qªº§Ú¦Ó¨¥¡A¥Ø«eÁÙ¨S¦³¯à¤O¸Ñ¨M¦¹°ÝÃD¡A³o­Ó°ÝÃD­nµ¥¨ì¥¼¨Ó°µ§ó²`¤Jªº¬ã¨s¤§«á¤~¦³¥i¯à¸Ñ¨M¡C

8. °Ñ¦Ò¸ê®Æ

[1]
S. Milborrow and F. Nicolls, Locating Facial Features with an Extended Active Shape Model. ECCV, 2008. http://www.milbo.users.sonic.net/stasm
[2]
Henry A. Rowley, Shumeet Baluja, and Takeo Kanade , Neural Network-Based Face Detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, volume 20, number 1, pages 23-38, January 1998.
[3]
Paul Viola, Michael Jones , Rapid Object Detection Using a Boosted Cascade of Simple Features , 2001.
[4]
Otsu, N., "A Threshold Selection Method from Gray-Level Histograms," IEEE Transactions on Systems, Man, and Cybernetics, Vol. 9, No. 1, 1979, pp. 62-66.
[5]
http://www.codeproject.com/KB/graphics/pictureshow.aspx