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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
radiocat
June 14, 2018
Technology
930
0
Share
ML Kit を Android で 動かしてみた
radiocat
June 14, 2018
More Decks by radiocat
See All by radiocat
EMの仕事、あるいは顧客価値創出のアーキテクト
radiocat
0
320
アジャイルを支える心理的安全性の守破離 / Psychological safety for Agile
radiocat
1
870
経験ゼロからはじめる!10年以上続くプロダクトのアウトカム創出戦略 / Challenges of product management
radiocat
1
4.8k
変化の時代に活かす「みんなのプロジェクトマネジメント」 / 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
The Journey of Box Building
tagomoris
4
3.2k
Shipping AI Agents — Lessons from Production
vvatanabe
0
280
AI時代における技術的負債への取り組み
codenote
1
1.7k
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
460
コードや知識を組み込む / Incorporate Code and Knowledge
ks91
PRO
0
160
社内エンジニア勉強会の醍醐味と苦しみ/tamadev
nishiuma
0
230
Chasing Real-Time Observability for CRuby
whitegreen
0
190
Do Ruby::Box dream of Modular Monolith?
joker1007
1
350
No Types Needed, Just Callable Method Check
dak2
1
1.5k
ハーネスエンジニアリングの概要と設計思想
sergicalsix
9
5.1k
Do Vibe Coding ao LLM em Produção para Busca Agêntica - TDC 2026 - Summit IA - São Paulo
jpbonson
3
140
ServiceNow Knowledge 26 の歩き方
manarobot
0
120
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3k
Balancing Empowerment & Direction
lara
6
1.1k
Ruling the World: When Life Gets Gamed
codingconduct
0
210
The SEO Collaboration Effect
kristinabergwall1
1
420
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
How to Think Like a Performance Engineer
csswizardry
28
2.6k
ラッコキーワード サービス紹介資料
rakko
1
3.1M
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
260
The Curious Case for Waylosing
cassininazir
0
310
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
150
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
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