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

TensorFlowで 趣味の画像収集サーバーを作る 4月号

TensorFlowで 趣味の画像収集サーバーを作る 4月号

TensorFlow勉強会(3)の発表資料です。

Ece52fe9ce913851256726020707febd?s=128

Keiji ARIYAMA

April 13, 2016
Tweet

Transcript

  1. C-LIS CO., LTD. #dltfb https://goo.gl/MX72Bc

  2. C-LIS CO., LTD.  ༗ࢁܓೋʢ,FJKJ"3*:"."ʣ C-LIS CO., LTD. AndroidΞϓϦ։ൃऀ ػցֶशॳ৺ऀ

    ΍ͬͯ·ͤΜ Photo : Koji MORIGUCHI (AUN CREATIVE FIRM)
  3. C-LIS CO., LTD.  IUUQGVLVZVLJOFUQPTU ;͘Ώ͖ϒϩά AlphaGoͷαʔόʔྉۚ͸࠷௿60ԯԁ!!? #dltfb

  4. C-LIS CO., LTD.  IUUQGVLVZVLJOFUQPTU ;͘Ώ͖ϒϩά AlphaGoͷαʔόʔྉۚ͸࠷௿60ԯԁ!!? #dltfb

  5. C-LIS CO., LTD. #dltfb

  6. 5FOTPS'MPXͰ
 झຯͷը૾ऩूαʔόʔΛ࡞Δ ݄̐߸ #dltfb https://goo.gl/MX72Bc

  7. C-LIS CO., LTD.  (%(,PCFʢBUେࡕ޻ۀେֶʣ

  8. C-LIS CO., LTD.  (%(,ZPUPʢBUۙـେֶʣ

  9. C-LIS CO., LTD.  "OESPJE#B[BBSBOE$POGFSFODFʢ੨ࢁֶӃେֶʣ Google TensorFlowͱAndroid͕ܨ͕Δະདྷ IUUQTTQFBLFSEFDLDPNLFJKJHPPHMFUFOTPSqPXUPBOESPJELBYJLBSVXFJMBJ

  10. C-LIS CO., LTD. ษڧձͰͷൃදςʔϚ  IUUQTHEHLPCFEPPSLFFQFSKQFWFOUT

  11. ޷Έͷ؟ڸ່ͬը૾ΛࣗಈͰऩू͍ͨ͠

  12. C-LIS CO., LTD. ࣮ݱΛ્Ή̏ͭͷน σʔλͷน ܭࢉྔͷน ػցֶशͷน 

  13. C-LIS CO., LTD. ࡞੒ͨ͠σʔληοτ ؟ڸ່ͬը૾ຕ ඇ؟ڸ່ͬը૾ຕ  ؟ڸ່ͬ ඇ؟ڸ່ͬ ޡݕग़

  14. C-LIS CO., LTD. $*'"34BNQMF ଟΫϥε෼ྨ  IUUQTXXXDTUPSPOUPFEV_LSJ[DJGBSIUNM

  15. C-LIS CO., LTD.  ̎Ϋϥε෼ྨ 1 0

  16. C-LIS CO., LTD. ΍ͬͨ͜ͱ ूΊͨσʔλΛ$*'"3ͷϑΝΠϧܗࣜʹ߹ΘͤͯQBDLͯ͠
 αϯϓϧϓϩάϥϜʹ༩͑ͨ  Label Red Green

    Blue 1 0 Label Red Green Blue 1 Label Red Green Blue 2 :
  17. C-LIS CO., LTD.  DJGBSQZͷϞσϧ ̎૚ͷંΓ৞ΈɾϓʔϦϯά૚ ̎૚ͷશ݁߹૚

  18. C-LIS CO., LTD. ݕূ݁Ռ ܇࿅σʔλ ςετσʔλ 1SFDJTJPO  ʙ

  19. C-LIS CO., LTD. ՝୊ ֶशʢςετʣσʔλͷॆ࣮
 ؟ڸͰ͸ͳ͘ɺΩϟϥΫλʔΛݟ͍ͯΔՄೳੑ͕͋Δ ൑ఆਫ਼౓Λ্͛Δ
 ʢάϥϑͷਂ૚Խʗύϥϝʔλʔௐ੔ʣ 

  20. άϥϑͷਂ૚Խ

  21. C-LIS CO., LTD. $*'"3ʹ͍ͭͯ
 ΘΕΘΕ͸΋ͬͱৄ͘͠஌Δඞཁ͕͋Δ  IUUQTXXXUFOTPSqPXPSHWFSTJPOTSUVUPSJBMTEFFQ@DOOJOEFYIUNM

  22. -PDBMMZ$POOFDUFE-BZFSJTԿ

  23. C-LIS CO., LTD. # local3 with tf.variable_scope('local3') as scope: #

    Move everything into depth so we can perform a single matrix multiply. dim = 1 for d in pool2.get_shape()[1:].as_list(): dim *= d reshape = tf.reshape(pool2, [FLAGS.batch_size, dim]) weights = _variable_with_weight_decay('weights', shape=[dim, 384], stddev=0.04, wd=0.004) biases = _variable_on_cpu('biases', [384], tf.constant_initializer(0.1)) local3 = tf.nn.relu(tf.matmul(reshape, weights) + biases, name=scope.name) _activation_summary(local3) # local4 with tf.variable_scope('local4') as scope: weights = _variable_with_weight_decay('weights', shape=[384, 192], stddev=0.04, wd=0.004) biases = _variable_on_cpu('biases', [192], tf.constant_initializer(0.1)) local4 = tf.nn.relu(tf.matmul(local3, weights) + biases, name=scope.name) _activation_summary(local4)  DJGBSQZ
  24. C-LIS CO., LTD. 

  25. C-LIS CO., LTD. 

  26. C-LIS CO., LTD.  "This kind of layer is just

    like a convolutional layer, but without any weight-sharing. That is to say, a different set of filters is applied at every (x, y) location in the input image. Aside from that, it behaves exactly as a convolutional layer." IUUQTDPEFHPPHMFDPNQDVEBDPOWOFUXJLJ-BZFS1BSBNT-PDBMMZ DPOOFDUFE@MBZFS@XJUI@VOTIBSFE@XFJHIUT
  27. C-LIS CO., LTD. Ͱɺ݁ہ -PDBMMZ$POOFDUFE-BZFSJTԿ ਫ਼౓্͕͕Δͷʁ ଎౓্͕͕Δͷʁ ͲΜͳ͍͍͜ͱ͕͋Δͷʁ 

  28. C-LIS CO., LTD. ંΓ৞Έ૚Λ૿΍ͯ͠Έͨ ˍύϥϝʔλʔΛௐ੔ # conv0
 with tf.variable_scope('conv0') as

    scope:
 kernel = _variable_with_weight_decay('weights', shape=[32, 32, 3, 32],
 stddev=1e-4, wd=0.0)
 conv = tf.nn.conv2d(images, kernel, [1, 1, 1, 1], padding='SAME')
 biases = _variable_on_cpu('biases', [32], tf.constant_initializer(0.0))
 bias = tf.nn.bias_add(conv, biases)
 conv0 = tf.nn.relu(bias, name=scope.name)
 _activation_summary(conv0)
 
 # pool0
 pool0 = tf.nn.max_pool(conv0, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1],
 padding='SAME', name='pool0')
 # norm0
 norm0 = tf.nn.lrn(pool0, 4, bias=1.0, alpha=0.001 / 9.0, beta=0.75,
 name='norm0')
 
 # conv1
 with tf.variable_scope('conv1') as scope:
 kernel = _variable_with_weight_decay('weights', shape=[16, 16, 32, 64],
 stddev=1e-4, wd=0.0)
 conv = tf.nn.conv2d(norm0, kernel, [1, 1, 1, 1], padding='SAME')
 biases = _variable_on_cpu('biases', [64], tf.constant_initializer(0.0))
 bias = tf.nn.bias_add(conv, biases)
 conv1 = tf.nn.relu(bias, name=scope.name)
 _activation_summary(conv1)
  29. C-LIS CO., LTD.

  30. C-LIS CO., LTD. લճͱಉ͡σʔλͰݕূ ૚Λ૿΍͢ʢύϥϝʔλʔΛௐ੔ʣͱ࠷ॳ͔Β
 ϩε཰͕෼ͷ̍ʹ௿Լͨ͠ɻ ୅ΘΓʹεςοϓʹ͔͔Δ͕࣌ؒ̏ഒʹͳͬͨɻ 

  31. σʔλͷॆ࣮

  32. C-LIS CO., LTD. ࡞੒σʔλ಺༁ ؟ڸ່ͬը૾ຕ  
 ඇ؟ڸ່ͬը૾ຕ  

    ؟ڸ່ͬ ඇ؟ڸ່ͬ ؟ڸ່ͬ ඇ؟ڸ່ͬ
  33. C-LIS CO., LTD. ݕূσʔλͷ෼ྨΛखͰߦ͏ ҰຕֆͷΩϟϥΫλʔʹݶఆ͢Δ
 ʢෳ਺ຕଘࡏ͠ʹ͍͘ֆΛબఆʣ  D ࠜઇΕ͍

  34. C-LIS CO., LTD. ࡞੒σʔλ಺༁ ܇࿅σʔλ  ςετσʔλ 

  35. C-LIS CO., LTD. ܇࿅σʔλը૾ʹϊΠζΛՃ͑ͯ૿ྔ ΅͔͠ Ψ΢γΞϯϊΠζ ΠϯύϧεϊΠζ 

  36. 

  37. C-LIS CO., LTD. ֶशͱݕূ ܇࿅σʔλ  ςετσʔλ 1SFDJTJPO 

  38. C-LIS CO., LTD. ໰୊ൃੜ ΦϑΟεͷαʔόʔϚγϯͷ(16͕࢖͑ͳ͘ͳΔ  $ python3 megane_co/cifar10_train.py I

    tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally Filling queue with 400 CIFAR images before starting to train. This will take a few minutes. E tensorflow/stream_executor/cuda/cuda_driver.cc:481] failed call to cuInit: CUDA_ERROR_NO_DEVICE
  39. C-LIS CO., LTD. ଎౓ͷൺֱ  $16 2016-04-13 10:40:51.188290: step 0,

    loss = 11.15 (65.8 examples/sec; 1.946 sec/batch) 2016-04-13 10:41:10.546296: step 10, loss = 10.67 (74.0 examples/sec; 1.731 sec/batch) 2016-04-13 10:41:29.646204: step 20, loss = 10.29 (74.0 examples/sec; 1.729 sec/batch) (16 2016-03-06 00:42:54.454566: step 90, loss = 10.39 (286.9 examples/sec; 0.446 sec/batch) 2016-03-06 00:42:59.533350: step 100, loss = 10.32 (290.1 examples/sec; 0.441 sec/batch) 2016-03-06 00:43:04.834940: step 110, loss = 10.27 (292.9 examples/sec; 0.437 sec/batch)
  40. ໰୊ൃੜ 

  41. (PPHMF$MPVE.BDIJOF-FBSOJOH

  42. C-LIS CO., LTD. (PPHMF$MPVE.BDIJOF-FBSOJOH ($1/&95Ͱൃද͞Εͨ
 Ϋϥ΢υϕʔεͷػցֶशϓϥοτϑΥʔϜ

  43. C-LIS CO., LTD. (PPHMF$MPVE.BDIJOF-FBSOJOH 1SPKFDU/BNFNFHBOF@DP 

  44. C-LIS CO., LTD. (PPHMF$MPVE.BDIJOF-FBSOJOH ฦࣄɺདྷͯ·ͤΜͰͨ͠ʂ 

  45. ͔͜͜Β͸$16ͷΈͰ͓ૹΓ͠·͢

  46. C-LIS CO., LTD. ݕূʢ৽Ϟσϧʴ৽σʔληοτʣ ܇࿅σʔλ  ςετσʔλ 1SFDJTJPO  ʙ

  47. C-LIS CO., LTD. 5SBJOJOHʢ৽Ϟσϧʴ৽σʔληοτʣ CBUDI 4UFQ 

  48. C-LIS CO., LTD. 5SBJOJOHʢچϞσϧʴچσʔληοτʣ CBUDI 4UFQ 

  49. C-LIS CO., LTD. ݕূʢچϞσϧʴ৽σʔληοτʣ ܇࿅σʔλ  ςετσʔλ 1SFDJTJPO  ʙ

  50. C-LIS CO., LTD. 5SBJOJOHʢچϞσϧʴ৽σʔληοτʣ CBUDI 4UFQ 

  51. C-LIS CO., LTD. ՝୊ ֶशʢςετʣσʔλʹదԠ͢ΔϑΟϧλʔͷ
 छྨͱڧ౓Λݕ౼ ൑ఆਫ਼౓Λ্͛Δɹˠɹ$*'"3ͷσʔλͰ֬ೝ
 ʢάϥϑͷਂ૚Խʗύϥϝʔλʔௐ੔ʗޡ൑ఆύλʔϯΛׂΓग़͢ʣ 

  52. C-LIS CO., LTD. ࣍ճ༧ࠂ 
 $MPVE7JTJPO"QJ5FOTPS'MPXษڧձ (%(,PCF  IUUQTHEHLPCFEPPSLFFQFSKQFWFOUT

  53. C-LIS CO., LTD. 5FOTPS'MPXΛ࢖ͬͨػցֶश͜ͱ͸͡ΊCZ5PSV6&/0:"."
 IUUQXXXTMJEFTIBSFOFU5PSV6FOPZBNBUFOTPSqPXHEH σΟʔϓϥʔχϯάͰ͓ͦদ͞Μͷ࿡ͭࢠ͸ݟ෼͚ΒΕΔͷ͔ʁɹʙ४උฤʙ
 IUUQCPIFNJBIBUFOBCMPHDPNFOUSZ ػցֶशͷσʔληοτը૾ຕ਺Λ૿΍͢ํ๏
 IUUQRJJUBDPNCPIFNJBOJUFNTDEGD
 5FOTPS'MPX


    IUUQTHJUIVCDPNUFOTPSqPXUFOTPSqPX  ࢀߟ
  54. C-LIS CO., LTD. C-LIS CO., LTD.

  55.  ຊࢿྉ͸ɺ༗ݶձࣾγʔϦεͷஶ࡞෺Ͱ͢ɻܝࡌ͞Ε͍ͯΔΠϥετ͸ɺಛʹهࡌ͕ͳ͍৔߹͸ࠜઇΕ͍ͷஶ࡞෺Ͱ͢ɻ ຊࢿྉͷશ෦ɺ·ͨ͸Ұ෦ʹ͍ͭͯɺஶ࡞ऀ͔ΒจॻʹΑΔڐ୚Λಘͣʹෳ੡͢Δ͜ͱ͸ې͡ΒΕ͍ͯ·͢ɻ 5IF"OESPJE4UVEJPJDPOJTSFQSPEVDFEPSNPEJpFEGSPNXPSLDSFBUFEBOETIBSFECZ(PPHMFBOEVTFE BDDPSEJOHUPUFSNTEFTDSJCFEJOUIF$SFBUJWF$PNNPOT"UUSJCVUJPO-JDFOTF ֤੡඼໊ɾϒϥϯυ໊ɺձ໊ࣾͳͲ͸ɺҰൠʹ֤ࣾͷ঎ඪ·ͨ͸ొ࿥঎ඪͰ͢ɻຊࢿྉதͰ͸ɺ˜ɺšɺäΛׂѪͯ͠ ͍·͢ɻ 5IF"OESPJESPCPUJTSFQSPEVDFEPSNPEJpFEGSPNXPSLDSFBUFEBOETIBSFECZ(PPHMFBOEVTFEBDDPSEJOH UPUFSNTEFTDSJCFEJOUIF$SFBUJWF$PNNPOT"UUSJCVUJPO-JDFOTF