【再々開催】Raspberry_PiとUSBカメラで_はじめようディープラーニング20191207

88dae28e3d082236f37db2f5c2db339d?s=47 Miho Yamada
December 07, 2019

 【再々開催】Raspberry_PiとUSBカメラで_はじめようディープラーニング20191207

ももち浜TECHカフェ
「【再々開催】Raspberry_PiとUSBカメラで_はじめようディープラーニング20191207」

ももち浜TECHカフェは福岡市ももち浜から発信する、IoT・AR・VRなどをテーマにしたハンズオン企画です。
今回のテーマはRaspberry Pi & 機械学習・ディープラーニング。追加開催版です。

Raspberry Piはイギリスのラズベリーパイ財団が開発しているシングルボードタイプのコンピュータです。安価で小型なためIoT機器への組込み・プロトタイピング等で日本でも趣味・業務問わず広く普及が進んできています。

今回は、そんなRaspberry PiとUSBカメラを使って、機械学習やディープラーニングの初歩を学んでいただけます。

88dae28e3d082236f37db2f5c2db339d?s=128

Miho Yamada

December 07, 2019
Tweet

Transcript

  1. 3BTQCFSSZ1Jͱ 64#ΧϝϥͰ͸͡ΊΑ͏ σΟʔϓϥʔχϯά 

  2. ࣗݾ঺հ .BLF-4* 73"3 ࢁాඒึʢ΍·ͩΈ΄ʣ ɾʮ*P5Λ΋ͬͱ਎ۙʹɺ΋ͬͱָ͘͠ɻະདྷ΁ʯ ɹɹͰ͓ͳ͡Έͷɺגࣜձࣾ$FOUFS2୅දऔక໾ ɾʮ*P5ओ්ʯͱ໊৐͍ͬͯ·͢ ɾঁࢠͩΒ͚ͷిࢠ޻࡞ओ࠵ ɾझຯɿϋϯζΦϯ΍ษڧձʹࢀՃ͢Δ͜ͱɻ ɹ

  3. ΈΜͳͷࣗݾ঺հλΠϜ ̍ʣ໊͓લ ̎ʣԿΛ͍ͯ͠Δਓ͔ ̏ʣࠓ೔ͷϞνϕʔγϣϯ

  4. ຊ೔ֶΜͰ͍͚ͨͩΔ͜ͱ ̍ʣRaspberryPiͷجૅ஌ࣝ ̎ʣσΟʔϓϥʔχϯάʹඞཁͳϥΠϒϥϦʔ౳ͷΠϯετʔϧखॱ ̏ʣσʔληοτMNISTΛ࢖ͬͨखॻ͖ೝࣝจࣈ ̐ʣRaspberryPiͰUSBΧϝϥΛ࢖͏खॱ ̑ʣֶशࡁΈϞσϧInceptionV3Λ࢖ͬͨը૾ೝࣝ ̒ʣը૾Λ࢖ͬͯσΟʔϓϥʔχϯά(CNN)ͤ͞Δϓϩηε

  5. 3BTQCFSSZ1Jͱ 64#ΧϝϥͰ͸͡ΊΑ͏ σΟʔϓϥʔχϯά

  6. 3BTQCFSSZ1JͷجૅΛֶͿ 3BTQCFSSZ1Jͷछྨ

  7. 3BTQCFSSZ1JͷجૅΛֶͿ 3BTQCFSSZ1Jͷछྨ ͋ͨΒ͘͠ ൃച͞Ε·ͨ͠ʂ ൢചՁ֨͸ ԁʙ

  8. ٕదະऔಘػثΛ༻͍࣮ͨݧ౳ͷ ಛྫ੍౓ͷਃ੥͖ͯ͠·ͨ͠ʂʂ

  9. ຊ೔ͷ࢖༻ػث 3BTQCFSSZ1JͷجૅΛֶͿ 3BTQCFSSZ1Jͷछྨ

  10. ຊ೔࢖༻͢Δ3BTQCFSSZ1J.PEFM#͸ ɹ"3.$PSUFY"ʢίΞɺ()[ʣ ɹ #SPBEDPN#$.  ετϨʔδɹNJDSP4% ɹ64#Y )%.*º -"/#"4&5 ɹΦʔσΟΦɹNNεςϨΦ

    ɹిݯɹ7ʗ"ʢ64#NJDSP#ʣ ɹେ͖͞ɹºNN ɹ8J'J͸()[ଳͷΈ࢖༻Ͱ͖·͢ɻ 3BTQCFSSZ1JͷجૅΛֶͿ 3BTQCFSSZ1J̏.PEFM#ͱ͸ ˞3BTQCFSSZ1J͸օ͞Μ͕࢖͍ͬͯΔ1$ΑΓ൓Ԡ଎౓͕ͱͯ΋஗͍Ͱ͢ɻ ɹʢ͙͢൓Ԡ͠ͳ͍͔ΒͱԿ౓΋ΫϦοΫͨ͠ΓίϚϯυΛ࠶౓ೖྗ͠ͳ͍ʣ
  11. https://www.raspberrypi.org/ 3BTQCFSSZ1Jެࣜϖʔδ ֤छΠϯετʔϧ΍࢖͍ํͳͲϥζύΠͷ࠷৽৘ใ͸ͪ͜ΒΛνΣοΫ͠·͢ɻ 3BTQCFSSZ1JͷجૅΛֶͿ

  12. https://www.raspberrypi.org/downloads/ ࠓճͷηϛφʔͰ͸ طʹ04͕Πϯετʔϧ ͞ΕͨNJDSP4% (# Λ ࢖͍·͢ɻ ͳͷͰΠϯετʔϧͷ ࡞ۀ͸ෆཁͰ͢ɻ ϥζύΠ͸3BTQCJBOʢϥζϏΞϯʣͱ͍͏-JOVYܥͷ04Λ࢖ͬͯಈ͔͠·͢ɻ

    /00#4 ψʔϒεʣͱ͍͏04ͷΠϯετʔϥʔΛ࢖͏ͱศརͰ͢ɻ 3BTQCFSSZ1Jͷ04ʹ͍ͭͯʢNJDSP4% 3BTQCFSSZ1JͷجૅΛֶͿ
  13. 3BTQCFSSZ1JͱσΟʔϓϥʔχϯάͰͲΜͳ͜ͱ͕Ͱ͖Δͷʁɹɹ ͖Ύ͏Γͷ඼࣭൑ผ ͔Β͋͛ͷ഑હ

  14. ख़࿅ͨ͠ਓͷϊ΢ϋ΢ˠࣗಈԽ ˁ ͦΕͰ͸ɺ͓଴ͨͤ͠·ͨ͠ʂ ϥζύΠΛҰॹʹ४උ͍͖ͯ͠·͠ΐ͏ʂ Έͳ͞Μ͸ɺԿΛͭ͘Γ·͔͢ʁ

  15. ຊ೔ͷ3BTQCFSSZ1Jपลػثߏ੒ͱ઀ଓ֬ೝ 3BTQCFSSZ1J̏.PEFM# 64#ΩʔϘʔυ 64#Ϛ΢ε 64#Χϝϥ )%.* σΟεϓϨΠ ిݯ͸·ͩೖΕͳ͍Ͱ σΟεϓϨΠ ɹిݯ

    NJDSP4% -"/έʔϒϧ
  16. 3BTQCFSSZ1JͷిݯΛೖΕͯىಈ ˞ͻͱੲલ3BTQCFSSZ1J͕ྲྀߦͬͨ࣌ͱ͸ҧͬͯࠓ͸ࣗಈͰϩάΠϯ͠·͢

  17. ˞ͷγεςϜͷจࣈ͕খͯ͘͞ݟʹ͍͘ͳ͋ʝͱ͍͏ਓ͸ઃఆมߋ 3BTQCFSSZ1Jͷจࣈʹ͍ͭͯ എܠը໘ΛӈΫϦοΫ

  18. γεςϜͷจࣈ͕খ͍࣌͞͸എܠը໘ΛӈΫϦοΫ ʮσεΫτοϓͷઃఆʯΛબ୒ͨ͠Β"QQFBSBODF4FUUJOH͕ ։͘ͷͰɺʮ4ZTUFNʯͷ'POUͷϘλϯΛΫϦοΫ͢Δͱ ʮ1JDLB'POUʯ͕։͘ͷͰݟ΍͍͢4J[Fʹมߋ͍ͩ͘͞ɻ

  19. ɹˢίίΛΫϦοΫ͢Δͱ ɹɹ-95FSNJOBM্ཱ͕͕ͪΔ -95FSNJOBMͷىಈ

  20. λʔϛφϧͷจࣈ͕খ͍࣌͞͸ฤूΛΫϦοΫ ʮઃఆ 4 ʯΛબ୒ͨ͠Β৽͘͠΢Οϯυ΢͕։͘ͷͰɺ ʮελΠϧʯͷʰ୺຤ͷϑΥϯτʱͷϘλϯ෦෼ΛΫϦοΫ͢Δͱ ʮϑΥϯτͷબ୒ʯ͕։͘ͷͰݟ΍͍͢4J[Fʹมߋ͍ͩ͘͞ɻ

  21. ࠓճ࢖༻͢ΔϓϩάϥϜݴޠ͸ʝ ✋QZUIPOΛ৮ͬͨ͜ͱ͕͋Δํ͸खΛ্͛ͯ ίʔυ͕γϯϓϧͰɺ૊ΈࠐΈ΍8FCΞϓϦͷ։ൃɺ·ͨਓ޻஌ೳ΍ɺ ϏοάσʔλղੳͳͲͰΑ͘࢖༻͞ΕΔ൚༻ϓϩάϥϛϯάݴޠͰ͢ɻ ʮ1ZUIPOʢύΠιϯʣͰ͢ʯ

  22. ίϚϯυΛೖྗͯ͠Έ·͠ΐ͏ʂ ίϚϯυ໊ ˢˈϚʔΫ͸දࣔ͞Ε͍ͯΔͷͰɺˈ͸ೖΕΔඞཁ͕ͳ͍Ͱ͢ɻ -95FSNJOBMͷը໘ʹίϚϯυΛೖྗ͢Δ

  23. 5FOTPS'MPXͱ͸ 5FOTPS'MPXʢςϯιϧϑϩʔʣͱ͸ɺ͞·͟·ͳػցֶश ʢ.BDIJOF-FBSOJOHʣͷ෼໺Ͱ࢖༻͞Ε͍ͯΔ044ʢΦʔϓ ϯιϑτ΢ΣΞϥΠϒϥϦʣͰ͢ɻ(PPHMF͕:PV5VCF΍ (PPHMF຋༁ɺԻ੠ݕࡧͳͲͰ࢖༻͍ͯͨ͠πʔϧͰɺ 3BTQCFSSZ1J্Ͱ΋ಈ࡞͠·͢ɻ ,FSBTͱ͸ ,FSBTʢέϥεʣͱ͸ɺ1ZUIPOͰॻ͔Εͨχϡʔϥϧωοτ ϫʔΫͷϥΠϒϥϦͰ͢ɻ5FOTPS'MPXɺ$/5,ʢ.JDSPTPGU $PHOJUJWF5PPMLJUʣɺ5IFBOPʢςΞϊʣ্Ͱಈ࡞͢Δ͜ͱ͕

    Ͱ͖·͢ɻࠓճ͸,FSBTΛ࢖ͬͯը૾ೝࣝΛ͓͜ͳ͍·͢ɻ IUUQTLFSBTJP ࠓճ࢖༻͢Δ̎ͭͷπʔϧ͸ʝ
  24. σΟʔϓϥʔχϯάʹඞཁͳ ϥΠϒϥϦ౳ͷΠϯετʔϧखॱ طʹΠϯετʔϧࡁΈ ͳͷͰɺྲྀΕ͚ͩΛ આ໌͠·͢ɻ

  25. ݱࡏͷ1ZUIPOͱQJQͷόʔδϣϯ֬ೝ ̍ʣ1ZUIPOʢ̏ܥʣͷόʔδϣϯΛ֬ೝ͢ΔίϚϯυ ̎ʣQJQ QZUIPOͷόʔδϣϯ؅ཧπʔϧʣ̏ܥͷόʔδϣϯΛ֬ೝ͢ΔίϚϯυ QJQGSPNVTSMJCQZUIPOEJTUQBDLBHFTQJQ(QZUIPO) QZUIPO7 QJQ7 1ZUIPO 1ZUIPOͷόʔδϣϯ͸̎ܥͱ ̏ܥ͕͋Γ·͢ɻࠓճ͸ܥΛ

    ѻ͍·͢ɻ7͚ͩେจࣈͰ͢ʂ QJQ͸ύοέʔδ؅ཧγεςϜͰ ͢ɻQJQ͸1ZUIPȌܥͷ؅ཧ
  26. "5-"4ʢઢܗ୅਺ϥΠϒϥϦʣͷΠϯετʔϧ ɹɹ "VUPNBUJDBMMZ5VOFE-JOFBS"MHFCSB4PGUXBSFʣ TVEPBQUJOTUBMMMJCBUMBTCBTFEFW "5-"4ʢઢܗ୅਺ϥΠϒϥϦʣͷΠϯετʔϧखॱ ్தͰΠϯετʔϧ͕ࢭ·ͬͯ ଓߦ͠·͔͢ʁ<:O>ͱฉ͔Ε·͢ͷͰ :Λೖྗޙ&OUFSͯ͠ ଓ͚͍ͯͩ͘͞ɻ ஫ҙɿ

    طʹΠϯετʔϧࡁΈͰ͢ ίϚϯυΛೖྗ͢Δඞཁ͸͋ Γ·ͤΜɻ
  27. ȊQZͷΠϯετʔϧखॱ IQZ ΤΠνϑΝΠϒύΠ ͷΠϯετʔϧ QZUIPOͰ )%' )JFSBSDIJDBM %BUB'PSNBU ܗࣜΛ ѻ͑ΔΑ͏ʹ͠·͢ɻ

    TVEPBQUHFUJOTUBMMQZUIPOIQZ ్தͰΠϯετʔϧ͕ࢭ·ͬͯ ଓߦ͠·͔͢ʁ<:O> ͱฉ͔Ε·͢ͷͰ :Λೖྗޙ&OUFSͯ͠ ଓ͚͍ͯͩ͘͞ɻ ˞LFSBTͳͲͷχϡʔϥϧωοτϫʔΫϥΠϒϥϦͷֶश݁ՌΛอଘ͢ΔϑΥʔϚοτ ஫ҙɿ طʹΠϯετʔϧࡁΈͰ͢ ίϚϯυΛೖྗ͢Δඞཁ͸͋ Γ·ͤΜɻ
  28. 5FOTPSqPXͷΠϯετʔϧखॱ 5FOTPSqPXͷΠϯετʔϧ TVEPQJQJOTUBMMUFOTPSqPX ʢ͜͜·Ͱ෼ఔ౓ʣ 3VOOJOHTFUVQQZCEJTU@XIFFMGPSOVNQZʜ ʢ͜ͷ͋ͱ͞Βʹ̎̌෼ఔ౓͔͔Γ·͢ɻʣ ஫ҙɿ طʹΠϯετʔϧࡁΈͰ͢ ίϚϯυΛೖྗ͢Δඞཁ͸͋ Γ·ͤΜɻ

  29. ,FSBTͷΠϯετʔϧखॱ ,FSBTͷΠϯετʔϧ TVEPQJQJOTUBMMLFSBT ஫ҙɿ طʹΠϯετʔϧࡁΈͰ͢ ίϚϯυΛೖྗ͢Δඞཁ͸͋ Γ·ͤΜɻ

  30. 0QFO$7ͷΠϯετʔϧखॱ 0QFO$7ͱ͸ TVEPBQUHFUJOTUBMMQZUIPOPQFODW ஫ҙɿ طʹΠϯετʔϧࡁΈͰ͢ ίϚϯυΛೖྗ͢Δඞཁ͸͋ Γ·ͤΜɻ ͜ΕͰඞཁͳΠϯετʔϧ͕׬ྃ͠·ͨ͠ʂ ը૾΍ಈըΛॲཧ͢Δػೳ͕࣮૷͞Ε͍ͯΔϥΠϒϥϦ

  31. ͜ΕͰUFOTPSqPXͱ,FSBTΛ࢖͏ ؀ڥ͕੔͍·ͨ͠ʂʂ ͜ΕͰ3BTQCFSSZ1JͰσΟʔϓϥʔχϯά͕ࢼͤ·͢ʂ

  32. ਓ޻஌ೳͱػցֶशͱਂ૚ֶशͷؔ܎ ਓ޻஌ೳ ػցֶश ਂ૚ ֶश ೖྗ ग़ྗ ʢػցʹίϯϐϡʔλʹֶशͤ͞Δ͜ͱʣ ʢόΠΦςΫϊϩδʔ ɹɹͳͲ΋͋Δʣ

  33. σΟʔϓϥʔχϯάʢਂ૚ֶशʣͱ͸ σΟʔϓϥʔχϯάͱ͸Ի੠ͷೝࣝɺը૾ೝࣝɺҟৗݕ஌ͳͲ͢ΔͨΊʹɺίϯϐϡʔ λʔʹֶशͤ͞Δͻͱͭͷख๏Ͱ͢ɻਓؒͷ೴ͷதʹ͋ΔχϡʔϩϯΛਅࣅͨχϡʔϥϧ ωοτϫʔΫͱݺ͹ΕΔख๏ͷ֊૚ΛਂΊͨΞϧΰϦζϜʹͳΓ·͢ɻ தؒ૚ͷ֊૚͕ΑΓਂ͘ͳ͍ͬͯΔ ਓؒͷ೴ͷதʹ͋Δχϡʔϩϯ ܗࣜχϡʔϩϯ В y x1

    x2 x3 xN w1 w2 w3 wN …………… …… σΟʔϓϥʔχϯά ೖྗ૚தؒ૚ɹग़ྗ૚ χϡʔϥϧωοτϫʔΫ ೖྗ૚தؒ૚ɹग़ྗ૚
  34. ը૾ೝࣝͤ͞Δҝͷ̎ͭͷϑΣʔζ ࣗಈͰը૾ೝࣝΛͤ͞Δʹ͸େ͖͘ೋͭͷϑΣʔζ͕͋Γ·͢ɻ ୈ̍ϑΣʔζɿֶशϞσϧΛͭ͘Δ ୈ̎ϑΣʔζɿֶशࡁΈϞσϧΛ࢖͏ σʔλ ॲཧ σʔλ ऩू ػցֶश ਂ૚ֶश

    ֶशͤ͞Δը૾ ֶशࡁΈ Ϟσϧ ֶश༻ σʔληοτ ೝ͍ࣝͤͨ͞ը૾ ೖྗ ग़ྗ ֶशࡁΈ Ϟσϧ ਪ࿦ ը૾ೝࣝΛ ࢖ͬͨॲཧ
  35. ·ͣ͸ֶशϞσϧΛͭ͘ΔϑΣʔζΛֶ΅͏ʂ ࣗಈͰը૾ೝࣝΛͤ͞Δʹ͸େ͖͘ೋͭͷϑΣʔζ͕͋Γ·͢ɻ ୈ̍ϑΣʔζɿֶशϞσϧΛͭ͘Δ ୈ̎ϑΣʔζɿֶशࡁΈϞσϧΛ࢖͏ σʔλ ॲཧ σʔλ ऩू ػցֶश ਂ૚ֶश

    ֶशͤ͞Δը૾ ֶशࡁΈ Ϟσϧ ֶश༻ σʔληοτ ೝ͍ࣝͤͨ͞ը૾ ೖྗ ग़ྗ ֶशࡁΈ Ϟσϧ ਪ࿦ ը૾ೝࣝΛ ࢖ͬͨॲཧ
  36. ·ͣ͸ֶशϞσϧΛͭ͘ΔϑΣʔζΛֶ΅͏ʂ ਓखෆ଍Ͱ ༣ศ෺Λ࢓෼͚Δ ͷ͕ େมͰ͢ɻ ͋ͳͨͳΒɺͲ͏΍ͬͯ༣ศہͷനϠΪ͞ΜΛॿ͚·͔͢ʁʁ ༣ศ൪߸Ͱ ࢓෼͚͍ͯ·͢ɻ

  37. ·ͣ͸ֶशϞσϧΛͭ͘ΔϑΣʔζΛֶ΅͏ʂ खॻ͖༣ศ൪߸ͷ ਺ࣈΛࣗಈͰೝࣝ ͤ͞Δͱָͩͳʂ ·ͣ͸͍ΖΜͳਓͷ खॻ͖਺ࣈΛ ूΊΑ͏ʂ ͏Θʙ࢓෼͚Δ ྔ͕ଟͯ͘େม ͩ͠ɺखॻ͖਺

    ࣈͬͯಡΈͮΒ ͍ͳ͋ɻ खॻ͖਺ࣈʢ༣ศ൪߸ʣΛը૾ೝࣝͰ͖ΔΑ͏ʹ͠Α͏ʂ
  38. ·ͣ͸ֶशϞσϧΛͭ͘ΔϑΣʔζΛֶ΅͏ʂ ֶशϞσϧ σʔληοτ ɹ࡞੒ ֶश༻σʔλɹɹɹɹɹɹςετ༻σʔλ ूΊ͖ͯͨखॻ͖਺ࣈσʔλ ूΊͨσʔλ͔ΒσʔληοτΛ࡞੒ֶͯ͠शϞσϧΛ࡞Δ खॻ͖਺ࣈʢ༣ศ൪߸ʣΛը૾ೝࣝͰ͖ΔΑ͏ʹ͠Α͏ʂ ֶश σʔλॲཧ

  39. ·ͣ͸ֶशϞσϧΛͭ͘ΔϑΣʔζΛֶ΅͏ʂ ֶश༻σʔλɹɹɹɹɹɹςετ༻σʔλ ूΊ͖ͯͨखॻ͖਺ࣈσʔλ ֶशϞσϧ ςετ༻σʔλͰ ਖ਼౴཰Λௐ΂Δ ϓϩάϥϛϯά ςετ ೲ඼ ׬

    ੒ ૊ΈࠐΈ
  40. खॻ͖਺ࣈΛը૾ೝࣝͤ͞ΔͨΊͷ޻ఔ ୈ̍ϑΣʔζɿֶशϞσϧΛͭ͘Δ σʔλ ॲཧ σʔλ ऩू ػցֶश ਂ૚ֶश ֶशͤ͞Δը૾ ֶशࡁΈ

    Ϟσϧ ֶश༻ σʔληοτ ֶशϞσϧ
  41. खॻ͖਺ࣈͷσʔληοτ./*45ʢΤϜχετʣ ػցֶशΛֶͿਓʹͱͬͯ௒༗໊ͳσʔληοτͰ͢ɻ͔Β· Ͱͷສݸͷखॻ͖਺ࣈʢֶश༻̒ສݸɾςετ༻̍ສݸʣͷը૾ ͱͦΕʹରԠ͢Δ౴͑ʢϥϕϧʣ͕ఏڙ͞Ε͍ͯ·͢ɻ

  42. ./*45ͷը૾ɹɹɹɹը૾Λd·Ͱͷ਺ࣈͰදݱͨ͠ߦྻ

  43. 5IPOOZ 1ZUIPO*%&1ZUIPOͷॳ৺ऀ༻౷߹؀ڥ Λ࢖͏ UIPOOZͱ͍͏σϑΥϧτͰ ೖ͍ͬͯΔQZUIPOͷ*%&Λ ࠓճ࢖͍·͢ɻ ./*45ΛಡΈࠐΉϓϩάϥϜ NOJTUQZΛ ࣄલʹೖΕ͓͖ͯ·ͨ͠ͷͰ ։͖·͢ɻ

    UIPOOZNOJTUQZ ͱλʔϛφϧͰଧ͍ͬͯͩ͘͞ɻ खॻ͖਺ࣈͷσʔληοτ./*45
  44. from keras.datasets import mnist import matplotlib.pyplot as plt (X_train, y_train),

    (X_test, y_test) = mnist.load_data() print("label",y_train[0]) plt.imshow(X_train[0].reshape(28,28),cmap='Greys') plt.show() खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖͓͏
  45. from keras.datasets import mnist import matplotlib.pyplot as plt (X_train, y_train),

    (X_test, y_test) = mnist.load_data() print("label",y_train[0]) plt.imshow(X_train[0].reshape(28,28),cmap='Greys') plt.show() खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖͓͏ LFSBTʹ༻ҙ͞Εͯ ͍Δ./*45ΛΠϯ ϙʔτͯ͠ɺը૾Λ දࣔͰ͖ΔΑ͏ʹ QMUͱઃఆ͢Δ
  46. from keras.datasets import mnist import matplotlib.pyplot as plt (X_train, y_train),

    (X_test, y_test) = mnist.load_data() print("label",y_train[0]) plt.imshow(X_train[0].reshape(28,28),cmap='Greys') plt.show() खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖͓͏ NOJTUΛಡΈࠐΉ
  47. from keras.datasets import mnist import matplotlib.pyplot as plt (X_train, y_train),

    (X_test, y_test) = mnist.load_data() print("label",y_train[0]) plt.imshow(X_train[0].reshape(28,28),cmap='Greys') plt.show() खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖͓͏ NOJTUͷ࠷ॳͷσʔ λͷϥϕϧͱը૾ Λग़ྗ
  48. 5IPOOZ 1ZUIPO*%&1ZUIPOͷॳ৺ऀ༻౷߹؀ڥ Λ࢖͏ 3VOϘλϯΛԡ࣮ͯ͠ߦͤ͞Α͏ʂ खॻ͖਺ࣈͷσʔληοτ./*45 &Run mnist1.py Using TensorFlow backend.

    WARNING: Logging before flag parsing goes to stderr. W0823 09:50:29.745067 1995954896 deprecation_wrapper.py:118] From /home/pi/.local/lib/python3.7/site- packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead. WARNING͕͍͔ͭ͘ग़·͕͢ ໰୊ͳ͍ͷͰ͠͹Β͘଴ͪ·͢
  49. from keras.datasets import mnist import matplotlib.pyplot as plt (X_train, y_train),

    (X_test, y_test) = mnist.load_data() print("label",y_train[0]) plt.imshow(X_train[0].reshape(28,28),cmap='Greys') plt.show() खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖͓͏ ×Ͱด͡Δ
  50. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͯ ֶशϞσϧΛ࡞Ζ͏ʂ ./*45Λ࢖ֶͬͯशϞσϧΛ ࡞ΔϓϩάϥϜ NOJTUQZΛ ࣄલʹೖΕ͓͖ͯ·ͨ͠ͷͰ 5IPOOZͷ-PBEΛΫϦοΫͯ͠ ։͖NOJTUQZΛબ୒ͯ͠ ։͖·͢ɻ

  51. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͯ ֶशϞσϧΛ࡞Ζ͏ʂ from keras.datasets import mnist from keras.models import Sequential

    from keras.layers.core import Dense, Activation from keras.utils import np_utils (X_train, y_train), (X_test, y_test) = mnist.load_data() σʔληοτͷಡΈࠐΈ 9@USBJOֶशͤ͞Δը૾σʔλ Z@USBJOֶशͤ͞Δϥϕϧσʔλ 9@UFTUֶशͤͨ͞ϞσϧΛςετ͢Δςετ༻ը૾σʔλ Z@UFTUֶशͤͨ͞ϞσϧΛςετ͢Δςετ༻ϥϕϧσʔλ NOJTUͷΠϯϙʔτ
  52. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͯ ֶशϞσϧΛ࡞Ζ͏ʂ 9@USBJO9@USBJOSFTIBQF    9@UFTU9@UFTUSFTIBQF   

    ֶशͤ͞Δը૾σʔλͱςετ༻ը૾σʔλΛ ϦγΣΠϓ͠·͢ɻ ./*45ͷը૾σʔλ ɹɹɹɹɹɹϐΫηϧºϐΫηϧϐΫηϧ ̍ϐΫηϧͷάϨʔεέʔϧ஋Λ̌ʙ̎̑̑ͷ਺ࣈͰදݱ ɹɹͰׂΔ͜ͱͰ̍ϐΫηϧͷ஋Λ̌ʙ̍ͷؒʹ͠·͢ ʢਖ਼نԽɿ̌ʙ̍·Ͱ͔͠ѻ͑ͳ͍ͷͰ߹Θͤ·͢ʣ  
  53. ./*45ͷը૾ɹɹɹɹը૾Λd·Ͱͷ਺ࣈͰදݱͨ͠ߦྻ

  54. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͯ ֶशϞσϧΛ࡞Ζ͏ʂ Z@USBJOOQ@VUJMTUP@DBUFHPSJDBM Z@USBJO  Z@UFTUOQ@VUJMTUP@DBUFHPSJDBM Z@UFTU  ,FSBT͸ϥϕϧΛόΠφϦʔͰ͔͠࢖͑ͳ͍ͷͰɺ ϥϕϧΛ̌ͱ̍ͷߦྻʹ͢ΔॲཧͰ͢

  55. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͯ ֶशϞσϧΛ࡞Ζ͏ʂ NPEFM4FRVFOUJBM < %FOTF  JOQVU@TIBQF   "DUJWBUJPO

    bTJHNPJE  %FOTF   "DUJWBUJPO TPGUNBY  >  ֶशϞσϧΛ࡞͍ͬͯ·͢ɻ
  56. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͯ ֶशϞσϧΛ࡞Ζ͏ʂ NPEFMDPNQJMF MPTTDBUFHPSJDBM@DSPTTFOUSPQZ PQUJNJ[FSTHE  NFUSJDT<BDDVSBDZ>  NPEFMpU 9@USBJO

    Z@USBJO CBUDI@TJ[F WFSCPTF FQPDIT  WBMJEBUJPO@TQMJU  ֶशϞσϧΛ࡞͍ͬͯ·͢ɻ
  57. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͨ ֶशϞσϧͷਖ਼౴཰Λग़ྗ TDPSFNPEFMFWBMVBUF 9@UFTU Z@UFTU WFSCPTF  QSJOU UFTUBDDVSBDZ TDPSF<>

      είΞʢਖ਼౴཰ʣΛग़ྗ͠·͢
  58. 5IPOOZ 1ZUIPO*%&1ZUIPOͷॳ৺ऀ༻౷߹؀ڥ Λ࢖͏ 3VOϘλϯΛԡ࣮ͯ͠ߦͤ͞Α͏ʂ खॻ͖਺ࣈͷσʔληοτ./*45 &Run mnist2.py Using TensorFlow backend.

    WARNING: Logging before flag parsing goes to stderr. W0823 09:50:29.745067 1995954896 deprecation_wrapper.py:118] From /home/pi/.local/lib/python3.7/site- packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead. WARNING͕͍͔ͭ͘ग़·͕͢ ໰୊ͳ͍ͷͰ͠͹Β͘଴ͪ·͢
  59. 5IPOOZ 1ZUIPO*%&1ZUIPOͷॳ৺ऀ༻౷߹؀ڥ Λ࢖͏ खॻ͖਺ࣈͷσʔληοτ./*45 ਖ਼౴཰͸75.27%

  60. վળͯ͠ਖ਼౴཰Λ͋͛Α͏ʂ

  61. վળͯ͠ਖ਼౴཰Λ͋͛Α͏ʂ NPEFM4FRVFOUJBM < %FOTF  JOQVU@TIBQF   "DUJWBUJPO bTJHNPJE

     %FOTF   "DUJWBUJPO TPGUNBY  >  TJHNPJEΛ SFMVʹมߋ͢Δ
  62. 5IPOOZ 1ZUIPO*%&1ZUIPOͷॳ৺ऀ༻౷߹؀ڥ Λ࢖͏ 3VOϘλϯΛԡ࣮ͯ͠ߦͤ͞Α͏ʂ खॻ͖਺ࣈͷσʔληοτ./*45 &Run mnist2.py Using TensorFlow backend.

    WARNING: Logging before flag parsing goes to stderr. W0823 09:50:29.745067 1995954896 deprecation_wrapper.py:118] From /home/pi/.local/lib/python3.7/site- packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead. WARNING͕͍͔ͭ͘ग़·͕͢ ໰୊ͳ͍ͷͰ͠͹Β͘଴ͪ·͢
  63. NPEFMDPNQJMF MPTTDBUFHPSJDBM@DSPTTFOUSPQZ PQUJNJ[FSTHE  NFUSJDT<BDDVSBDZ>  NPEFMpU 9@USBJO Z@USBJO CBUDI@TJ[F

    WFSCPTF FQPDIT  WBMJEBUJPO@TQMJU  FQPDIT͔ΒFQPDIT ʹมߋ͠Α͏ վળͯ͠ਖ਼౴཰Λ͋͛Α͏ʂ
  64. ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ

  65. JNQPSUOVNQZBTOQ JNQPSUDW JNQPSUNBUQMPUMJCQZQMPUBTQMU GSPNLFSBTEBUBTFUTJNQPSUNOJTU GSPNLFSBTNPEFMTJNQPSU4FRVFOUJBM GSPNLFSBTMBZFSTDPSFJNQPSU%FOTF "DUJWBUJPO GSPNLFSBTVUJMTJNQPSUOQ@VUJMT GSPNLFSBTNPEFMTJNQPSUMPBE@NPEFM 

    ൑ผʹඞཁͳ΋ͷΛΠϯϙʔτ͠·͢ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ
  66. 9@USBJO Z@USBJO  9@UFTU Z@UFTU NOJTUMPBE@EBUB  9@USBJO9@USBJOSFTIBQF  

     9@UFTU9@UFTUSFTIBQF    Z@USBJOOQ@VUJMTUP@DBUFHPSJDBM Z@USBJO  Z@UFTUOQ@VUJMTUP@DBUFHPSJDBM Z@UFTU  NPEFM4FRVFOUJBM < %FOTF  JOQVU@TIBQF   "DUJWBUJPO SFMV  %FOTF   "DUJWBUJPO TPGUNBY  >  NPEFMDPNQJMF MPTTDBUFHPSJDBM@DSPTTFOUSPQZ PQUJNJ[FSTHE NFUSJDT<BDDVSBDZ>  NPEFMpU 9@USBJO Z@USBJO CBUDI@TJ[F WFSCPTF FQPDIT WBMJEBUJPO@TQMJU  TDPSFNPEFMFWBMVBUF 9@UFTU Z@UFTU WFSCPTF  QSJOU UFTUBDDVSBDZ TDPSF<>   ઌ΄ͲͷNOJTUQZͱಉ͡ॲཧͰ ਖ਼౴཰Λग़͠·͢ɻ ʢ࣌ؒͷؔ܎ͰFQPDITʹͱ͠·͢ʣ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ
  67. NPEFMTBWF ./*45I  JNHDWJNSFBE KQH    ઌ΄ͲͷNOJTUQZͱಉ͡ॲཧͰ ࡞ֶͬͨशϞσϧΛอଘ͠·͢ɻ

    ࠓճ͸ࢲ͕ॻ͍ͨ਺ࣈͷ̓ͷը૾Λ ೖΕ͓͍ͯͨͷͰɺ ͦΕΛ൑ผͯ͠Έ·͠ΐ͏ʂ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ KQH ʻʻ͜ͷը૾͸ ɹɹJ1IPOFͷϝϞͰॻ͍ͯɺΩϟϓνϟʔͨ͠ ɹɹࣸਅͷαΠζΛฤूͰτϦϛϯάͨ͠΋ͷͰ͢ɻ
  68. HSBZDWDWU$PMPS JNH DW$0-03@#(3(3":  DWJNXSJUF HSBZQOH HSBZ   PQFODWΛ࢖ͬͯը૾ΛάϨʔεέʔϧʹ͠·͢

    ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ KQH HSBZQOH
  69. @ CJOBSZDWUISFTIPME HSBZ   DW5)3&4)@#*/"3:  DWJNXSJUF CJOBSZQOH CJOBSZ

      PQFODWΛ࢖ͬͯը૾Λ̎஋Խ͠·͢ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ CJOBSZQOH HSBZQOH
  70. OFHBQPTJDWCJUXJTF@OPU CJOBSZ  DWJNXSJUF OFHBQPTJQOH OFHBQPTJ   PQFODWΛ࢖ͬͯը૾ͷനࠇΛ൓స͠·͢ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ

    ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ CJOBSZQOH OFHBQPTJQOH
  71. CMVSDW(BVTTJBO#MVS OFHBQPTJ     DWJNXSJUF CMVSQOH CMVS 

     PQFODWΛ࢖ͬͯը૾ʹ΅͔͠Λ͍ΕΔ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ OFHBQPTJQOH CMVSQOH
  72. PQFODWΛ࢖ͬͯը૾αΠζΛºʹมߋ͢Δ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ CMVSQOH JNHDWSFTJ[F CMVS   DW*/5&3@$6#*$ 

    
  73. ը૾αΠζΛºʹมߋͨ͠΋ͷΛલॲཧͯ͠ ઌ΄Ͳ࡞ֶͬͨशϞσϧΛ࢖ͬͯ൑ผ͠ Ұ൪Մೳੑ͕ߴ͍΋ͷΛදࣔ͢Δɻ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ <> 9BQQFOE JNH  9OQBTBSSBZ

    9  99 99SFTIBQF MFO 9   SFTVMUNPEFMQSFEJDU 9  QSJOU SFTVMUBSHNBY  
  74. 3VOϘλϯΛԡ࣮ͯ͠ߦͤ͞Α͏ʂ &Run mnist2.py Using TensorFlow backend. WARNING: Logging before flag

    parsing goes to stderr. W0823 09:50:29.745067 1995954896 deprecation_wrapper.py:118] From /home/pi/.local/lib/python3.7/site- packages/tensorflow/__init__.py:98: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead. WARNING͕͍͔ͭ͘ग़·͕͢ ໰୊ͳ͍ͷͰ͠͹Β͘଴ͪ·͢ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ
  75. 3BTQCFSSZ1JͰ64#ΧϝϥΛ࢖͏खॱ ࣗ෼ͷखॻ͖਺ࣈΛ൑ผ͠Α͏ʂ

  76. 3BTQCFSSZ1JͷઃఆΛมߋ͢Δ ϝχϡʔͷɹɹΛΫϦοΫͯ͠ ઃఆʼ3TQCFSSZ1Jͷઃఆ ΛΫϦοΫ͠·͢ɻ

  77. 3BTQCFSSZ1JͷઃఆΛมߋ͢Δ ֤ࣗͷύεϫʔυ ֤ࣗͷύεϫʔυ ɹ ⁞3BTQCFSSZ1Jͷઃఆ ɹ্ཱ͕͕ͪͬͨΒ ɹʮΠϯλʔϑΣΠεʯΛ ɹɹબ୒͍ͯͩ͘͠͞ɻ

  78. 3BTQCFSSZ1JͷઃఆΛมߋ͢Δ ɹΧϝϥΛ༗ޮʹͯ͠ ɹͯ͠0,Λԡͨ͠Β ɹ࠶ىಈ͠·͢ɻ

  79. 64#Χϝϥͷಈ࡞ςετʢHVWDWJFXΛ࢖͍·͢ʣ TVEPBQUHFUJOTUBMMHVWDWJFX ͱೖྗͯ͠Πϯετʔϧ͢Δ ్தͰΠϯετʔϧ͕ࢭ·ͬͯ ଓߦ͠·͔͢ʁ<:O> ͱฉ͔Ε·͢ͷͰ:Λೖྗޙ&OUFSͯ͠ ଓ͚͍ͯͩ͘͞ɻ

  80. Ұ୴Πϯετʔϧ͢Δͱϝχϡʔ͔Β΋ىಈͰ͖·͢ɻ ϝχϡʔͷɹɹΛΫϦοΫͯ͠ α΢ϯυͱϏσΦʼHVWDWJFX ΛΫϦοΫ͠·͢ɻ

  81. 64#Χϝϥͷಈ࡞ςετʢHVWDWJFXΛ࢖͍·͢ʣ ΩʔϘʔυͷ*Λԡ͢ͱ Ωϟϓνϟʔ͕ࡱΕ·͢ ϝχϡʔ͔ΒͰͳ͘ λʔϛφϧ͔Β HVWDWJFX ͱೖྗͯ͠΋0,Ͱ ͢ɻ

  82. 64#Χϝϥͷಈ࡞ςετʢHVWDWJFXΛ࢖͍·͢ʣ ίϯτϥε τΛௐ੔͢ Δɻ ΩʔϘʔυ ͷ*Λԡ͢ͱ Ωϟϓ νϟʔ͕ࡱ Ε·͢

  83. 64#Χϝϥͷಈ࡞ςετʢࡱͬͨࣸਅΛ֬ೝ͠·͠ΐ͏ʣ อଘ͞ΕͨࣸਅΛӈΫϦοΫ͠ ͯ ϑΝΠϧ໊ͷมߋΛԡͯ͠ ੩ࢭըͷ໊લΛίϐʔ͠·͠ΐ ͏ ֬ೝ͠·͠ΐ͏ɻ ʢNZ@QIPUP൪߸KQHͰ ɹอଘ͞Ε·͢ɻʣ ϑΥϧμϚʔΫΛΫϦοΫͯ͠

    QJϑΥϧμΛ։͖·͠ΐ͏
  84. ֶशࡁΈϞσϧΛ࢖ͬͨը૾ೝࣝ

  85. ը૾ೝࣝͤ͞Δҝͷ̎ͭͷϑΣʔζ ࣗಈͰը૾ೝࣝΛͤ͞Δʹ͸େ͖͘ೋͭͷϑΣʔζ͕͋Γ·͢ɻ ୈ̍ϑΣʔζɿֶशϞσϧΛͭ͘Δ ୈ̎ϑΣʔζɿֶशࡁΈϞσϧΛ࢖͏ σʔλ ॲཧ σʔλ ऩू ػցֶश ਂ૚ֶश

    ֶशͤ͞Δը૾ ֶशࡁΈ Ϟσϧ ֶश༻ σʔληοτ ೝ͍ࣝͤͨ͞ը૾ ೖྗ ग़ྗ ֶशࡁΈ Ϟσϧ ਪ࿦ ը૾ೝࣝΛ ࢖ͬͨॲཧ
  86. ֶशࡁΈϞσϧΛ࢖ͬͯΈΑ͏ʂ ୈ̍ϑΣʔζɿֶशϞσϧΛͭ͘Δ ୈ̎ϑΣʔζɿֶशࡁΈϞσϧΛ࢖͏ σʔλ ॲཧ σʔλ ऩू ػցֶश ਂ૚ֶश ֶशͤ͞Δը૾

    ֶशࡁΈ Ϟσϧ ֶश༻ σʔληοτ ೝ͍ࣝͤͨ͞ը૾ ೖྗ ग़ྗ ֶशࡁΈ Ϟσϧ ਪ࿦ ը૾ೝࣝΛ ࢖ͬͨॲཧ
  87. ֶशࡁΈϞσϧ*ODFQUJPO7Λ࢖ͬͨը૾ೝࣝʹ௅ઓ *ODFQUJPO7ͱ͸ (PPHMF͕։ൃͨ͠σΟʔϓϥʔ χϯάΛ࢖ֶͬͨशϞσϧ σʔληοτ*."(&/&5Ͱֶश ͞Ε͍ͯ·͢ɻ 5FOTPSqPXͰར༻ग़དྷΔ༷ʹҰ ൠެ։͞Ε͍ͯ·͢ɻ

  88. ݩʹͳΔը૾ɹɹ໿ສຕ ϥϕϧͷΧςΰϦ໿ສઍछྨ ͷσʔληοτ ֶशࡁΈϞσϧ*ODFQUJPO7Λ࢖ͬͨը૾ೝࣝʹ௅ઓ ֶश༻σʔληοτ*NBHF/FUͱ͸͜ͷ෦෼

  89. 5IPOOZͷ-PBEΛΫϦοΫͯ͠ ։͖NPEFMQZΛબ୒ͯ͠ ։͖·͢ɻ ֶशࡁΈϞσϧΛ࢖ͬͯը૾ೝࣝ͢Δ

  90. from keras.preprocessing import image from keras.applications.inception_v3 \ import preprocess_input, decode_predictions,

    InceptionV3 import numpy as np model = InceptionV3(weights='imagenet') img_path=' banana.jpg' img = image.load_img(img_path, target_size=(299,299)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) ֶशࡁΈϞσϧΛ࢖ͬͯը૾ೝࣝ͢Δ޻ఔͱ͸ CBOBOBKQH ɹɹɹˣ *ODFQUJPO7ͱ ͍͏ֶशࡁΈ ϞσϧΛ࢖ͬͯ ը૾ೝࣝ ɹɹˣ είΞͰ݁Ռ͕ ͰΔ
  91. όφφը૾Ͱ࣮ߦ ̍ʣϝχϡʔͷ36/ϘλϯΛԡ͢ ̎ʣ4IFMMͷʮ3VONPEFMQZʯͱදࣔ͞ΕͯϓϩάϥϜ͕࣮ߦ͞Ε·͢ɻ 8BSOJOH͕ग़·͕͢໰୊ͳ͍Ͱ͢ɻ෼ඵఔ౓Ͱ݁Ռ͕ग़·͢ɻ ̍౓͚ͩΫϦοΫͯ͠ ͍ͩ͘͞ɻԿ౓΋ԡ͞ ͳ͍Α͏ʹɻʢॲཧ͕ ஗͘ͳΓ·͢ɻ

  92. from keras.preprocessing import image from keras.applications.inception_v3 \ import preprocess_input, decode_predictions,

    InceptionV3 import numpy as np model = InceptionV3(weights='imagenet') img_path=' banana.jpg' img = image.load_img(img_path, target_size=(299,299)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) print('Predicted:') for p in decode_predictions(preds, top=5)[0]: print("Score {}, Label {}".format(p[2],p[1])) ֶशࡁΈϞσϧΛ࢖ͬͨॲཧͷઆ໌ɿͦͷ̍ ը૾ͷಡΈࠐΈ΍ ֶशࡁΈϞσϧͷ *ODFQUJPO7ͷಡΈ ࠐΈɺ1ZUIPOֶज़ ܭࢉϥΠϒϥϦʔ ͷOVNQZΛΠϯ ϙʔτ͢Δ
  93. from keras.preprocessing import image from keras.applications.inception_v3 \ import preprocess_input, decode_predictions,

    InceptionV3 import numpy as np model = InceptionV3(weights='imagenet') img_path=' banana.jpg' img = image.load_img(img_path, target_size=(299,299)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) print('Predicted:') for p in decode_predictions(preds, top=5)[0]: print("Score {}, Label {}".format(p[2],p[1])) ֶशࡁΈϞσϧΛ࢖ͬͨॲཧͷઆ໌ɿͦͷ *NBHF/FUͰֶश͠ ͨॏΈͱ *ODFQUJPO7 ͷجຊϞσϧ͕ಡ Έࠐ·ΕΔ
  94. from keras.preprocessing import image from keras.applications.inception_v3 \ import preprocess_input, decode_predictions,

    InceptionV3 import numpy as np model = InceptionV3(weights='imagenet') img_path=' banana.jpg' img = image.load_img(img_path, target_size=(299,299)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) print('Predicted:') for p in decode_predictions(preds, top=5)[0]: print("Score {}, Label {}".format(p[2],p[1])) ֶशࡁΈϞσϧΛ࢖ͬͨॲཧͷઆ໌ɿͦͷ ೝ͍ࣝͤͨ͞ը૾ ͷࢦఆͱը૾ͷα Πζͷॲཧ
  95. from keras.preprocessing import image from keras.applications.inception_v3 \ import preprocess_input, decode_predictions,

    InceptionV3 import numpy as np model = InceptionV3(weights='imagenet') img_path=' banana.jpg' img = image.load_img(img_path, target_size=(299,299)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) print('Predicted:') for p in decode_predictions(preds, top=5)[0]: print("Score {}, Label {}".format(p[2],p[1])) ֶशࡁΈϞσϧΛ࢖ͬͨॲཧͷઆ໌ɿͦͷ ը૾ͷલॲཧ
  96. from keras.preprocessing import image from keras.applications.inception_v3 \ import preprocess_input, decode_predictions,

    InceptionV3 import numpy as np model = InceptionV3(weights='imagenet') img_path=' banana.jpg' img = image.load_img(img_path, target_size=(299,299)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) print('Predicted:') for p in decode_predictions(preds, top=5)[0]: print("Score {}, Label {}".format(p[2],p[1])) ֶशࡁΈϞσϧΛ࢖ͬͨॲཧͷઆ໌ɿͦͷ ਪ࿦
  97. from keras.preprocessing import image from keras.applications.inception_v3 \ import preprocess_input, decode_predictions,

    InceptionV3 import numpy as np model = InceptionV3(weights='imagenet') img_path=' banana.jpg' img = image.load_img(img_path, target_size=(299,299)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) print('Predicted:') for p in decode_predictions(preds, top=5)[0]: print("Score {}, Label {}".format(p[2],p[1])) ֶशࡁΈϞσϧΛ࢖ͬͨॲཧͷઆ໌ɿͦͷ ਪ࿦݁Ռͷग़ྗ
  98. όφφͷ݁Ռ UIPOOZͱ͍͏σϑΥϧτͰ ೖ͍ͬͯΔQZUIPOͷ*%&Λ ࠓճ࢖͍·͢ɻ LFSBTΛ࢖ͬͨը૾ೝࣝΛ ࢼ͢ͷʹTBNQMFQZΛ ։͖·͢ɻ DEd UIPOOZTBNQMFQZ ͱλʔϛφϧͰଧ͍ͬͯͩ͘͞ɻ

    είΞ όφφͱೝࣝ
  99. from keras.preprocessing import image from keras.applications.inception_v3 \ import preprocess_input, decode_predictions,

    InceptionV3 import numpy as np model = InceptionV3(weights='imagenet') img_path=' apple.jpg' img = image.load_img(img_path, target_size=(299,299)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) ֶशࡁΈϞσϧΛ࢖ͬͯը૾ೝࣝ͢Δ޻ఔͱ͸ BQQMFKQH ɹˣ ɹߦ໨ͷ CBOBOBKQHΛ ɹBQQMFKQHʹ มߋ͢Δ ɹɹˣ ಉ͡Α͏ʹ࣮ߦ ͯ݁͠ՌΛΈΔ
  100. ΓΜ͝ը૾Ͱ࣮ߦ ̍ʣϝχϡʔͷ36/ϘλϯΛԡ͢ ̎ʣ4IFMMͷʮ3VONPEFMQZʯͱදࣔ͞ΕͯϓϩάϥϜ͕࣮ߦ͞Ε·͢ɻ ಉ͡Α͏ʹ̎෼̏̌ඵఔͰ݁Ռ͕ग़·͢ɻͲͷΑ͏ͳ݁ՌʹͳΔͰ͠ΐ͏͔ʁʁ

  101. ݁Ռ͕ग़Δ·Ͱ̑෼΄Ͳٳܜ

  102. ΓΜ͝ͷ݁Ռ είΞ (SBOOZ@4NJUIͱೝࣝ ͋Εʁ BQQMF͡Όͳ͍ͷʁʁ (SBOOZ@4NJUIͱ͸ΓΜ͝ͷ඼छͰ͢ɻֶशͤ͞Δ࣌ͷϥϕϧ͕݁ՌʹͰ·͢ɻ

  103. σʔληοτͷ඼࣭ͱ༧ଌ݁Ռ (SBOOZ4NJUI ͜Ε͸౰વ BQQMFͱ ༧ଌ͞ΕΔ ΑͶ ɹσʔληοτͰॻ͔Ε͍ͯΔϥϕϧ ˣ ಛ௃͕Ұ൪ࣅ͍ͯΔͱ൑அ͞ΕΔ ˣ

    ༧ଌ݁Ռʮ(SBOOZ4NJUIʯ σʔληοτͷ ඼࣭͸ ͱͯ΋ॏཁ
  104. ࣮ࡍʹΧϝϥͰࡱͬͨ΋ͷΛೝࣝͯ͠Έ·͠ΐ͏ Ұ୴Πϯετʔϧ͢Δͱϝχϡʔ͔Β΋ىಈͰ͖·͢ɻ ϝχϡʔͷɹɹΛΫϦοΫͯ͠ α΢ϯυͱϏσΦʼHVWDWJFX ΛΫϦοΫ͠·͢ɻ

  105. 64#Χϝϥͷಈ࡞ςετʢࡱͬͨࣸਅΛ֬ೝ͠·͠ΐ͏ʣ อଘ͞ΕͨࣸਅΛΫϦοΫͯ͠ ੩ࢭըΛ֬ೝ͠·͠ΐ͏ɻ ʢNZ@QIPUP൪߸KQHͰ ɹอଘ͞Ε·͢ɻʣ ϑΥϧμϚʔΫΛΫϦοΫͯ͠ QJϑΥϧμΛ։͖·͠ΐ͏ ΩʔϘʔυͷ*Λԡ͢ͱ Ωϟϓνϟʔ͕ࡱΕ·͢

  106. ࠓΧϝϥͰࡱͬͨը૾Ͱࢼͯ͠ΈΑ͏ɿ ࡱͬͨը૾ ɹˣ ɹߦ໨ͷ BQQMFKQHΛ ɹը૾໊ʹ มߋ͢Δ ɹɹˣ ಉ͡Α͏ʹ࣮ߦ ͯ݁͠ՌΛΈΔ

    ‘ࡱͬͨը૾໊’
  107. ΧϝϥͰࡱͬͨը૾Ͱ࣮ߦ ̍ʣϝχϡʔͷ36/ϘλϯΛԡ͢ ̎ʣ4IFMMͷʮ3VONPEFMQZʯͱදࣔ͞ΕͯϓϩάϥϜ͕࣮ߦ͞Ε·͢ɻ ಉ͡Α͏ʹ̑෼ඵఔ౓Ͱ݁Ռ͕ग़·͢ɻͲͷΑ͏ͳ݁ՌʹͳΔͰ͠ΐ͏͔ʁʁ

  108. 3BTQCFSSZ1JͳΒ͜Μͳ͜ͱग़དྷ·͢ʂ ΈΜͳͷϥζύΠίϯςετͰ༏ྑ৆ɹ࡞඼ྫʣ

  109. Microsoft Azure Λ࢖༻ͯ͠ সإ൑ఆ Emotion API ௒খܕΧϝϥ RaspberryPi ΧϝϥͰ ࡱӨͨ͠ը૾

    3BTQCFSSZ1JͱػցֶशΛ࢖ͬͨྫɹɹɹɹ 3BTQCFSSZ1JΛ࢖ͬͨ࡞඼ΛԠืͯ͠ΈΑ͏ʂɹɹɹ
  110. ΧϝϥͰࡱͬͨը૾ͷ݁Ռ Έͳ͞Μ͸ԿΛ ࡱӨ͠·͔ͨ͠ʁ ݁ՌΛͥͻڭ͑ͯ ͍ͩ͘͞

  111. ωοτͰݕࡧͨ͠ը૾Ͱࢼͯ͠ΈΑ͏ Έͳ͞Μ͸ԿΛ ࢼ͠·͔ͨ͠ʁ ݁ՌΛͥͻڭ͑ͯ ͍ͩ͘͞ $ISPNJVNͱ͍͏ϒϥ΢β্ཱ͕͕ͪΔͷͰωοτݕࡧͯ͠Έ͍ͯͩ͘͞ɻ

  112. ࠓ೔Έͳ͞Μ͸ֶशϞσϧͷ࡞੒ͱ ࡞੒͞ΕֶͨशϞσϧͰࣗ෼͕ࡱӨͨ͠ ը૾Λ࢖͍ը૾ೝࣝͤ͞Δ͜ͱ͕Ͱ͖·ͨ͠ɻ ͜ΕͰແࣄ3BTQCFSSZ1JͰσΟʔϓϥʔχϯάΛ ͸͡ΊΔ͜ͱ͕Ͱ͖·ͨ͠ʂ ͓ΊͰͱ͏͍͟͝·͢

  113. PQFODWΛ࢖ͬͨإೝࣝ

  114. 5IPOOZͷ-PBEΛΫϦοΫͯ͠ ։͖GBDFQZΛબ୒ͯ͠ ։͖·͢ɻ PQFODWΛ࢖ͬͯإೝࣝΛ͢Δલʹ

  115. ࣮ߦ ̍ʣϝχϡʔͷ36/ϘλϯΛԡ͢ ̎ʣΧϝϥը૾ͱάϨΠεέʔϧʹมߋͤͨ͞ը૾্ཱ͕͕ͪΓ·͢ ̏ʣࣗ෼ͷإ͕ݟ͑ΔҐஔʹΧϝϥΛஔ͍ͯ֬ೝͰ͖ͨΒ4501Λԡ͢

  116. إೝࣝ͢Δલʹը૾ͷ൓సΛ௚ͦ͏ SFU GSBNFDBQSFBE  GSBNFDWqJQ GSBNF   HSBZDWDWU$PMPS GSBNF

    DW$0-03@#(3(3": Λ̍ʹ͠·͢ɻ
  117. ΋͏Ұ౓࣮ߦ ̍ʣϝχϡʔͷ36/ϘλϯΛԡ͢ ̎ʣ൓స͕௚ͬͨը૾͕ݟ͑Δ͸ͣɻ ̏ʣ֬ೝͰ͖ͨΒ4501Λԡ͢

  118. 5IPOOZͷ-PBEΛΫϦοΫͯ͠ ։͖GBDF̎QZΛબ୒ͯ͠ ։͖·͢ɻ PQFODWΛ࢖ͬͯإೝࣝΛ͢Δલʹ

  119. ࣮ߦ ̍ʣϝχϡʔͷ36/ϘλϯΛԡ͢ ̎ʣإͷྠֲͱ໨Λೝࣝ͠·͢ɻ

  120. Χεέʔυ෼ྨث ࣗ෼ͷإ͕ແࣄೝࣝͰ͖ͨΒFTDΩʔΛԡ͢ɻ΋͘͠͸4501 ͳʹ͔Λೝࣝ͢Δʹ͸ɺͦͷಛ௃Λநग़ͨ͠σʔλ͕ඞཁͰ ࠓճ࢖͍ͬͯΔͷ͕ʮΧεέʔυ෼ྨثʯͰ͢ɻ

  121. ⭐ਖ਼౴཰͸·ͩ·ׂ͙ͩ̕Β͍ͳͷͰɺਫ਼౓Λ͋͛Δ ࠓޙ͸͜ͷߨ࠲Λडߨͨ͠ܦݧΛੜ͔ͯ͠ ⭐ϦΞϧλΠϜͰ਺ࣈΛೝࣝͰ͖ΔΑ͏ʹ͢Δ ⭐ࣗ෼ͰσʔληοτΛ࡞ͬͯΈΔɹɹɹͳͲͳͲ

  122. ߨٛ͸͜ΕͰऴྃͰ͢ɻ ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ