TensorFlow-20160622

 TensorFlow-20160622

TensorFlow勉強会(4)の発表資料です。
技術書典で頒布する「TensorFlowはじめました」について。

Ece52fe9ce913851256726020707febd?s=128

Keiji ARIYAMA

June 22, 2016
Tweet

Transcript

  1. C-LIS CO., LTD.

  2. 5FOTPS'MPXͰ
 झຯͷը૾ऩूαʔόʔΛ࡞Δ ݄̒߸ #dltfb

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

    ΍ͬͯ·ͤΜ Photo : Koji MORIGUCHI (AUN CREATIVE FIRM) ͱɺݴ͍ͳ͕Βૣ൒೥……
  4. ޷Έͷ؟ڸ່ͬը૾ΛࣗಈͰऩू͍ͨ͠

  5. 4PGUXBSF%FTJHO೥݄߸ʰ"OESPJE4UVEJPͷελΠϧͰޮ཰ΞοϓʱΑΓ © ࠜઇΕ͍ ؟ ڸ ͬ ່

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

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

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

  9. 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
  10. C-LIS CO., LTD. 5FOTPS'MPXͰ(16͕࢖͑ͳ͍  https://blog.keiji.io/2016/05/cuda_error_no_device.html ֓ཁ ɹGPUϚγϯͰTensorFlowΛ࣮ߦ͢ΔࡍɺCUDA΋cuDNN΋ਖ਼ৗʹηοτΞοϓͰ͖͍ͯ ΔͷʹɺTensorFlow͕GPUΛೝࣝ͠ͳ͍ʢCUDA_ERROR_NO_DEVICE΍No GPU

    devices available on machine.͕දࣔ͞ΕΔʣ৔߹ɺਖ਼͍͠σΟεϓϨΠΧʔυɾυϥΠό͕Πϯε τʔϧ͞Ε͍ͯͳ͍Մೳੑ͕͋Γ·͢ɻ ɹචऀͷ؀ڥͰ͸ɺطଘͷυϥΠόʔΛΞϯΠϯετʔϧʢsudo apt-get remove --purge nvidia*ʣͯ͠ɺNVIDIAͷαΠτ͔ΒυϥΠόʔΛμ΢ϯϩʔυɾΠϯετʔϧ͢Δ͜ͱͰ GPUΛೝࣝ͢ΔΑ͏ʹͳΓ·ͨ͠ɻ
  11. C-LIS CO., LTD. ซͤͯಡΈ͍ͨ  5FOTPS'MPXPO%PDLFSͰ(16Λ࢖͑ΔΑ͏ʹ͢Δํ๏]גࣜձࣾΧϒΫ
 IUUQXXXLBCVLVDPKQEFWFMPQFSTFSSPSTXJUIUFOTPSqPXPOHQV /7*%*"%PDLFSͰ؆୯ʹ(16ରԠͷ5FOTPS'MPXೖΓίϯςφΛ࡞Δํ๏ ]NVPOPUFT
 IUUQXXXNVPKQOWJEJBEPDLFSUFOTPSqPXIUNM

  12. ಉਓࢽΛॻͩ͘

  13. ݸਓαʔΫϧʰΊ͕ͶΛ͔͚ΔΜͩʱ

  14. 

  15.  https://techbookfest.org/#A-28

  16. 

  17. ࣥච্ͷ՝୊

  18. C-LIS CO., LTD. ը૾ͷݖརؔ܎ ͦΕͧΕͷΠϥετʹஶ࡞ݖ͕ଘࡏ ࢿྉͰ࢖͏ʹ͸ڐ୚ΛऔΔඞཁ͕͋Δ  D ࠜઇΕ͍ ʢ˞ݸਓͷݟղͰ͢ʣ

  19. 

  20. 4PGUXBSF%FTJHO೥݄߸ʰ"OESPJE4UVEJPͷελΠϧͰޮ཰ΞοϓʱΑΓ © ࠜઇΕ͍ ؟ ڸ ͬ ່

  21. 

  22. $*'"3ʹؐΔ

  23. C-LIS CO., LTD. $*'"3 Ϋϥε෼ྨ ֶशσʔλ 
 ςετσʔλ  

    IUUQTXXXDTUPSPOUPFEV_LSJ[DJGBSIUNM
  24. 5FOTPS'MPX5VUPSJBM$*'"3

  25. C-LIS CO., LTD. νϡʔτϦΞϧʁ Ϟσϧ͸DVEBDPOWOFUϕʔε
 ৞ΈࠐΈɾϓʔϦϯά̎૚
 ہॴԠ౴ਖ਼نԽ૚
 શ݁߹૚̎૚ %BUB"VHNFOUBUJPOʢΫϦοϓɾࠨӈ൓సɾً౓ɾίϯτϥετʣ
 ന৭Խʢ8IJUFOJOHʣ

    ֶश཰ͱڞ༗ॏΈͷݮਰ ϛχόονֶशʢόοναΠζ γϟοϑϧόονʣ 
  26. ͔̍Β࡞ͬͯΈΑ͏ʂ

  27. 

  28. C-LIS CO., LTD.  ͞·͟·ͳࢪࡦͰ্͕Δೝࣝਫ਼౓ ہॴԠ౴ਖ਼نԽʢ-3/ʣ૚ͷ௥Ճ %BUBBVHNFOUBUJPOɾന৭Խʢ8IJUFOJOHʣ υϩοϓΞ΢τΛઃఆ͢Δ ϞσϧΛଟ૚ʹ͢Δ

  29. C-LIS CO., LTD.  ࣮ࡍʹ͸ʜʜ 0.10 0.10 0.10 0.10 0.10

    0.10 0.10 0.10 0.10 0.74 0.41
  30. C-LIS CO., LTD. 

  31. C-LIS CO., LTD. 

  32. C-LIS CO., LTD. 

  33. C-LIS CO., LTD. 

  34. C-LIS CO., LTD. def _export_graph(sess, epoch): constant_graph_def = graph_util.convert_variables_to_constants( sess,

    sess.graph_def, ["output/logits"]) file_path = os.path.join(FLAGS.graph_dir, 'graph_%02d_epoch.pb' % epoch) with gfile.FastGFile(file_path, 'wb') as f: f.write(constant_graph_def.SerializeToString())  άϥϑʴύϥϝʔλʔ with tf.gfile.FastGFile(graph_file, 'rb') as f: graph_def = tf.GraphDef() graph_def.ParseFromString(f.read()) _ = tf.import_graph_def(graph_def, name='')
  35. ॳߘͷ׬੒

  36. C-LIS CO., LTD. ϨϏϡΞʔͷօ͞ΜͷࢦఠΛ΋ͱʹ௚͢ ʮ5FOTPS'MPXͷಛ௃ʹฒྻ෼ࢄॲཧΛؚΊΔͷ͕ྑ͍ͱࢥ͍·͢ʯ ʮ͜ͷຊΛಡΉʹ౰ͨͬͯɺಡऀ͕஌͓͔ͬͯͳ͚Ε͹ͳΒͳ͍͜ͱ͸ͳΜͰ͠ΐ͏ ͔ʯ ʮ1ZUIPOܥͱޓ׵ੑΛอͭͨΊʹɺ͜ͷهड़Λ଍ͨ͠ํ͕ʜʜʯ ʮষͷऴ൫ͷҾ͖ͱɺ࣍ͷষͰ࿩୊͕ܨ͕ͬͯͳ͍Ͱ͢ʯ ʮ͕Μ͹Εʂ͕Μ͹Εʂͱ੠͕͚͢ΔͱɺԹ͔Έͷ͋ΔωοτϫʔΫʹͳΔ͸ͣ

    Ͱ͢ʯ FUDʜ 
  37. C-LIS CO., LTD.

  38. C-LIS CO., LTD.

  39. C-LIS CO., LTD.

  40. C-LIS CO., LTD.

  41. C-LIS CO., LTD. 3$͕Ͱͨ https://github.com/tensorflow/tensorflow/releases/tag/v0.9.0rc0 

  42. C-LIS CO., LTD.  ೝࣝਫ਼౓͸޲্͠ͳ͔͚ͬͨͲࢼͨ͜͠ͱ ࠷దԽΞϧΰϦζϜΛมߋ
 ʢ(SBEJFOU%FDFOU͔Β"EBN΁ʣ όοναΠζΛมߋ

  43. C-LIS CO., LTD.  ਂࠁͳܭࢉ࣌ؒͷ૿Ճ

  44. ϛχόονֶश

  45. C-LIS CO., LTD.  ܭࢉ͕࣌ؒେ෯ʹ୹ॖ

  46. C-LIS CO., LTD.  όοναΠζ Every 2.0s: nvidia-smi -l Thu

    Jun 16 17:23:25 2016 Thu Jun 16 17:23:25 2016 +------------------------------------------------------+ | NVIDIA-SMI 361.42 Driver Version: 361.42 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 960 Off | 0000:01:00.0 On | N/A | | 38% 57C P2 34W / 120W | 1916MiB / 2044MiB | 21% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 0 832 G /usr/bin/X 34MiB | | 0 18183 C python3 1867MiB | +-----------------------------------------------------------------------------+ Thu Jun 16 17:23:30 2016 +------------------------------------------------------+ | NVIDIA-SMI 361.42 Driver Version: 361.42 | |-------------------------------+----------------------+----------------------+
  47. C-LIS CO., LTD.  όοναΠζ Every 2.0s: nvidia-smi -l Fri

    Jun 17 20:40:45 2016 Fri Jun 17 20:40:45 2016 +------------------------------------------------------+ | NVIDIA-SMI 361.42 Driver Version: 361.42 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 960 Off | 0000:01:00.0 On | N/A | | 45% 73C P2 103W / 120W | 1917MiB / 2044MiB | 93% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 0 832 G /usr/bin/X 34MiB | | 0 24204 C python3 1867MiB | +-----------------------------------------------------------------------------+ Fri Jun 17 20:40:50 2016 +------------------------------------------------------+ | NVIDIA-SMI 361.42 Driver Version: 361.42 | |-------------------------------+----------------------+----------------------+
  48. (16ɺ࢓ࣄͯ͠ͳ͔ͬͨ

  49.  ݄̒25೔ʢ౔ʣ ळ༿ݪ ௨ӡձؗ ʰٕज़ॻయʱʹͯ൦෍༧ఆʂ ຊจ64p / ൦෍Ձ֨1,000ԁ https://techbookfest.org/#A-28 TensorFlowͷجૅ

    TensorFlowͱ͸ σʔλϑϩʔάϥϑ ม਺ͱϓϨʔεϗϧμʔ Tensorʢςϯιϧʣ TensorBoardʹΑΔάϥϑͷՄࢹԽ CIFAR-10ͷֶशͱධՁ σʔλͷಡΈࠐΈ ਪ࿦ʢinferenceʣ ֶशʢlearnʣ ධՁʢevaluateʣ σʔλอଘͱϑΟϧλʔͷՄࢹԽ ֶशσʔλͷอଘ ϑΟϧλʔͷՄࢹԽ CIFAR-10ฃಆه ਖ਼نԽ૚Λ௥Ճ͢Δ ܇࿅σʔλΛՃ޻͢Δ υϩοϓΞ΢τΛઃఆ͢Δ VGGNetͷϞσϧΛ࢖͏ ࠷దԽΞϧΰϦζϜΛมߋ͢Δ όοναΠζΛ૿΍͢ TensorFlow͸͡Ί·ͨ͠
 CIFAR-10 ฃಆه
  50. C-LIS CO., LTD. 5FOTPS'MPXΛ࢖ͬͨػցֶश͜ͱ͸͡ΊCZ5PSV6&/0:"."
 IUUQXXXTMJEFTIBSFOFU5PSV6FOPZBNBUFOTPSqPXHEH σΟʔϓϥʔχϯάͰ͓ͦদ͞Μͷ࿡ͭࢠ͸ݟ෼͚ΒΕΔͷ͔ʁɹʙ४උฤʙ
 IUUQCPIFNJBIBUFOBCMPHDPNFOUSZ ͗͢ΌʔΜϝϞ
 IUUQNFNPTVHZBODPN
 5FOTPS'MPX


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

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