Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Core MLのアップデートを3倍楽しむ方法 #wwdctokyo

shu223
June 22, 2020

Core MLのアップデートを3倍楽しむ方法 #wwdctokyo

shu223

June 22, 2020
Tweet

More Decks by shu223

Other Decks in Programming

Transcript

  1. Core MLͷΞοϓσʔτ
    Λ3ഒָ͠Ήํ๏
    #wwdctokyo

    View full-size slide

  2. Core MLͷ৽ػೳɺ
    Ͳ͏৘ใऩू͠·͔͢ʁ

    View full-size slide

  3. WWDCͷηογϣϯΛݟΔ

    View full-size slide

  4. WWDCηογϣϯͰ͸
    ͢΂ͯͷ৽API΍ͦͷ࣮૷ํ๏Λ
    ղઆ͍ͯ͠ΔΘ͚Ͱ͸ͳ͍

    View full-size slide

  5. ྫɿ Core ML 3Ͱ௥Ճ͞Εͨ100Ҏ্ͷ৽ϨΠϠʔ
    • WWDCͰͷݴٴ͸͜Ε͚ͩʗ௥ՃϨΠϠʔͷҰཡ͢Βͳ͍

    View full-size slide

  6. Core MLͷ৽ػೳɺ
    Ͳ͏৘ใऩू͠·͔͢ʁ

    View full-size slide

  7. Core MLͷAPIϦϑΝϨϯεΛݟΔ

    View full-size slide

  8. • CoreML.framework͸࠷ऴతͳϞσϧʢmlmodelʣΛiOSͰѻ
    ͏෦෼͔͠ఏڙ͠ͳ͍

    View full-size slide

  9. • CoreML.framework͸࠷ऴతͳϞσϧʢmlmodelʣΛiOSͰѻ
    ͏෦෼͔͠ఏڙ͠ͳ͍
    ʮCore MLͰͰ͖Δ͜ͱʯ͸ϞσϧʹӅṭ͞Ε͍ͯΔ͜ͱ΋ଟ
    ͍

    View full-size slide

  10. ৽ػೳͷৄࡉ͕CoreML.framework
    ͷAPI͔Β͸ݟ͑ͯ͜ͳ͍͜ͱ΋ଟ͍

    View full-size slide

  11. ྫɿ
    • ͲΜͳ৽ϨΠϠʔ͕αϙʔτ͞Εͨͷ͔ʁ
    • ΫΥϯλΠζʢϞσϧαΠζΛখ͘͢͞Δػೳʣ
    • ΦϯσόΠεֶश͸Կ͕Ͱ͖ͯԿ͕Ͱ͖ͳ͍ͷ͔ʁ

    View full-size slide

  12. ΋ͬͱָ͠Ήʹ͸

    View full-size slide

  13. coremltoolsϦϙδτϦΛݟΔʂ

    View full-size slide

  14. ಛʹ͜͜: mlmodel/formatϑΥϧμ

    View full-size slide

  15. • Core MLϞσϧϑΝΠϧʢ.mlmodelʣ͸ɺProtocol Buffers
    Λϕʔεͱ͢ΔΦʔϓϯͳϑΥʔϚοτ
    • Ϟσϧ࢓༷͸coremltoolsϦϙδτϦͰެ։͞Ε͍ͯΔ
    • → mlmodel/format഑Լʹ͋Δ.protoϑΝΠϧ܈͕ͦΕ

    View full-size slide

  16. ྫɿ NeuralNetwork.proto
    χϡʔϥϧωοτϫʔΫʹ͓͍ͯར༻ՄೳͳϨΠϠʔ͕͜͜Ͱ
    ఆٛ͞Ε͍ͯΔ
    ConvolutionLayerParams convolution = 100;
    PoolingLayerParams pooling = 120;
    ActivationParams activation = 130;
    InnerProductLayerParams innerProduct = 140;
    EmbeddingLayerParams embedding = 150;
    ...
    → ίϛοτཤྺ͔Β༰қʹʮ৽ͨʹ௥Ճ͞ΕͨϨΠϠʔ͸ͲΕ
    ͳͷ͔ʯΛ֬ೝͰ͖Δ

    View full-size slide

  17. ྫɿ Model.proto
    • Core MLϞσϧ࢓༷ͷϧʔτతͳprotoϑΝΠϧ
    • େ࿮ͱͯ͠Ͳ͏͍͏ػೳ͕௥Ճ͞Ε͔ͨ͸͜͜Ͱ͔ͭΊΔ
    message Model {
    int32 specificationVersion = 1;
    ModelDescription description = 2;
    bool isUpdatable = 10;
    oneof Type {
    // pipeline starts at 200
    PipelineClassifier pipelineClassifier = 200;
    PipelineRegressor pipelineRegressor = 201;
    Pipeline pipeline = 202;
    // regressors start at 300
    GLMRegressor glmRegressor = 300;
    ...

    View full-size slide

  18. examplesϑΥϧμ΋௒༗ӹ
    • ৽ػೳΛ࢖͏αϯϓϧ͕ஔ͍ͯ͋Δ
    • ৄࡉͳղઆίϝϯτ͖ͭ

    View full-size slide

  19. ͞Βʹָ͠Ήʹ͸

    View full-size slide

  20. ެࣜϞσϧ഑෍ϖʔδΛݟΔ

    View full-size slide

  21. • ಉ༷ͷϞσϧ͕໺ྑͰطʹग़͍ͯΔ৔߹΋ଟ͍͕ɺ΍͸Γެ
    ࣜͷํ͕඼࣭͕ߴ͍͜ͱ͕ଟ͍
    • ࡢ೥΋৽APIൃදͷλΠϛϯάͰ͍͔ͭ͘௥Ճ͞Εͨɹ

    View full-size slide

  22. Create ML΍Turi CreateͷΞοϓσʔτ΋ݟΔ
    • Create ML͸खܰʹϞσϧΛͭ͘ΕΔ͕ʮΦϞνϟʯͰ͸શ
    વͳ͍
    • TensorFlow΍PyTorchͰ࡞੒ͨ͠ϞσϧΑΓ΋༏Ε͍ͯΔ఺
    ͢Β͋Δ
    • खܰʹຊ֨తͳΧελϜϞσϧΛ࡞੒Ͱ͖ΔΑ͏ʹͳΔͷͩ
    ͔ΒɺʮԿ͕Ͱ͖Δ͔ʯ͙Β͍͸೺Ѳ͓͍ͯͨ͠ํ͕Α͍

    View full-size slide

  23. ظ଴͢ΔΞοϓσʔτ

    View full-size slide

  24. noteʹॻ͖·ͨ͠

    View full-size slide

  25. ·ͱΊ
    • Core MLͷ৽ػೳΛΩϟονΞοϓ͢Δʹ͸WWDCηογϣ
    ϯ΍Core MLϑϨʔϜϫʔΫͷAPIϦϑΝϨϯεͰ͸ෆे෼
    • coremltoolsϦϙδτϦΛݟΑ͏
    • Core MLϞσϧʢ.mlmodelʣ͸ϓϩτίϧόοϑΝϕʔε
    ͷΦʔϓϯͳϑΥʔϚοτɻͦͷఆٛ͸͢΂ͯ͜ͷϦϙδ
    τϦʹ͋Δɻ
    • αϯϓϧϑΥϧμ΋༗ӹ

    View full-size slide

  26. ࠷ޙʹએ఻

    View full-size slide

  27. Core ML ToolsຊɺηʔϧதͰ͢
    • 3500ԁˠ1500ԁʢࢴ+ిࢠͷηοτʣ
    • ిࢠ൛͸Ξοϓσʔτ͞ΕΔͷͰҰ੾ଛ͸͋Γ·ͤΜʂ

    View full-size slide

  28. WWDC2020Ͱษڧͨ͜͠ͱΛॻ͍͍ͯ͘༗ྉϚΨδϯ
    • ·ͩهࣄ͕ͳ͍ͷͰࠓͳΒͨͬͨͷ500ԁʂ
    • ʢαϒεΫͰ͸ͳ͘ങ͍੾ΓͰ͢ʣ

    View full-size slide