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
0
910
ML Kit を Android で 動かしてみた
radiocat
June 14, 2018
Tweet
Share
More Decks by radiocat
See All by radiocat
EMの仕事、あるいは顧客価値創出のアーキテクト
radiocat
0
300
アジャイルを支える心理的安全性の守破離 / Psychological safety for Agile
radiocat
1
840
経験ゼロからはじめる!10年以上続くプロダクトのアウトカム創出戦略 / Challenges of product management
radiocat
1
4.7k
変化の時代に活かす「みんなのプロジェクトマネジメント」 / Utilize project management for change
radiocat
0
1.9k
「中小企業のエンジニアチームを”楽”にする」を目指す組織マネジメントの変わる勇気と変えない勇気 / Challenge to Scrum 4
radiocat
2
3.9k
関西的なノリで変化の波をノリこなすチームの取り組み / 3 Steps and Kansai-soul to Riding the Waves of Change
radiocat
2
3.5k
スクラムちゃうがなと言われてもやってみぃひん? / Challenge to Scrum 3
radiocat
4
10k
Re:ゼロから始めるアジャイル開発 / restart agile
radiocat
3
1.7k
スクラム開発について / What is Scrum?
radiocat
0
560
Other Decks in Technology
See All in Technology
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
4
1.4k
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
380
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
130
SREが向き合う大規模リアーキテクチャ 〜信頼性とアジリティの両立〜
zepprix
0
470
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
1k
茨城の思い出を振り返る ~CDKのセキュリティを添えて~ / 20260201 Mitsutoshi Matsuo
shift_evolve
PRO
1
380
Context Engineeringの取り組み
nutslove
0
380
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
今こそ学びたいKubernetesネットワーク ~CNIが繋ぐNWとプラットフォームの「フラッと」な対話
logica0419
3
300
Frontier Agents (Kiro autonomous agent / AWS Security Agent / AWS DevOps Agent) の紹介
msysh
3
180
CDKで始めるTypeScript開発のススメ
tsukuboshi
1
530
Bedrock PolicyでAmazon Bedrock Guardrails利用を強制してみた
yuu551
0
260
Featured
See All Featured
Discover your Explorer Soul
emna__ayadi
2
1.1k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Bash Introduction
62gerente
615
210k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
470
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Building the Perfect Custom Keyboard
takai
2
690
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
250
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Leo the Paperboy
mayatellez
4
1.4k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Designing for humans not robots
tammielis
254
26k
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