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
770
ML Kit を Android で 動かしてみた
radiocat
June 14, 2018
Tweet
Share
More Decks by radiocat
See All by radiocat
アジャイルを支える心理的安全性の守破離 / Psychological safety for Agile
radiocat
1
500
経験ゼロからはじめる!10年以上続くプロダクトのアウトカム創出戦略 / Challenges of product management
radiocat
1
3.8k
変化の時代に活かす「みんなのプロジェクトマネジメント」 / Utilize project management for change
radiocat
0
1.4k
「中小企業のエンジニアチームを”楽”にする」を目指す組織マネジメントの変わる勇気と変えない勇気 / Challenge to Scrum 4
radiocat
2
2.8k
関西的なノリで変化の波をノリこなすチームの取り組み / 3 Steps and Kansai-soul to Riding the Waves of Change
radiocat
2
2.4k
スクラムちゃうがなと言われてもやってみぃひん? / Challenge to Scrum 3
radiocat
4
7.9k
Re:ゼロから始めるアジャイル開発 / restart agile
radiocat
3
1.5k
スクラム開発について / What is Scrum?
radiocat
0
390
アウトプット駆動読書術実践入門 / The Output-driven Reading Techniques 2
radiocat
2
650
Other Decks in Technology
See All in Technology
Autify Company Deck
autifyhq
1
30k
どう買う?Azure
kuniteru
1
190
生成AIサービスPanorama AIご説明資料
sdt
0
300
複数の LLM モデルを扱う上で直面した辛みまとめ
kazuyaseki
1
230
#51 “Empowering Azure Storage with RDMA”
cafenero_777
3
210
10分でわかるfreeeのQA
freee
0
230
Getting started with controlling LEGO using Swift
hcrane
0
130
OCI Data Integration技術情報 / ocidi_technical_jp
oracle4engineer
PRO
1
1.5k
オブジェクト指向宗教史
tanakahisateru
13
12k
Cloud Friendly(?) Jenkins. How we failed to make Jenkins cloud native and what we learned?
onenashev
PRO
0
110
Tohoku.Tech #1 「EC-CUBE/AWSの構築をChatGPTに相談してみました」by テンダ
jun2882
0
140
今さら聞けない!? AWSの生成AIサービス Amazon Bedrock入門!
minorun365
PRO
11
2.3k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
223
17k
The Mythical Team-Month
searls
214
42k
Optimizing for Happiness
mojombo
369
69k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
242
20k
Code Reviewing Like a Champion
maltzj
512
39k
Navigating Team Friction
lara
177
13k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
Bash Introduction
62gerente
604
210k
Art, The Web, and Tiny UX
lynnandtonic
288
19k
Practical Orchestrator
shlominoach
180
9.7k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Product Roadmaps are Hard
iamctodd
43
9.6k
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