Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
モバイルアプリで機械学習入門/introduction-to-machine-learning...
Search
marchin
December 09, 2021
Programming
0
490
モバイルアプリで機械学習入門/introduction-to-machine-learning-in-mobile-app
marchin
December 09, 2021
Tweet
Share
More Decks by marchin
See All by marchin
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
770
Amazon Athenaで気軽に始める データ分析/athena-data-analytics
marchin1989
0
590
WebAPI開発のためのOpenAPI入門/entry-open-api
marchin1989
1
1.3k
AWS Glueではじめるデータレイク
marchin1989
0
670
やさしく入門するOAuth2.0/easy-entry-oauth
marchin1989
8
2.4k
1時間半で克服するJavaScriptの非同期処理/async_javascript_kokufuku
marchin1989
2
1.5k
自動テストでモックするって、なにそれ?おいしいの?/what_is_mocking
marchin1989
1
1.2k
たぶんもう怖くないGit/maybe-not-afraid-of-git-anymore
marchin1989
2
2.6k
Other Decks in Programming
See All in Programming
【Streamlit x Snowflake】データ基盤からアプリ開発・AI活用まで、すべてをSnowflake内で実現
ayumu_yamaguchi
1
120
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
220
ID管理機能開発の裏側 高速にSaaS連携を実現したチームのAI活用編
atzzcokek
0
210
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
600
Integrating WordPress and Symfony
alexandresalome
0
150
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
7
1k
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
110
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
260
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
6
1.8k
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
TypeScript 5.9 で使えるようになった import defer でパフォーマンス最適化を実現する
bicstone
1
1.3k
JETLS.jl ─ A New Language Server for Julia
abap34
1
320
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.8k
The Cost Of JavaScript in 2023
addyosmani
55
9.3k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
GraphQLとの向き合い方2022年版
quramy
50
14k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Designing Experiences People Love
moore
143
24k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Mobile First: as difficult as doing things right
swwweet
225
10k
A Tale of Four Properties
chriscoyier
162
23k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
A designer walks into a library…
pauljervisheath
210
24k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
Transcript
モバイルアプリで機械学習入門 ML Kitを使ったカメラアプリ実装
自己紹介 - 名前: 阿部 - 仕事: 主にAndroidエンジニア - 最近はサーバサイド Kotlinの仕事も始めました
- 趣味 - コーヒー、ビール、アニメ、ゲーム、読書、 etc... - Twitter: @marchin_1989
アジェンダ - on-device machine learning とは - MLKitの紹介 - MLKit
Face Detectionの機能の説明とデモンストレーション
on-device machine learning(on-device ML)とは - サーバ側ではなく、モバイルといったクライアントサイドで機械学習を行うこと
- 要件によるが以下のようなことを検討して決める。 クライアント(on-device)、サーバ、どちらでMLするか クライアント (on-device ML) リアルタイムに処理したい (ネットワーク通信の遅延がない ) データをサーバにあげたくない
ネットワークに繋げられない サーバ マシンパワーが必要 常に最新のモデルを使う必要がある 学習済みモデルを守りたい
on-device MLの例(スマホアプリ) - Google翻訳 - YouTube(AR Beauty Try-On) 出典: ITmedia
NEWS https://www.itmedia.co.jp/news/articles/1906/20/news069.html 出典: Google Play https://play.google.com/store/apps/details?id=com.google.android.apps.translate
on-device MLの機能を実装するためのフレームワーク - モバイル端末上で推論するためのフレー ムワーク。 - tensor flowで作ったモデルをtensor flow liteのモデルに変換できる
- Android, iOS, IoTデバイスで利用可能 - TensorFLow hubに学習済みのモデルが 提供されていたりする - よくある機械学習のユースケースと学習済み モデルをラップして、使いやすくしたもの。 - 機能によってはカスタムの TensorFlow Lite のモデルが使える。 - Android, iOSで利用可能
on-device MLをスクラッチで作成すると... 出典: Google I/O 2021 TensorFlowセッション ML Kit: Turnkey
APIs to use on-device ML in mobile apps | Session https://www.youtube.com/watch?v=CQ8iEqblWtY
ML Kitを使うと... 出典: Google I/O 2021 TensorFlowセッション ML Kit: Turnkey
APIs to use on-device ML in mobile apps | Session https://www.youtube.com/watch?v=CQ8iEqblWtY
ML Kitの機能 出典: Google Developers blog https://developers.googleblog.com/2021/03/ml-kit-is-now-in-ga-introducing-selfie.html
ML Kitの機能 出典: Google Developers blog https://developers.googleblog.com/2021/03/ml-kit-is-now-in-ga-introducing-selfie.html
Face detectionの機能 - 顔認識 - 画像内のどこに顔があるのか認識(複数の顔も可能) - 顔のトラッキング - 一度認識した顔を、流れてくる画像に対してトラッキングしてくれる。
- ランドマーク - 顔の輪郭や、左目、右目、眉毛、口、鼻の位置などが画像内のどこにあるか - 分類 - 目が開いているのか、閉じているのか - 笑っているのか 出典: ML Kit Guides https://developers.google.com/ml-kit/vision/face-detection/face-detection-concepts
Face detectionの実装 - 依存モジュールを組み込む - 推論対象のイメージを渡す - 推論結果を処理する
Face detectionの実装
作ってみた(デモ) - 笑顔を認識して、自動で写真を撮ってくれるカメラアプリ(Android) - セルフィーでボタンが押しづらい - 全員笑ってる写真を撮りたい etc - Face
detectionを使う - https://developers.google.com/ml-kit/vision/face-detection
サンプルアプリの実装の概略 - CameraXを利用 - FaceDetectorがMLKitのクラス
TensorFlow Lite or MLKit? - まずはMLKitがおすすめ - 認識精度、パフォーマンスが悪いなど要件が合わなければ TensorFlow Liteを検討
- 自前でモデルを作ったとしても、推論結果をアプリで使いやすいように実装する必要がある - MLKitが認識できない例 - どの国の国旗か - どの会社のロゴか - その人が誰なのか - どのブランドの製品なのか - どの昆虫の種類なのか
on-device ML向けのモデルを作るには? - TensorFlowでモデルを作り、TensorFlow Liteに変換 - AutoML - TensorFlow Lite
Model Maker - 転移学習を用いて、 on-device向けにモデルを作成できるライブラリ。
on-device MLを組み込むときに迷ったら - On-Device Machine Learning - https://developers.google.com/learn/topics/on-device-ml - プラットフォームやユースケースを選ぶと、適切な方法を提示してくれる。
まとめ - まずはMLKitがおすすめ - やりたいことに応じて、自分でモデルを作るか検討しましょう