Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DevFest Tokyo 2017 TensorFlow

ARIYAMA Keiji
October 08, 2017

DevFest Tokyo 2017 TensorFlow

DevFest Tokyo 2017で発表した「TensorFlowで
趣味の画像収集サーバーを作る 2017年10月号」の資料です。

SSD(Single Shot MultiBox Detector)によるイラスト顔検出について。

ARIYAMA Keiji

October 08, 2017
Tweet

More Decks by ARIYAMA Keiji

Other Decks in Technology

Transcript

  1. C-LIS CO., LTD. ༗ࢁܓೋʢ,FJKJ"3*:"."ʣ $-*4$0 -5% Photo : Koji MORIGUCHI

    (AUN CREATIVE FIRM) "OESPJEΞϓϦ։ൃνϣοτσΩϧ ػցֶश͸ͪΐͬͱ΍ͬͨ͜ͱ͋Γ·͢ ΍ͬͯ·ͤΜ
  2. γεςϜߏ੒  Downloader Face Detection Megane Detection ֬ೝɾमਖ਼ ೝࣝ݁Ռ JSON

    ֶशʢ܇࿅ʣ λΠϜϥΠϯ ϝσΟΞ σʔληοτ ֶशʢ܇࿅ʣ TensorFlow 
  3. { "generator": "Region Cropper", "file_name": "haruki_g17.png", "regions": [ { "probability":

    1.0, "label": 2, "rect": { "left": 97.0, "top": 251.0, "right": 285.0, "bottom": 383.0 } }, { "probability": 1.0, "label": 2, "rect": { "left": 536.0, "top": 175.0, "right": 730.0, "bottom": 321.0 } } ] } Region Cropper: https://github.com/keiji/region_cropper 
  4. ؟ڸ່ͬ൑ఆ conv 3x3x3 32 conv 3x3x32 64 max_pooling lrn conv

    3x3x64
 128 conv 3x3x128 128 max_pooling lrn conv 3x3x128
 128 conv 3x3x128 256 fc 384 fc 256 output 2 
  5. γεςϜߏ੒  Downloader Face Detection Megane Detection ֬ೝɾमਖ਼ ೝࣝ݁Ռ JSON

    ֶशʢ܇࿅ʣ λΠϜϥΠϯ ϝσΟΞ σʔληοτ ֶशʢ܇࿅ʣ TensorFlow 
  6. ࠲ඪͷਖ਼ଇԽɹਖ਼نԽ 888x613 left : 536 → 0.6036 top : 175

    → 0.2854 right : 730 → 0.8220 bottom : 321 → 0.5236 0.1092 ← 97 : left 0.4094 ← 251 : top 0.3209 ← 285 : right 0.6247 ← 383 : bottom 
  7. ը૾ͷϦαΠζɾάϨʔεέʔϧԽ 256x256 left : 0.6036 top : 0.2854 right :

    0.8220 bottom : 0.5236 0.1092 : left 0.4094 : top 0.3209 : right 0.6247 : bottom 
  8. Ϩίʔυߏ଄ <JNBHF>ը૾σʔλʢόΠτྻʣ <MBCFMT>       

      <SFHJPOT>
         
                             
     
  9. XJUIUGQZUIPO@JP5'3FDPSE8SJUFS PVUQVU@QBUI PQUJPOT BTXSJUFS FYBNQMFUGUSBJO&YBNQMF GFBUVSFTUGUSBJO'FBUVSFT GFBUVSF\ GJMF@OBNF@CZUFT@GFBUVSF GJMF@OBNFFODPEF 

    JNBHF@CZUFT@GFBUVSF JNBHF@EBUB  SFHJPO@DPVOU@JOU@GFBUVSF SFHJPO@DPVOU  SFHJPOT@GMPBU@GFBUVSF GMBUUFO@SFHJPOT  MBCFMT@JOU@MJTU@GFBUVSF MBCFMT  ^  XSJUFSXSJUF FYBNQMF4FSJBMJ[F5P4USJOH  
  10. Ϟσϧ conv 5x5x1
 128 batch_normalization conv 1x1x128
 64 conv 3x3x64


    64 batch_normalization conv 1x1x64
 128 ReLU conv 1x1x128
 128 conv 3x3x128
 128 batch_normalization conv 1x1x128
 128 ReLU conv 1x1x256
 256 conv 3x3x256
 256 batch_normalization conv 1x1x256
 128 ReLU conv 2x2x128
 128 fc 2048 fc 4 256x256x1 Residual block 1 Residual block 2 Residual block 3 × 3 × 3 × 3 avg_pool 2x2 avg_pool 2x2 avg_pool 2x2 ReLU Sigmoid 
  11. 256x256 left : 0.6036 top : 0.2854 right : 0.8220

    bottom : 0.5236 0.1092 : left 0.4094 : top 0.3209 : right 0.6247 : bottom ࠲ඪͷ஋Ҭʢʣ 
  12. 

  13. σʔλ಺༁  0 (18.57%) 1 (57.64%) 2 (11.93%) إͷ਺ ϑΝΠϧ਺

    ׂ߹ 0 3748 18.57% 1 11636 57.64% 2 2408 11.93% 3 844 4.18% 4 596 2.95% 5 325 1.61% 6 214 1.06% 7 108 0.53%
  14. إྖҬͷݕग़ dconv 3x3x1 64 dconv 3x3x64 64 dconv 3x3x256 128

    dconv 3x3x64 128 dconv 3x3x128 128 conv 3x3x1 64 conv 3x3x64 64 conv 3x3x128 256 conv 3x3x64 128 conv 3x3x128 128 
  15. إྖҬͷݕग़ʢ৞ΈࠐΈΦʔτΤϯίʔμʣ dconv 3x3x3 64 dconv 3x3x64 64 dconv 3x3x256 128

    dconv 3x3x64 128 dconv 3x3x128 128 conv 3x3x1 64 conv 3x3x64 64 conv 3x3x128 256 conv 3x3x64 128 conv 3x3x128 128 
  16. ৞ΈࠐΈ૚ͷΈʹͨ͠৔߹ conv 3x3x1 64 conv 3x3x64 64 conv 3x3x128 256

    conv 3x3x64 128 conv 3x3x128 128 dconv 3x3x3 64 dconv 3x3x64 64 dconv 3x3x256 128 dconv 3x3x64 128 dconv 3x3x128 128 
  17. ৞ΈࠐΈ૚ͷΈʹͨ͠৔߹ conv 3x3x64 stride 1 conv 3x3x64
 stride 1 ReLU

    ReLU conv 3x3x128
 stride 1 conv 3x3x128
 stride 1 ReLU conv 3x3x256
 stride 1 conv 3x3x256
 stride 1 ReLU conv 1x1x1
 stride 1 256x256x1 max_pool 2x2 stride 2 max_pool 2x2 stride 2 ReLU ReLU Sigmoid 29x29x1 
  18. ֤ηϧʹσʔλΛઃఆ  confidence : 1.0 center_x : 0.7128 center_y :

    0.4045 width : 0.2184 height : 0.2382 1.0 : confidence 0.2150 : center_x 0.5169 : center_y 0.2117 : width 0.2151 : height confidence : 0.0 center_x : 0.0 center_y : 0.0 width : 0.0 height : 0.0
  19. Ϩίʔυߏ଄ <JNBHF>ը૾σʔλʢόΠτྻʣ <CPY@MBCFMT>       

         <CPY@SFHJPOT>
                 
                             
     
  20. Ϟσϧ conv 3x3x64 stride 1 conv 3x3x64
 stride 1 ReLU

    ReLU conv 3x3x128
 stride 1 conv 3x3x128
 stride 1 ReLU conv 3x3x256
 stride 1 conv 3x3x256
 stride 1 ReLU conv 1x1x5
 stride 1 256x256x1 max_pool 2x2 stride 2 max_pool 2x2 stride 2 ReLU ReLU Sigmoid 29x29x5 
  21. ৞ΈࠐΈ૚ͷ໾ׂ conv 3x3x64 stride 1 conv 3x3x64
 stride 1 ReLU

    ReLU conv 3x3x128
 stride 1 conv 3x3x128
 stride 1 ReLU conv 3x3x256
 stride 1 conv 3x3x256
 stride 1 ReLU conv 1x1x1
 stride 1 256x256x1 max_pool 2x2 stride 2 max_pool 2x2 stride 2 ReLU ReLU Sigmoid 29x29x1 
  22. conv 3x3x64 stride 1 conv 3x3x64
 stride 1 ReLU ReLU

    conv 3x3x128
 stride 1 conv 3x3x128
 stride 1 ReLU conv 3x3x256
 stride 1 conv 3x3x256
 stride 1 ReLU 256x256x1 max_pool 2x2 stride 2 max_pool 2x2 stride 2 ReLU ReLU 29x29x256
  23. conv 3x3x256
 stride 2 conv 3x3x256
 stride 2 conv 3x3x256


    stride 2 conv 1x1x5
 stride 1 Sigmoid conv 1x1x5
 stride 1 conv 1x1x5
 stride 1 Sigmoid conv 1x1x5
 stride 1 Sigmoid conv 1x1x5
 stride 1 Sigmoid 1x1x5 15x15x5 8x8x5 2x2x5 4x4x5 29x29x256 conv 1x1x5
 stride 1 Sigmoid conv 3x3x256
 stride 2 conv 3x3x256
 stride 2 Sigmoid 29x29x5
  24. ֶशσʔλ  confidence : 1.0 center_x : 0.7128 center_y :

    0.4045 width : 0.2184 height : 0.2382 1.0 : confidence 0.2150 : center_x 0.5169 : center_y 0.2117 : width 0.2151 : height confidence : 0.0 center_x : 0.0 center_y : 0.0 width : 0.0 height : 0.0
  25. EFG@MBOE SFDU  XJEUISFDU<*/%&9@3*()5>SFDU<*/%&9@-&'5> IFJHIUSFDU<*/%&9@#0550.>SFDU<*/%&9@501> JGXJEUIPSIFJHIU SFUVSO SFUVSOXJEUI IFJHIU EFGKBDDBSE@PWFSMBQ

    SFDU SFDU  PWFSMBQ@MFGUNBY SFDU<*/%&9@-&'5> SFDU<*/%&9@-&'5>  PWFSMBQ@SJHIUNJO SFDU<*/%&9@3*()5> SFDU<*/%&9@3*()5>  PWFSMBQ@UPQNBY SFDU<*/%&9@501> SFDU<*/%&9@501>  PWFSMBQ@CPUUPNNJO SFDU<*/%&9@#0550.> SFDU<*/%&9@#0550.>  PWFSMBQ@MBOE <PWFSMBQ@MFGU PWFSMBQ@UPQ PWFSMBQ@SJHIU PWFSMBQ@CPUUPN>  VOJPO@MBOE SFDU  @MBOE SFDU PWFSMBQ SFUVSOPWFSMBQVOJPO 
  26. def _smooth_l1_loss(x): with tf.name_scope("smooth_l1"): abs_x = tf.abs(x) less_mask = tf.cast(abs_x

    < 1.0, tf.float32) return less_mask * (0.5 * tf.square(x)) + (1.0 - less_mask) * (abs_x - 0.5) def _loc_loss(logits, groundtruth): offset = logits - groundtruth return _smooth_l1_loss(offset) 
  27. /&("5*7&@$06/5@3"5& EFG@DBMD@MPTT@XJUI@IBSE@OFHBUJWF@NJOJOH MPTTFT QPTJUJWF@NBTL  QPTJUJWF@DPVOU  OFHBUJWF@DPVOUQPTJUJWF@DPVOU /&("5*7&@$06/5@3"5& CBUDI@TJ[FMPTTFTHFU@TIBQF

    <>WBMVF QPTJUJWF@MPTTFTMPTTFT QPTJUJWF@NBTL OFHBUJWF@MPTTFTMPTTFTQPTJUJWF@MPTTFT UPQ@OFHBUJWF@MPTTFT @UGOOUPQ@L UGSFTIBQF OFHBUJWF@MPTTFT  <CBUDI@TJ[F >  LUGDBTU OFHBUJWF@DPVOU UGJOU  MPTT UGSFEVDF@TVN QPTJUJWF@MPTTFTQPTJUJWF@DPVOU   UGSFEVDF@TVN UPQ@OFHBUJWF@MPTTFTOFHBUJWF@DPVOU  SFUVSOMPTT 
  28. EFGBVMUCPYͷಋೖ  left : 0.5000 top : 0.2500 right :

    0.7500 bottom : 0.5000 0.0000 : left 0.5000 : top 0.2500 : right 0.7500 : bottom
  29. EFGBVMUCPYͱ࠲ඪ  left : 0.5000 top : 0.2500 right :

    0.7500 bottom : 0.5000 0.0000 : left 0.5000 : top 0.2500 : right 0.7500 : bottom left : 0.6036 top : 0.2854 right : 0.8220 bottom : 0.5236 0.1092 : left 0.4094 : top 0.3209 : right 0.6247 : bottom
  30. EFGBVMUCPYͱ࠲ඪͷ ࠩʢP⒎TFUʣΛઃఆ  left : 0.6036 top : 0.2854 right

    : 0.8220 bottom : 0.5236 left : 0.1036 top : 0.0354 right : 0.0720 bottom : 0.0236 0.1092 : left -0.0906 : top 0.0709 : right -0.1253 : bottom 0.1092 : left 0.4094 : top 0.3209 : right 0.6247 : bottom
  31. ׆ੑԽؔ਺ͷมߋʢग़ྗ૚ʣ left : 0.1036 top : 0.0354 right : 0.0720

    bottom : 0.0236 0.1092 : left -0.0906 : top 0.0709 : right -0.1253 : bottom