SlideShare a Scribd company logo
Understanding on-device Machine machine learning
ML-Kit by Google
Vishrut Goyani
Android developer
vishrutgoyani9
vishrut.goyani3
What is ML-Kit?
Tell me more, I'm listening
• ML Kit is a mobile SDK that brings Google's on-device machine learning
expertise to Android and iOS apps.
• Use powerful yet easy to use Vision and Natural Language APIs to solve
common challenges in your apps or create brand-new user experiences.
• ML Kit's APIs all run on-device, allowing for real-time use cases where you
want to process a live camera stream for example. This also means that the
functionality is available offline.
Offerings
• Text recognition
• Face detection
• Face mesh detection
• Pose detection
• Selfie segmentation
• Subject segmentation
• Document scanner
• Barcode scanning
• Image labelling
• Object detection
• Digital ink recognition
• Language identification
• Translation
• Smart reply
• Entity extraction
Vision Natural language
Wait, there is one more!
Firebase ML
Firebase ML - Is it same?
What is it?
• Firebase Machine Learning is a mobile SDK that brings Google's machine
learning expertise to Android and Apple apps in a powerful yet easy-to-use
package.
• Firebase ML provides the ability to deploy custom models to your users'
devices by uploading them to our servers.
• It allows you to keep your app's initial install size small, and you can swap the
ML model without having to republish your app.
Offerings
• Text recognition
• Image labeling
• Object detection and tracking
• Face detection and contour
tracing
• Barcode scanning
• Language identification
• Translation
• Smart reply
Vision Natural language
Well, Here's the difference
ML-Kit
• On-device machine learning for
common tasks
• Faster for simpler tasks
• Excellent offline performance
• Simpler to set up and use
• Need to update the app when updating
the mode
Firebase ML
• On-device and cloud-based machine
learning
• Higher accuracy for complex tasks
• Limited offline performance
• More complex for cloud-based models
• Update your models on cloud without
requiring the app update
Google ML-Kit - Understanding on-device machine learning
Image labelling using ML-Kit
Let’s Cook!
Ingredients :
• Android Studio
• Java/Kotlin
• Knowledge of Asynchronous programming like
Threads or Coroutines
• Android device or emulator (Obviously the
device will be better)
First things first - Dependencies!
Google ML-Kit - Understanding on-device machine learning
The difference :-
Base model capabilities :-
Custom model implementation :-
Download custom model Implementation guide
Dependencies:-
In your app level gradle file
To ensure that gradle doesn’t compress the model file when building the app
Create Image object :-
Google ML-Kit - Understanding on-device machine learning
Calculate image rotation
To load the downloaded custom model
Make an instance of image labeler
For base model:
For custom model:
Run the image labeler :-
Get information about labeled objects
Now, you can use this information to group images by label names
Finally, We have done it…!
Wait, You got 10000+ photos? I’m screwed.
Time to go asynchronous 🙌🏻
Threads or Coroutine?
The difference
• Execution of Threads is heavyweight
• It’s complex and can lead to unexpected
behavior upon cancellation
• Best suitable for simple & long running
tasks
• OS managed
• Basic tasks requires fine-grained control
Threads Coroutines
• Coroutines are lightweight
• Structured and graceful cancellation
• Can be used for complex tasks with
efficiency
• Dispatcher managed
• Handle complex asynchronous tasks
efficiently
Hence proved, Coroutine is the way to go 🙌🏻
Implementation :
In your gradle file,
Basics : launch, async and runBlocking
To work with coroutines, Kotlin provides three basic building blocks: launch, async, and runBlocking.
1. Launch
Launch is used to fire and forget coroutine. It’s perfect for cases where you don’t need to compute any
result.
1. Async
async is used when you need a result computed in a coroutine. It starts a new coroutine and returns
a Deferred<T>, which is a non-blocking future that represents a promise to provide a result later.
1. RunBlocking
runBlocking is a bridge between non-coroutine world and coroutine world. It's a way to start top-level main
coroutine.
Now, Let’s talk about dispatchers
Example :
Want to know more? Scan this code and go ahead 👍🏼
Time to apply it in our code
Replacing linear execution in coroutines
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
Now you can say, Yesss! It’s done 🤩
Google ML-Kit - Understanding on-device machine learning
Thank you!
I’m here
vishrutgoyani9 vishrut_goyani9
vishrut.goyani3 vishrut.goyani9

More Related Content

PPTX
Application of ml kit from firebase
PPTX
Kotlin Overview
PPTX
Canada DevOps Summit 2020 Presentation Nov_03_2020
PDF
ISS Art. How to do IT. Kotlin Multiplatform
PDF
The Developers World
PPTX
Google cloud Study Jam 2023.pptx
PDF
Top 10 Tips for Developing Android Apps Using Kotlin
PDF
Cara Tepat Menjadi iOS Developer Expert - Gilang Ramadhan
Application of ml kit from firebase
Kotlin Overview
Canada DevOps Summit 2020 Presentation Nov_03_2020
ISS Art. How to do IT. Kotlin Multiplatform
The Developers World
Google cloud Study Jam 2023.pptx
Top 10 Tips for Developing Android Apps Using Kotlin
Cara Tepat Menjadi iOS Developer Expert - Gilang Ramadhan

Similar to Google ML-Kit - Understanding on-device machine learning (20)

PDF
Dato Keynote
PDF
Build and automate your machine learning application with docker and jenkins
PPT
JAVA object oriented programming (oop).ppt
PPTX
moocs_ppt.pptx
PPTX
MOOC_PRESENTATION_KOTLIN[1].pptx
PDF
Android Workshop Part 1
PDF
Kotlin vs Java: Which is Better for Android App Development?
PDF
ML Kit , Cloud FF GDSC MESCOE.pdf
PPTX
Ai on the edge... and containers
PDF
Unity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
PPTX
Android is a mobile operating system developed by Google, known for its open-...
PDF
Stackato v5
PDF
Kotlin App Development Tips.pdf
PDF
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
PDF
Bringing AI to the edge on-premises Azure Cognitive Services using Docker con...
PDF
Designing and coding for cloud-native applications using Python, Harjinder Mi...
PDF
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
PPTX
android group material Presentation1.pptx
PPTX
Introduction to Aspect Oriented Programming by Donald Belcham
PPTX
Introduction To AOP
Dato Keynote
Build and automate your machine learning application with docker and jenkins
JAVA object oriented programming (oop).ppt
moocs_ppt.pptx
MOOC_PRESENTATION_KOTLIN[1].pptx
Android Workshop Part 1
Kotlin vs Java: Which is Better for Android App Development?
ML Kit , Cloud FF GDSC MESCOE.pdf
Ai on the edge... and containers
Unity and Microsoft Azure Cognitive Services - DIGITREK21 Workshop
Android is a mobile operating system developed by Google, known for its open-...
Stackato v5
Kotlin App Development Tips.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
Bringing AI to the edge on-premises Azure Cognitive Services using Docker con...
Designing and coding for cloud-native applications using Python, Harjinder Mi...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
android group material Presentation1.pptx
Introduction to Aspect Oriented Programming by Donald Belcham
Introduction To AOP
Ad

Recently uploaded (20)

PPTX
Transform Your Business with a Software ERP System
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
ai tools demonstartion for schools and inter college
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Digital Strategies for Manufacturing Companies
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Introduction to Artificial Intelligence
PPT
Introduction Database Management System for Course Database
PPTX
history of c programming in notes for students .pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
top salesforce developer skills in 2025.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Transform Your Business with a Software ERP System
Softaken Excel to vCard Converter Software.pdf
Computer Software and OS of computer science of grade 11.pptx
Design an Analysis of Algorithms I-SECS-1021-03
ai tools demonstartion for schools and inter college
Upgrade and Innovation Strategies for SAP ERP Customers
Digital Strategies for Manufacturing Companies
Designing Intelligence for the Shop Floor.pdf
Introduction to Artificial Intelligence
Introduction Database Management System for Course Database
history of c programming in notes for students .pptx
Design an Analysis of Algorithms II-SECS-1021-03
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
CHAPTER 2 - PM Management and IT Context
Odoo Companies in India – Driving Business Transformation.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
top salesforce developer skills in 2025.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
How to Migrate SBCGlobal Email to Yahoo Easily
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Ad

Google ML-Kit - Understanding on-device machine learning

  • 1. Understanding on-device Machine machine learning ML-Kit by Google Vishrut Goyani Android developer vishrutgoyani9 vishrut.goyani3
  • 3. Tell me more, I'm listening • ML Kit is a mobile SDK that brings Google's on-device machine learning expertise to Android and iOS apps. • Use powerful yet easy to use Vision and Natural Language APIs to solve common challenges in your apps or create brand-new user experiences. • ML Kit's APIs all run on-device, allowing for real-time use cases where you want to process a live camera stream for example. This also means that the functionality is available offline.
  • 4. Offerings • Text recognition • Face detection • Face mesh detection • Pose detection • Selfie segmentation • Subject segmentation • Document scanner • Barcode scanning • Image labelling • Object detection • Digital ink recognition • Language identification • Translation • Smart reply • Entity extraction Vision Natural language
  • 5. Wait, there is one more!
  • 7. Firebase ML - Is it same?
  • 8. What is it? • Firebase Machine Learning is a mobile SDK that brings Google's machine learning expertise to Android and Apple apps in a powerful yet easy-to-use package. • Firebase ML provides the ability to deploy custom models to your users' devices by uploading them to our servers. • It allows you to keep your app's initial install size small, and you can swap the ML model without having to republish your app.
  • 9. Offerings • Text recognition • Image labeling • Object detection and tracking • Face detection and contour tracing • Barcode scanning • Language identification • Translation • Smart reply Vision Natural language
  • 10. Well, Here's the difference ML-Kit • On-device machine learning for common tasks • Faster for simpler tasks • Excellent offline performance • Simpler to set up and use • Need to update the app when updating the mode Firebase ML • On-device and cloud-based machine learning • Higher accuracy for complex tasks • Limited offline performance • More complex for cloud-based models • Update your models on cloud without requiring the app update
  • 13. Let’s Cook! Ingredients : • Android Studio • Java/Kotlin • Knowledge of Asynchronous programming like Threads or Coroutines • Android device or emulator (Obviously the device will be better)
  • 14. First things first - Dependencies!
  • 18. Custom model implementation :- Download custom model Implementation guide
  • 20. In your app level gradle file To ensure that gradle doesn’t compress the model file when building the app
  • 24. To load the downloaded custom model
  • 25. Make an instance of image labeler For base model: For custom model:
  • 26. Run the image labeler :-
  • 27. Get information about labeled objects Now, you can use this information to group images by label names
  • 28. Finally, We have done it…!
  • 29. Wait, You got 10000+ photos? I’m screwed.
  • 30. Time to go asynchronous 🙌🏻
  • 32. The difference • Execution of Threads is heavyweight • It’s complex and can lead to unexpected behavior upon cancellation • Best suitable for simple & long running tasks • OS managed • Basic tasks requires fine-grained control Threads Coroutines • Coroutines are lightweight • Structured and graceful cancellation • Can be used for complex tasks with efficiency • Dispatcher managed • Handle complex asynchronous tasks efficiently
  • 33. Hence proved, Coroutine is the way to go 🙌🏻 Implementation : In your gradle file,
  • 34. Basics : launch, async and runBlocking To work with coroutines, Kotlin provides three basic building blocks: launch, async, and runBlocking. 1. Launch Launch is used to fire and forget coroutine. It’s perfect for cases where you don’t need to compute any result.
  • 35. 1. Async async is used when you need a result computed in a coroutine. It starts a new coroutine and returns a Deferred<T>, which is a non-blocking future that represents a promise to provide a result later.
  • 36. 1. RunBlocking runBlocking is a bridge between non-coroutine world and coroutine world. It's a way to start top-level main coroutine.
  • 37. Now, Let’s talk about dispatchers
  • 39. Want to know more? Scan this code and go ahead 👍🏼
  • 40. Time to apply it in our code
  • 41. Replacing linear execution in coroutines
  • 44. Now you can say, Yesss! It’s done 🤩
  • 46. Thank you! I’m here vishrutgoyani9 vishrut_goyani9 vishrut.goyani3 vishrut.goyani9