Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ML Kit を Android で 動かしてみた
Search
radiocat
June 14, 2018
Technology
0
920
ML Kit を Android で 動かしてみた
radiocat
June 14, 2018
Tweet
Share
More Decks by radiocat
See All by radiocat
EMの仕事、あるいは顧客価値創出のアーキテクト
radiocat
0
310
アジャイルを支える心理的安全性の守破離 / Psychological safety for Agile
radiocat
1
850
経験ゼロからはじめる!10年以上続くプロダクトのアウトカム創出戦略 / Challenges of product management
radiocat
1
4.7k
変化の時代に活かす「みんなのプロジェクトマネジメント」 / Utilize project management for change
radiocat
0
1.9k
「中小企業のエンジニアチームを”楽”にする」を目指す組織マネジメントの変わる勇気と変えない勇気 / Challenge to Scrum 4
radiocat
2
4k
関西的なノリで変化の波をノリこなすチームの取り組み / 3 Steps and Kansai-soul to Riding the Waves of Change
radiocat
2
3.6k
スクラムちゃうがなと言われてもやってみぃひん? / Challenge to Scrum 3
radiocat
4
10k
Re:ゼロから始めるアジャイル開発 / restart agile
radiocat
3
1.7k
スクラム開発について / What is Scrum?
radiocat
0
570
Other Decks in Technology
See All in Technology
JAWSDAYS2026_A-6_現場SEが語る 回せるセキュリティ運用~設計で可視化、AIで加速する「楽に回る」運用設計のコツ~
shoki_hata
0
3k
Dr. Werner Vogelsの14年のキーノートから紐解くエンジニアリング組織への処方箋@JAWS DAYS 2026
p0n
1
140
[JAWSDAYS2026]Who is responsible for IAM
mizukibbb
0
690
マルチアカウント環境でSecurity Hubの運用!導入の苦労とポイント / JAWS DAYS 2026
genda
0
700
楽しく学ぼう!ネットワーク入門
shotashiratori
1
380
Zeal of the Convert: Taming Shai-Hulud with AI
ramimac
0
100
Google系サービスで文字起こしから勝手にカレンダーを埋めるエージェントを作った話
risatube
0
190
Abuse report だけじゃない。AWS から緊急連絡が来る状況とは?昨今の攻撃や被害の事例の紹介と備えておきたい考え方について
kazzpapa3
1
720
Scrumは歪む — 組織設計の原理原則
dashi
0
180
OCHaCafe S11 #2 コンテナ時代の次の一手:Wasm 最前線
oracle4engineer
PRO
2
130
マルチプレーンGPUネットワークを実現するシャッフルアーキテクチャの整理と考察
markunet
2
250
OCI Security サービス 概要
oracle4engineer
PRO
2
13k
Featured
See All Featured
How to make the Groovebox
asonas
2
2k
The Invisible Side of Design
smashingmag
302
51k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
470
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
550
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
150
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
81
Utilizing Notion as your number one productivity tool
mfonobong
4
260
Code Reviewing Like a Champion
maltzj
528
40k
How to train your dragon (web standard)
notwaldorf
97
6.6k
So, you think you're a good person
axbom
PRO
2
2k
Transcript
ML Kit を Android で 動かしてみた 2018.6.14 / @radiocatz Osaka
Mix Leap Study #16 - Android JetPack 勉強会 - LT
おしごと 現職:株式会社 ラクス 所属:楽楽精算 開発チーム リーダー/スクラムマスター About me radiocat Twitter
: @radiocatz Android派/Vim派/野球派/KIRINビー ル派 HTC DesireからAndroidユーザー Blog : http://radiocat.hatenablog.com/ Qiita : https://qiita.com/radiocat GitHub : https://github.com/radiocat Androidアプリ 社内の勉強会の運営もやってます 共同開催・ゲスト登壇募集中!
ML Kitについて
ML Kit for Firebase • Android/iOS向け機械学習SDK • Google I/O 2018で発表
• 現在パブリックベータ • Googleに訓練されたMLモデルを利用可能 • TensorFlow Liteの自作モデル(Custom Models)も利用可能 • 2種類のAPI ◦ On-device:デバイスに組み込んで通信なしで使える軽量なモデル ◦ In the Cloud:クラウド上の高度なモデル
MLモデルAPIについて
None
On-device/Cloud
On-deviceで使えるAPI 無料で使える • 顔検出 • バーコードスキャン • 自作モデル • テキスト認識(※In
the Cloudでも使える) ◦ Latin-based languageのみ • 画像のラベル付け(※In the Cloudでも使える) ◦ 400+ labels
In the Cloudで使えるAPI Cloud Vision APIを使う Firebase の課金プランを Blaze(従量制課金)にする必要がある •
ランドマーク認識 • テキスト認識(※On-deviceでも使える) ◦ 多言語対応(日本語を使いたいならこちら) • 画像のラベル付け(※On-deviceでも使える) ◦ 1000+ labels ※On-device/In the Cloudの両方で使う場合はそれぞれ実装する
使い方
build.gradleへ追加 ML Kitの依存ライブラリ Google Services implementation 'com.google.firebase:firebase-ml-vision:16.0.0' implementation 'com.google.firebase:firebase-ml-vision-image-label-model:15.0.0' implementation
'com.google.firebase:firebase-ml-model-interpreter:16.0.0' apply plugin: 'com.google.gms.google-services'
画像のラベル付けの場合① FirebaseVisionImageオブジェクトを作る FirebaseVisionLabelDetectorのインスタンスを取得する FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bitmap); FirebaseVisionLabelDetector detector =
FirebaseVision.getInstance() .getVisionLabelDetector();
画像のラベル付けの場合② Task<List<FirebaseVisionLabel>> result = detector.detectInImage(image) .addOnSuccessListener( new OnSuccessListener<List<FirebaseVisionLabel>>() { @Override
public void onSuccess(List<FirebaseVisionLabel> labels) { // 取得成功した場合の処理 } }) .addOnFailureListener( // 以下略
画像のラベル付けの場合③ ラベル付きオブジェクトの情報を取得 for (FirebaseVisionLabel label: labels) { String text =
label.getLabel(); String entityId = label.getEntityId(); float confidence = label.getConfidence(); }
それぞれのAPI向けのDetectorが用意されている 扱い方はだいたい同じ 参考:ML Kit for Firebase | Firebase https://firebase.google.com/docs/ml-kit/ On-device
Cloud FirebaseVisionTextDetector FirebaseVisionCloudDocumentTextDetector FirebaseVisionFaceDetector ー FirebaseVisionBarcodeDetector ー FirebaseVisionLabelDetector FirebaseVisionCloudLabelDetector ー FirebaseVisionCloudLandmarkDetector
試してみる
手っ取り早く公式のサンプルアプリをビルド 1. Firebaseプロジェクトを作成しgoogle-services.jsonをダウンロード 2. https://github.com/firebase/quickstart-android を git clone 3. quickstart-android/mlkitをAndroid
Studioでインポート 4. google-services.jsonをmlkit/appの下に配置してビルド
Demo
所感 • 仕組み的にはVision APIとTensorFlow Liteモデルなどの既存機能をSDKにパッケー ジングして使いやすくした感じ • と言うとたいしたことなく聞こえるけどリアルタイムでMLの予測が動くのはすごい • これがSDKを使うだけで誰でも作れそうなことに恐怖すら感じた
• しかもOn-deviceだけ使うなら無料!
Thank you
References • Google Developers Blog: Introducing ML Kit ◦ https://developers.googleblog.com/2018/05/introducing-ml-kit.html
• Y.A.M の 雑記帳: I/O Recap : ML Kit 情報まとめ(Android 向け) ◦ https://y-anz-m.blogspot.jp/2018/05/io-recap-ml-kit-android.html • Google OS実験室 ~Moonlight 明日香~ : Google ML Kit試してみた! ◦ http://google-os.blog.jp/archives/50874071.html