Azureで試して学ぶAI CAR自動走行の仕組みハンズオン

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

Azureで試して学ぶAI CAR自動走行の仕組みハンズオン

7507885e7de2f5fa2a3e80a445236d89?s=128

masato-ka

August 08, 2020
Tweet

Transcript

  1. "[VSFͰࢼֶͯ͠Ϳ "*$"3ͷࣗಈ૸ߦͷ࢓૊ΈϋϯζΦϯ "-(:"/Πϕϯτ !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ͷ࡞੒(1/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=1NgP4of1gvZ51eohkX6mWHhRHU_GI9u1P ԋश༻ϊʔτϒοΫ:

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

  18. • ࡞੒த • جຊతʹ͸ ࡞੒ͨ͠Πϯελϯεͷ࡟আͱAzure Machine Learningͷ࡟আͷ̎εςοϓͰ͢ɻ ϋϯζΦϯऴྃޙͷΠϯελϯεͷ࡟আ

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

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

    output(2) •Optimizer: Adam - lr: 0.001 - Decay: 0.0 •Loss: MSE
  21. جຊͷશ݁߹૚ ઢܗɾඇઢܗͷม׵Λ܁Γฦ͠೚ҙͷؔ਺Λදݱ 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
  22. 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ͷೖྗͷΈࢦఆ)

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

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

    ॳظ஋-αXޯ഑ ॳظ஋ ऩଋ͢Δ·Ͱஞ࣍ ܭࢉΛ܁Γฦ͢
  25. ԋश̎. 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} ڭࢣϥϕϧ
  26. ը૾ͷಛ௃Λநग़͢Δ৞ΈࠐΈ૚ Կ૚ʹ΋܁Γฦ͠ίʔεͷಛ௃Λֶश͢Δ 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૚ ֶशͰ͸ϑΟϧλͷॏΈΛௐ੔͢Δ
  27. ৞ΈࠐΈ૚ͷύϥϝʔλͷߟ͑ํ ύϥϝʔλΛௐ੔͢Δ͜ͱͰग़ྗͷαΠζΛௐ੔ 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
  28. 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 ϑΟϧλຕ਺ ϑΟϧλαΠζ ೖྗ਺ը૾αΠζ ετϥΠυ
  29. 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
  30. Keras.layers.MaxPooling2D https://tensorflow.org/api_docs/python/tf/keras/layers/MaxPool2D ࡞੒தʢ8݄22೔ʹ͸Ͱ͖ͯΔʣ ϋϯζΦϯͰ࢖͏͔ݕ౼த

  31. ࣮͸/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)
  32. /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࣍ݩ഑ྻʹม׵
  33. ྑ͍AIΛ࡞Δ࠷େͷ ίπ͸ྑ͍σʔλΛ ूΊΔ͜ͱͰ͢ɻ

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

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

  36. None