【再開催】Raspberry PiとUSBカメラではじめようディープラーニング

【再開催】Raspberry PiとUSBカメラではじめようディープラーニング

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

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

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

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

88dae28e3d082236f37db2f5c2db339d?s=128

Miho Yamada

August 23, 2019
Tweet

Transcript

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

  2. ࣗݾ঺հ .BLF-4* 73"3 ࢁాඒึʢ΍·ͩΈ΄ʣ ʮ*P5Λ΋ͬͱ਎ۙʹɺ΋ͬͱָ͘͠ɻະདྷ΁ʯ ɹɹͰ͓ͳ͡Έͷɺגࣜձࣾ$FOUFS2୅දऔక໾ ɹɹ ɹɹঁࢠͩΒ͚ͷిࢠ޻࡞ओ࠵ ɹ

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

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

  5. 3BTQCFSSZ1J͸೔ຊͰ͸ϥζύΠͱݺͼ ਌͠·Ε͍ͯΔϫϯϘʔυϚΠίϯͰ͢ɻ 3BTQCFSSZ1JͷجૅΛֶͿ 3BTQCFSSZ1Jͱ͸ 3BTQCFSSZ1JΛ৮ͬͨ͜ͱ͕͋Δํ Ոʹ3BTQCFSSZ1J͕͋Δํ

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

  7. 3BTQCFSSZ1JͷجૅΛֶͿ 3BTQCFSSZ1Jͷछྨ ͋ͨΒ͘͠ ൃച͞Ε·ͨ͠ʂ ·ͩ೔ຊͰ͸ ະൃചͰ͢ʂ ൢചՁ֨͸ ˈʙ

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

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

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

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

    /00#4 ψʔϒεʣͱ͍͏04ͷΠϯετʔϥʔΛ࢖͏ͱศརͰ͢ɻ 3BTQCFSSZ1Jͷ04ʹ͍ͭͯʢNJDSP4% 3BTQCFSSZ1JͷجૅΛֶͿ
  12. 3BTQCFSSZ1JͱσΟʔϓϥʔχϯάͰͲΜͳ͜ͱ͕Ͱ͖Δͷʁɹɹ 㗍㘅㗆㘊㗮 ۜሯкй 㗋㘉㗂㗒㗮 ৣጯ

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  31. ਓ޻஌ೳͱػցֶशͱਂ૚ֶशͷؔ܎ ਓ޻஌ೳ ػցֶश ਂ૚ ֶश ೖྗ ग़ྗ "*ͱ.-ͱ%FFQ-FBSOJOH ʢػցʹίϯϐϡʔλʹֶशͤ͞Δ͜ͱʣ ʢόΠΦςΫϊϩδʔ

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

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

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

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

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

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

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

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

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

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

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

    UIPOOZNOJTUQZ ͱλʔϛφϧͰଧ͍ͬͯͩ͘͞ɻ खॻ͖਺ࣈͷσʔληοτ./*45
  43. 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Λ࢖͓͏
  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Λ࢖͓͏ LFSBTʹ༻ҙ͞Εͯ ͍Δ./*45ΛΠϯ ϙʔτͯ͠ɺը૾Λ දࣔͰ͖ΔΑ͏ʹ QMUͱઃఆ͢Δ
  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Λ࢖͓͏ NOJTUΛಡΈࠐΉ
  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. 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͕͍͔ͭ͘ग़·͕͢ ໰୊ͳ͍ͷͰ͠͹Β͘଴ͪ·͢
  48. 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Λ࢖͓͏ ×Ͱด͡Δ
  49. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͯ ֶशϞσϧΛ࡞Ζ͏ʂ ./*45Λ࢖ֶͬͯशϞσϧΛ ࡞ΔϓϩάϥϜ NOJTUQZΛ ࣄલʹೖΕ͓͖ͯ·ͨ͠ͷͰ 5IPOOZͷ-PBEΛΫϦοΫͯ͠ ։͖NOJTUQZΛબ୒ͯ͠ ։͖·͢ɻ

  50. खॻ͖਺ࣈͷσʔληοτ./*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ͷΠϯϙʔτ
  51. खॻ͖਺ࣈͷσʔληοτ./*45Λ࢖ͬͯ ֶशϞσϧΛ࡞Ζ͏ʂ 9@USBJO9@USBJOSFTIBQF    9@UFTU9@UFTUSFTIBQF   

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

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

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

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

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

      είΞʢਖ਼౴཰ʣΛग़ྗ͠·͢
  57. 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͕͍͔ͭ͘ग़·͕͢ ໰୊ͳ͍ͷͰ͠͹Β͘଴ͪ·͢
  58. 5IPOOZ 1ZUIPO*%&1ZUIPOͷॳ৺ऀ༻౷߹؀ڥ Λ࢖͏ खॻ͖਺ࣈͷσʔληοτ./*45 ਖ਼౴཰͸75.27%

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

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

     %FOTF   "DUJWBUJPO TPGUNBY  >  TJHNPJEΛ SFMVʹมߋ͢Δ
  61. 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͕͍͔ͭ͘ग़·͕͢ ໰୊ͳ͍ͷͰ͠͹Β͘଴ͪ·͢
  62. NPEFMDPNQJMF MPTTDBUFHPSJDBM@DSPTTFOUSPQZ PQUJNJ[FSTHE NFUSJDT<BDDVSBDZ>  NPEFMpU 9@USBJO Z@USBJO CBUDI@TJ[F WFSCPTF

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

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

    ൑ผʹඞཁͳ΋ͷΛΠϯϙʔτ͠·͢ ࣮ࡍʹखͰॻ͍ͨ਺ࣈΛಡΈࠐΜͰ ./*45Λ࢖ͬͯ൑ผ͠Α͏ʂ
  65. 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Λ࢖ͬͯ൑ผ͠Α͏ʂ
  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. None
  85. ը૾ೝࣝͤ͞Δҝͷ̎ͭͷϑΣʔζ ࣗಈͰը૾ೝࣝΛͤ͞Δʹ͸େ͖͘ೋͭͷϑΣʔζ͕͋Γ·͢ɻ ୈ̍ϑΣʔζɿֶशϞσϧΛͭ͘Δ ୈ̎ϑΣʔζɿֶशࡁΈϞσϧΛ࢖͏ σʔλ ॲཧ σʔλ ऩू ػցֶश ਂ૚ֶश

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

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

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

  89. 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ͱ ͍͏ֶशࡁΈ ϞσϧΛ࢖ͬͯ ը૾ೝࣝ ɹɹˣ είΞͰ݁Ռ͕ ͰΔ
  90. όφφը૾Ͱ࣮ߦ ̍ʣϝχϡʔͷ36/ϘλϯΛԡ͢ ̎ʣ4IFMMͷʮ3VONPEFMQZʯͱදࣔ͞ΕͯϓϩάϥϜ͕࣮ߦ͞Ε·͢ɻ 8BSOJOH͕ग़·͕͢໰୊ͳ͍Ͱ͢ɻ෼ඵఔ౓Ͱ݁Ռ͕ग़·͢ɻ ̍౓͚ͩΫϦοΫͯ͠ ͍ͩ͘͞ɻԿ౓΋ԡ͞ ͳ͍Α͏ʹɻʢॲཧ͕ ஗͘ͳΓ·͢ɻ

  91. 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ΛΠϯ ϙʔτ͢Δ
  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]))  ֶशࡁΈϞσϧΛ࢖ͬͨॲཧͷઆ໌ɿͦͷ *NBHF/FUͰֶश͠ ͨॏΈͱ *ODFQUJPO7 ͷجຊϞσϧ͕ಡ Έࠐ·ΕΔ
  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]))  ֶशࡁΈϞσϧΛ࢖ͬͨॲཧͷઆ໌ɿͦͷ ೝ͍ࣝͤͨ͞ը૾ ͷࢦఆͱը૾ͷα Πζͷॲཧ
  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. όφφͷ݁Ռ UIPOOZͱ͍͏σϑΥϧτͰ ೖ͍ͬͯΔQZUIPOͷ*%&Λ ࠓճ࢖͍·͢ɻ LFSBTΛ࢖ͬͨը૾ೝࣝΛ ࢼ͢ͷʹTBNQMFQZΛ ։͖·͢ɻ DEd UIPOOZTBNQMFQZ ͱλʔϛφϧͰଧ͍ͬͯͩ͘͞ɻ

    είΞ όφφͱೝࣝ
  98. 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ʹ มߋ͢Δ ɹɹˣ ಉ͡Α͏ʹ࣮ߦ ͯ݁͠ՌΛΈΔ
  99. ΓΜ͝ը૾Ͱ࣮ߦ ̍ʣϝχϡʔͷ36/ϘλϯΛԡ͢ ̎ʣ4IFMMͷʮ3VONPEFMQZʯͱදࣔ͞ΕͯϓϩάϥϜ͕࣮ߦ͞Ε·͢ɻ ಉ͡Α͏ʹ̎෼̏̌ඵఔͰ݁Ռ͕ग़·͢ɻͲͷΑ͏ͳ݁ՌʹͳΔͰ͠ΐ͏͔ʁʁ

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

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

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

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

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

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

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

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

  108. .JDSPTPGU"[VSF 㘒Դ͜㗗㗦 ३إк֛ &NPUJPO"1* ൴ʃۨ㘞㙔㙜 3BTQCFSSZ1J 㘞㙔㙜㗧 ᅦᅂ㗗㗟㷻྅ 3BTQCFSSZ1JͱػցֶशΛ࢖ͬͨྫɹɹɹɹ 3BTQCFSSZ1JΛ࢖ͬͨ࡞඼ΛԠืͯ͠ΈΑ͏ʂɹɹɹ

  109. ΧϝϥͰࡱͬͨը૾ͷ݁Ռ Έͳ͞Μ͸ԿΛ ࡱӨ͠·͔ͨ͠ʁ ݁ՌΛͥͻڭ͑ͯ ͍ͩ͘͞

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

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

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