Start free trial
Searching...
SoBrief
English
EnglishEnglish
EspañolSpanish
简体中文Chinese
繁體中文Chinese (Traditional)
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
Bahasa IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
AI and Machine Learning for On-Device Development

AI and Machine Learning for On-Device Development

A Programmer's Guide
by Laurence Moroney 2021 326 pages
4.17
6 ratings
Listen
Try Full Access for 3 Days
Unlock listening & more!
Continue

Key Takeaways

1. Machine Learning Fundamentals: From Traditional Programming to AI

Machine learning can be simply described as having code functions figure out their own parameters, instead of the human programmer supplying those parameters.

Paradigm shift. Machine learning represents a fundamental shift from traditional programming. Instead of explicitly defining rules, ML algorithms learn patterns from data. This approach allows computers to tackle complex problems that are difficult to solve with conventional programming.

Learning process. The core of machine learning involves three key steps: making a guess, measuring its accuracy, and optimizing for a better guess. This process is repeated iteratively, allowing the model to improve its performance over time. Through this method, ML can discover intricate patterns and relationships in data that might be invisible to human programmers.

Applications. Machine learning has found applications in various fields, from image and speech recognition to predictive analytics and autonomous systems. Its ability to handle large amounts of data and extract meaningful insights has made it a powerful tool in the age of big data and artificial intelligence.

2. Computer Vision: Enabling Machines to "See" and Understand Images

Computer vision is a huge field, and for the purposes of this book and this chapter, we'll focus narrowly on a couple of core scenarios, where we will use technology to parse the contents of images, either labeling the primary content of an image, or finding items within an image.

Image understanding. Computer vision enables machines to interpret and understand visual information from the world. This field combines techniques from image processing, machine learning, and artificial intelligence to analyze and extract meaningful information from digital images and videos.

Key tasks:

  • Image classification: Categorizing images into predefined classes
  • Object detection: Identifying and locating specific objects within an image
  • Facial recognition: Detecting and identifying human faces
  • Semantic segmentation: Partitioning an image into semantically meaningful parts

Applications. Computer vision has a wide range of applications, including:

  • Autonomous vehicles
  • Medical imaging and diagnosis
  • Quality control in manufacturing
  • Augmented reality
  • Security and surveillance systems

3. Natural Language Processing: Unlocking the Power of Text Analysis

Often you'll want to extract vital information from text. You've no doubt seen apps that can determine when there's an address in a piece of text and automatically generate a link to a map of that address, or others that understand an email address and generate a link that lets you launch your email app to send mail to that address.

Text understanding. Natural Language Processing (NLP) is a branch of AI that focuses on the interaction between computers and human language. It enables machines to understand, interpret, and generate human language in a valuable way.

Key NLP tasks:

  • Entity extraction: Identifying and classifying named entities in text
  • Sentiment analysis: Determining the emotional tone behind a piece of text
  • Text classification: Categorizing text documents into predefined classes
  • Machine translation: Automatically translating text from one language to another
  • Question answering: Generating human-like responses to natural language questions

Applications. NLP has numerous applications across various industries:

  • Chatbots and virtual assistants
  • Email filters and spam detection
  • Content categorization
  • Social media monitoring
  • Language translation services

4. TensorFlow Lite: Bringing ML to Mobile Devices

TensorFlow Lite was created with two main aims. The first—it could be used to convert existing TensorFlow models into a format that was smaller and more compact, with an eye on optimizing them for mobile. The second is to have an efficient runtime for various mobile platforms that could be used for model inference.

Mobile-optimized ML. TensorFlow Lite is a lightweight version of TensorFlow designed specifically for mobile and embedded devices. It allows developers to run machine learning models on devices with limited computational resources and power constraints.

Key features:

  • Model conversion: Transforming TensorFlow models into a mobile-friendly format
  • Optimized inference: Efficient runtime for executing models on mobile devices
  • Cross-platform support: Compatible with Android, iOS, and other embedded systems

Benefits:

  • Reduced latency: On-device inference eliminates network delays
  • Enhanced privacy: Data remains on the user's device
  • Offline functionality: ML capabilities without an internet connection
  • Lower power consumption: Optimized for mobile hardware

5. Creating Custom Models: From Data to Deployable Solutions

Creating models from scratch can be difficult and very time consuming. It's also the realm of pure TensorFlow development and is covered in lots of other books such as my book AI and Machine Learning for Coders (O'Reilly).

Model development process. Creating custom ML models involves several steps, from data collection and preparation to model training and optimization. While building models from scratch can be complex, there are tools and techniques to simplify the process.

Approaches to custom model creation:

  1. TensorFlow Lite Model Maker: Simplifies the process of creating custom models for common scenarios
  2. Cloud AutoML: Automates the model creation process using cloud resources
  3. Transfer learning: Leverages pre-trained models to create new models with less data and training time

Considerations:

  • Data quality and quantity
  • Model architecture selection
  • Hyperparameter tuning
  • Evaluation metrics
  • Model optimization for mobile deployment

6. Implementing ML in Android and iOS Apps

Despite the fact that you're using Kotlin, your source files are in the java directory!. Open this, and you'll see a folder with your package name. Within that you should see your MainActivity.kt file. Double-click this file to open it in the code editor.

Platform-specific integration. Implementing ML models in mobile apps requires understanding the specific frameworks and tools for each platform. For Android, developers typically use Kotlin or Java, while iOS development uses Swift.

Key steps for mobile ML integration:

  1. Model preparation: Converting and optimizing the model for mobile use
  2. Model loading: Efficiently loading the model into the app's memory
  3. Input preprocessing: Preparing data in the format expected by the model
  4. Inference: Running the model to get predictions
  5. Output interpretation: Processing the model's output for use in the app

Challenges:

  • Memory management
  • Performance optimization
  • User experience considerations
  • Platform-specific API usage

7. ML Kit: Simplifying Machine Learning Integration for Mobile Developers

ML Kit is designed to make the ML part of application development as easy as possible, and hopefully the face detection part of this app proved that.

Easy ML integration. ML Kit is a mobile SDK that brings Google's machine learning expertise to Android and iOS apps. It provides a simple way to use ML features without requiring in-depth knowledge of neural networks or model optimization.

Key features:

  • Pre-built APIs for common ML tasks (e.g., face detection, text recognition)
  • Custom model deployment
  • On-device or cloud-based processing options

Benefits for developers:

  • Reduced development time
  • Lower barrier to entry for ML implementation
  • Consistent API across Android and iOS
  • Regular updates and improvements from Google

8. Cloud-Based Models: Leveraging Remote Inference for Mobile Apps

There may be times when you don't want to deploy the model to a mobile device—maybe it's too large or complex for mobile, maybe you want to update it frequently, or maybe you don't want to risk it being reverse-engineered and have your IP used by others.

Remote inference. Cloud-based models offer an alternative to on-device ML, allowing developers to leverage more powerful hardware and larger models while maintaining a lightweight mobile app.

Advantages:

  • Access to more complex models
  • Easier model updates and maintenance
  • Reduced app size and device resource usage
  • Centralized processing for data aggregation and analysis

Considerations:

  • Internet connectivity requirements
  • Latency issues
  • Data privacy and security
  • Costs associated with cloud services

9. Ethics, Fairness, and Privacy in AI: Responsible Development Practices

The promise of AI-based systems is that you will be able to deliver more powerful applications more quickly...but if you do so at the cost of not mitigating bias in your systems, then you could potentially accelerate disparity through the use of AI.

Responsible AI development. As AI and ML become more prevalent in mobile apps, developers must consider the ethical implications of their work. This includes addressing issues of bias, fairness, and privacy throughout the development process.

Key considerations:

  • Data bias: Ensuring training data is representative and unbiased
  • Algorithmic fairness: Designing models that treat all users equitably
  • Privacy protection: Implementing strong data protection measures
  • Transparency: Providing clear explanations of how AI is used in the app

Tools and practices:

  • Fairness indicators: Evaluating model performance across different demographic groups
  • Differential privacy: Protecting individual user data while maintaining useful analytics
  • Model cards: Documenting model characteristics, intended uses, and limitations
  • Continuous monitoring and auditing of deployed models

Last updated:

Report Issue

Review Summary

4.17 out of 5
Average of 6 ratings from Goodreads and Amazon.

AI and Machine Learning for On-Device Development receives high praise from readers, with an overall rating of 4.20 out of 5. One technical reviewer highlights its accessibility for beginners and comprehensive coverage of ML applications on mobile devices. The book is praised for its balanced approach to Android and iOS platforms, as well as its inclusion of ethical considerations in AI development. Readers appreciate the practical exercises and the book's ability to guide them through deploying ML models on devices quickly. The content is described as well-structured and informative for those interested in on-device ML development.

Your rating:
4.49
60 ratings
Want to read the full book?

About the Author

Laurence Moroney is a prolific author with a diverse writing portfolio. Known for his successful programming books, he ventured into young adult fiction with "The Fourth World," which became a #1 Amazon Kindle book and spawned two sequels. His latest work, "Space Cadets," marks the beginning of a new science fiction series. Moroney balances his writing career with his role as a Developer Advocate for Google, a position he greatly values. He continues to work on new projects, including the upcoming sequel "The Quiet World." Moroney's background in technology and his creative storytelling abilities have allowed him to create works that span both technical and fictional genres.

Download PDF

To save this AI and Machine Learning for On-Device Development summary for later, download the free PDF. You can print it out, or read offline at your convenience.
Download PDF
File size: 0.22 MB     Pages: 14

Download EPUB

To read this AI and Machine Learning for On-Device Development summary on your e-reader device or app, download the free EPUB. The .epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.
Download EPUB
File size: 2.95 MB     Pages: 10
Follow
Listen
Now playing
AI and Machine Learning for On-Device Development
0:00
-0:00
Now playing
AI and Machine Learning for On-Device Development
0:00
-0:00
1x
Queue
Home
Swipe
Library
Get App
Try Full Access for 3 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
Read unlimited summaries. Free users get 3 per month
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
❤️ Unlimited Bookmarks
Free users are limited to 4
📜 Unlimited History
Free users are limited to 4
📥 Unlimited Downloads
Free users are limited to 1
Risk-Free Timeline
Today: Get Instant Access
Listen to full summaries of 26,000+ books. That's 12,000+ hours of audio!
Day 2: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 3: Your subscription begins
You'll be charged on Jun 11,
cancel anytime before.
Consume 2.8× More Books
2.8× more books Listening Reading
Our users love us
600,000+ readers
Trustpilot Rating
TrustPilot
4.6 Excellent
This site is a total game-changer. I've been flying through book summaries like never before. Highly, highly recommend.
— Dave G
Worth my money and time, and really well made. I've never seen this quality of summaries on other websites. Very helpful!
— Em
Highly recommended!! Fantastic service. Perfect for those that want a little more than a teaser but not all the intricate details of a full audio book.
— Greg M
Save 62%
Yearly
$119.88 $44.99/year/yr
$3.75/mo
Monthly
$9.99/mo
Start a 3-Day Free Trial
3 days free, then $44.99/year. Cancel anytime.
Unlock a world of fiction & nonfiction books
26,000+ books for the price of 2 books
Read any book in 10 minutes
Discover new books like Tinder
Request any book if it's not summarized
Read more books than anyone you know
#1 app for book lovers
Lifelike & immersive summaries
30-day money-back guarantee
Download summaries in EPUBs or PDFs
Cancel anytime in a few clicks
Scanner
Find a barcode to scan

We have a special gift for you
Open
38% OFF
DISCOUNT FOR YOU
$79.99
$49.99/year
only $4.16 per month
Continue
2 taps to start, super easy to cancel
Settings
General
Widget
Loading...
We have a special gift for you
Open
38% OFF
DISCOUNT FOR YOU
$79.99
$49.99/year
only $4.16 per month
Continue
2 taps to start, super easy to cancel