Save 37% off PRO during our Black Friday Sale! »

Azure MLで試して学ぶAIによる自動走行とAIの仕組みハンズオン

7507885e7de2f5fa2a3e80a445236d89?s=47 masato-ka
August 22, 2020

Azure MLで試して学ぶAIによる自動走行とAIの仕組みハンズオン

7507885e7de2f5fa2a3e80a445236d89?s=128

masato-ka

August 22, 2020
Tweet

Transcript

  1. "[VSF.-Ͱࢼֶͯ͠Ϳ "*ʹΑΔࣗಈ૸ߦͱ"*ͷ࢓૊ΈϋϯζΦϯ "-(:"/Πϕϯτ !NBTBUP@LB ·͞ͱ͔ 

  2. ຊ೔ͷλΠϜεέδϡʔϧ • AI RC CARʹ͍ͭͯ(30෼) • ϋϯζΦϯύʔτ(120) • ؀ڥߏங(20෼) •

    ԋश̍(40෼) • ԋश̎(60෼)
  3. "*3$$"3ͱ͸ʁ ࢢൢϥδίϯ 4#$ "*ͱΧϝϥͷΈ -&7&-૬౰ͷ૸ߦ ੈքதͰϨʔε͕։࠵͞Ε͍ͯΔ ৄ͘͠͸IUUQNBTBUPLBIBUFOBCMPHDPN

  4. ϋʔυ͔Β"*·ͰϑϧελοΫ ϋʔυ΢ΣΞ "*$7੍ޚ ύΠϩοτదੑ "*Λத৺ͱͨ͠ΤϯδχΞϦϯάͷूେ੒ ৄ͘͠͸IUUQNBTBUPLBIBUFOBCMPHDPN

  5. "*3$$BS૸ߦͷखॱ 4FMG%SJWJOH $JSDVJU ……….. ڭࣔσʔλͷऩू "*ͷֶश ਪ࿦૸ߦ ϧʔϧΛ࡞Βͣʹσʔλ͔ΒϧʔϧΛ࠶ݱ͢Δ ৄ͘͠͸IUUQNBTBUPLBIBUFOBCMPHDPN

  6. ਤղ͜Ε͕"*3$$"3ͷ"*ͩʂ ը૾͔Βಛ௃తͳ෦෼Λநग़݁͠ՌΛܭࢉ͢Δ ৞ΈࠐΈ૚ $POW શ݁߹૚ 'VMMZ$POOFDUFE ೖྗ εςΞϦϯά ΞΫηϧ ը૾ͷಛ௃తͳ෦෼Λநग़

    ಛ௃͔Β݁ՌΛٻΊΔ ݁Ռ
  7. AIͷֶशͱ͸ʁ ৞ΈࠐΈ૚(Conv) શ݁߹૚(Fully-Connected) LOSS(໨తؔ਺ʣ 015*.*;&3 ೖྗ ͓खຊͱͷޡࠩΛ࠷খԽ͢ΔύϥϝʔλΛٻΊΔ ͓खຊ ݁Ռ ύϥϝʔλߋ৽

    ޡࠩͷܭࢉ
  8. DENSE4 DENSE3 DENSE2 DENSE1 FLAT CONV4 CONV3 ϏϧσΟϯάϒϩοΫͰߏ੒͞ΕΔAI ϥΠϒϥϦͷύʔπΛ૊Έ߹Θ࣮ͤͯݱ͢Δ CONV2

    LOSS OPTIMIZER CONV1
  9. ϋϯζΦϯύʔτ

  10. • 1. Azure Machine LearningΛ࢖ͬͨJupyter Notebook؀ڥͷߏங • 2. ԋश1. ڑ཭ηϯασʔλͱશ݁߹૚ʹΑΔࣗಈ૸ߦ

    • 3. ԋश2. CNNʹΑΔࣗಈ૸ߦͷֶश ϋϯζΦϯ
  11. ౸ୡ໨ඪ ͱΓ͋͑ͣɺࣗ෼ͰAIͷϓϩάϥϜ Λॻ͚ͦ͏ͳؾ͕ͨ͠Βউͪɻ

  12. 1. Azure Machine Learningͷߏங

  13. Azure Machine Learningͷ࡞੒(1/2) 1. Azure PortalͰAzure Machine LearningΛݕࡧ 2.Azure Machine

    Learningͷ࡞੒ΛԡԼ
  14. Azure Machine Learningͷ࡞੒(2/2) 3.ϫʔΫεϖʔεͷ࡞੒ ஫ҙϦʔδϣϯ͸ถࠃ౦෦ΛબͿ͜ͱ 4.಺༰Λ֬ೝޙɺ࡞੒

  15. Azure Machine Learning Studio 1.σϓϩΠ׬ྃޙɺϦιʔεʹҠಈΛԡԼ 2.Ϧιʔεը໘தԝԼଆʹදࣔ͞ΕΔϘλϯΛԡԼͯ͠ Azure Machine Learning StudioΛ։͘

  16. Notebooksͱԋश༻ϊʔτϒοΫͷ४උ 1.Azure Machine Learning StudioΛ։͍ͨΒNotebooksͷʮࠓ͙͢։࢝ʯΛԡԼ 2. Notebooksը໘ࠨଆͷϖΠϯΛ։͖ɺΞοϓϩʔυϘλϯ ͔Βԋश༻ͷϊʔτϒοΫΛΞοϓϩʔυ͢Δɻ https://drive.google.com/uc?export=download&id=1nEZFjS3gRR94vH7d0ZBa6tgdiaJsClV5 ԋश༻ϊʔτϒοΫ:

  17. ίϯϐϡʔςΟϯάϦιʔεͷ࡞੒ 1. GPUΠϯελϯεͷ্ཱͪ͛ 2. ΠϯελϯεͷىಈΛ଴ͭ 3.Jupyter NotebookΛ։͘

  18. • ফ͠ํ • ΠϯελϯεΛফ͢ • MLΛফ͢ • ϫʔΫεϖʔε ϋϯζΦϯऴྃޙͷΠϯελϯεͷ࡟আ ஫ҙɿϋϯζΦϯऴྃޙ͸ඞͣΠϯελϯεΛఀࢭɺ·ͨ͸࡟আ͠·͠ΐ͏ɻ

  19. Πϯελϯεͷ࡟আ 1. ࠨଆϝχϡʔͷʮ؅ཧʯ͔ΒίϯϐϡʔςΟϯάΛબ୒ 2. ࡞੒ͨ͠ΠϯελϯεʹνΣοΫΛೖΕͯʮ࡟আʯΛԡԼ

  20. Azure ML Workspaceͷ࡟আ 1. Azure ML Workspaceը໘Ͱʮ࡟আʯΛԡԼ͢Δɻ

  21. Ϧιʔεάϧʔϓͷ࡟আ 1.࡞੒ͨ͠ϦιʔεάϧʔϓΛબ୒͠ɺʮϦιʔεάϧʔϓͷ࡟আʯΛԡԼ͢Δ ɹ˞ ֬ೝͷͨΊɺ࡟আ͢ΔϦιʔεάϧʔϓ໊Λ໌ࣔతʹೖྗ͢Δɻ ผʹར༻͍ͯ͠ΔϦιʔεάϧʔϓͰ͋Ε͹ͦͷ··࢒͓ͯ͘͠ɻ

  22. 2. શ݁߹૚ʹΑΔࣗಈ૸ߦ

  23. ԋश1. શ݁߹૚ͷΈʹΑΔࣗಈ૸ߦ Input (5) Dense 16 ReLu Dense 16 ReLu

    output(2) •Optimizer: Adam - lr: 0.001 - Decay: 0.0 •Loss: MSE
  24. جຊͷશ݁߹૚ ઢܗɾඇઢܗͷม׵Λ܁Γฦ͠೚ҙͷؔ਺Λදݱ w11 i1 i2 i3 w21 w31 w12 w22

    w32 w13 W23 W33 o1 o2 o3 a1 a2 a3 activation(o1)=a1 activation(o2)=a2 activation(o3)=a3 ReLu ଟ૚ߏ଄ʹ͢Δ͜ͱͰ೚ҙͷؔ਺Λදݱ ֶशͰ͸8ͷ஋Λௐ੔͢Δ [i1 i2 i3] w11 w12 w13 w21 w22 w23 w31 w32 w33 + b = [o1 o2 o3] iW + b = o O i
  25. keras.layer.Dense https://www.tensorflow.org/api_docs/python/tf/keras/layers/Dense layers.Dense(16, activation='relu') layers.Dense(16, activation='relu', input_shape=(5,)) Ϣχοτ਺ ΞΫςΟϕʔγϣϯؔ਺ ೖྗ਺(NNͷೖྗͷΈࢦఆ)

    શ݁߹૚ͷఆٛ
  26. ڭࢣσʔλͱͷޡࠩΛܭࢉ͢Δ໨తؔ਺ "*ͷֶशํ޲ੑΛܾΊΔ .4& ฏۉೋ৐ޡࠩ $SPTT&OUSPQZޡࠩ શͯͷσʔλͱਪ࿦݁Ռͷޡࠩͷ૯࿨ͷೋ৐ ʔ ̎ AIͷਪ࿦݁Ռ͕͓खຊʹۙ͘ͳΕ͹஋͕খ͘͞ͳΔ ϥϕϧ͕ਖ਼ղͨ࣌͠ʹ஋͕খ͘͞ͳΔؔ਺

    ෼ྨ໰୊(ೣ͔ݘ͔ɺը૾ͷ਺ࣈ౰ͯ) 0.7 0.3 0.1 1.0 0.0 0.0
  27. ύϥϝʔλΛௐ੔͢ΔOptimizer ࠷ٸ߱Լ๏Ͱޡ͕ࠩখ͘͞ͳΔΑ͏ʹύϥϝʔλΛߋ৽ Loss Weight ޯ഑(ඍ෼) ٻΊ͍ͨ࠷খ஋ ɾSGD ɾAdam ɾRMSProp Α͘࢖ΘΕΔख๏

    ॳظ஋-αXޯ഑ ॳظ஋ ऩଋ͢Δ·Ͱஞ࣍ ܭࢉΛ܁Γฦ͢
  28. ԋश̎. CNNʹΑΔࣗಈ૸ߦ Input 120x160x3 kernel(5,5), 24, Stride(2,2), Relu kernel(5,5), 32,

    Stride(2,2), Relu kernel(5,5), 64, Stride(2,2), Relu kernel(3,3), 64, Stride(1,1), Relu kernel(3,3), 64, Stride(1,1), Relu Dense 100, Relu Dense 50, Relu Flatten output(2) •Optimizer: Adam - lr: 0.001 - Decay: 0.0 •Loss: MSE ૝ఆೖྗը૾(120x160x3) {"cam/image_array": “2584_cam-image_array_.jpg", "user/angle": 1.0, "user/throttle": 0.5, "user/mode": "user", "milliseconds": 272202} ڭࢣϥϕϧ
  29. ը૾ͷಛ௃Λநग़͢Δ৞ΈࠐΈ૚ Կ૚ʹ΋܁Γฦ͠ίʔεͷಛ௃Λֶश͢Δ 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5

    0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ϑΟϧλ஋ͱ֤ըૉͷੵΛ଍͜͠Ή .BY1PPMJOH૚ ֶशͰ͸ϑΟϧλͷॏΈΛௐ੔͢Δ
  30. ৞ΈࠐΈ૚ͷύϥϝʔλͷߟ͑ํ ύϥϝʔλΛௐ੔͢Δ͜ͱͰग़ྗͷαΠζΛௐ੔ W W W W W W W W

    W W W W W W W W W W W W W W W W W W W ೖྗ24x24x3(RGB) ϑΟϧλαΠζ3x3x2 W W W W W W W W W W W W W W W W W W W W W W W W W W W Stride:(1,1) ϑΟϧλΛಈ͔͢෯ (24)x(24)x2=1152 ࢀߟ:https://www.hellocybernetics.tech/entry/2016/12/23/000557 Isize + 2P − Fsize Stride + 1 = Output Padding:(1,1) ग़ྗը૾ͷपΓΛຒΊΔ 22 1 1 1 1 W W W W W W W W W Stride(1,1) ը૾ͷ୺·Ͱ 24-3+1=22
  31. Keras.layers.Conv2D layers.Conv2D(32, (5,5), strides =(2,2), activation="relu", name="conv2d_2"), layers.Conv2D(24, (5,5), strides

    =(2,2), input_shape=(120, 160, 3), activation="relu", name="conv2d_1"), https://www.tensorflow.org/api_docs/python/tf/keras/layers/Conv2D ϑΟϧλຕ਺ ϑΟϧλαΠζ ೖྗ਺ը૾αΠζ ετϥΠυ
  32. Keras.layers.Dropout layers.Dropout(0.2) ֶश࣌ʹར༻͠ͳ͍ॏΈΛ࡞ΓաֶशΛ๷͙ w11 i1 i2 i3 w21 w31 w12

    w22 w32 w13 W23 W33 o1 o2 o3 a1 a2 a3
  33. Keras.layers.MaxPooling2D https://tensorflow.org/api_docs/python/tf/keras/layers/MaxPool2D ϑΟϧλ಺Ͱ࠷େͷ஋Λ࠾༻͢Δ W W W W W W W

    W W layers.MaxPool2D(pool_size=(3, 3), strides=(3,3), padding='valid') ϓʔϧαΠζ ετϥΠυ
  34. ࣮͸/7*%*"ͷ࿦จͱ΄΅ಉ࣮͡૷ BOJARSKI, M., DEL TESTA, D., DWORAKOWSKI, D., FIRNER, B.,

    FLEPP, B., GOYAL, P., JACKEL, L. D., MONFORT, M., MULLER, U., ZHANG, J., ET AL. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316 (2016) Dense 100, Relu Dense 50, Relu Flatten output(2)
  35. /7*%*"ͷ࿦จʹཱͪ໭ͬͯΈ·͠ΐ͏ BOJARSKI, M., DEL TESTA, D., DWORAKOWSKI, D., FIRNER, B.,

    FLEPP, B., GOYAL, P., JACKEL, L. D., MONFORT, M., MULLER, U., ZHANG, J., ET AL. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316 (2016) ೖྗը૾ ̑૚ͷ৞ΈࠐΈ૚ Ͱಛ௃நग़ ̐૚ͷશ݁߹૚Ͱਓ ͷૢ࡞ϧʔϧΛ໛฿ 1࣍ݩ഑ྻʹม׵
  36. ྑ͍AIΛ࡞Δ࠷େͷ ίπ͸ྑ͍σʔλΛ ूΊΔ͜ͱͰ͢ɻ

  37. • શ݁߹૚ͱCNN • సҠֶश(෺ମݕग़ͳͲʣ • ϞσϧͷѹॖɺTensorFlow Lite, TensorFlow Lite for

    microcontroller • Edge TPUͱ͍ͬͨσΟʔϓϥʔχϯάΞΫηϥϨʔλɺϞόΠϧσόΠεͰͷਪ࿦ • PytorchͳͲͷผͷϥΠϒϥϦΛ৮ͬͯΈΔɻ • RNN΍LSTM, Transformer • AutoEncoder, GANͳͲੜ੒ܥϞσϧ AI؆୯ͩͳͱࢥͬͨΒઌʹਐ΋͏ ࠓ೔ཧղͨ͜͠ͱ͸શମ͔ΒݟͨΒ͘͝Ұ෦Ͱ͢
  38. ·ͱΊ "*։ൃΛͰ͖ͦ͏ͳؾ͕͠·͔ͨ͠ʁ ਓͷӡసͷ໛฿ͷ࢓૊Έ "*։ൃ͸ϏϧσΟϯϒϩοΫ ͔͜͜ΒֶࣗࣗशΛ࢝ΊΑ͏ ৄ͘͠͸IUUQNBTBUPLBIBUFOBCMPHDPN

  39. https://drive.google.com/uc?export=download&id=1YfYzN6TOKUiobD7S-qgPblrRl2ieS4ba ϋϯζΦϯͷ׬੒൛ϊʔτϒοΫ

  40. None