Book Image

Machine Learning Projects for Mobile Applications

By : Karthikeyan NG
Book Image

Machine Learning Projects for Mobile Applications

By: Karthikeyan NG

Overview of this book

Machine learning is a technique that focuses on developing computer programs that can be modified when exposed to new data. We can make use of it for our mobile applications and this book will show you how to do so. The book starts with the basics of machine learning concepts for mobile applications and how to get well equipped for further tasks. You will start by developing an app to classify age and gender using Core ML and Tensorflow Lite. You will explore neural style transfer and get familiar with how deep CNNs work. We will also take a closer look at Google’s ML Kit for the Firebase SDK for mobile applications. You will learn how to detect handwritten text on mobile. You will also learn how to create your own Snapchat filter by making use of facial attributes and OpenCV. You will learn how to train your own food classification model on your mobile; all of this will be done with the help of deep learning techniques. Lastly, you will build an image classifier on your mobile, compare its performance, and analyze the results on both mobile and cloud using TensorFlow Lite with an RCNN. By the end of this book, you will not only have mastered the concepts of machine learning but also learned how to resolve problems faced while building powerful apps on mobiles using TensorFlow Lite, Caffe2, and Core ML.
Table of Contents (16 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Preface

Machine learning is a growing technique that focuses on the development of computer programs that can be changed or modified when exposed to new data. It has made significant advances that have enabled practical applications of machine learning (ML) and, by extension, the overall field of Artificial Intelligence (AI).

This book presents the implementation of seven practical, real-world projects that will teach you how to leverage TensorFlow Lite and Core ML to perform efficient machine learning. We will be learning about the recent advancements in TensorFlow and its extensions, such as TensorFlow Lite, to design intelligent apps that learn from complex/large datasets. We will delve into advancements such as deep learning by building apps using deep neural network architecture such as Convolutional Neural Networks (CNNs), recurrent neural networks (RNNs), transfer learning, and much more. 

By the end of this book, you will not only have mastered all the concepts of and learned how to implement machine learning and deep learning, but you will also have learned how to solve the problems and challenges faced while building powerful apps on mobile using TensorFlow Lite and Core ML.

Who this book is for

Machine Learning Projects for Mobile Applications is for you if you are a data scientist, ML expert, deep learning, or AI enthusiast who fancies mastering ML and deep learning implementation with practical examples using TensorFlow and Keras. Basic knowledge of Python programming language would be an added advantage.

What this book covers

Chapter 1Mobile Landscapes in Machine Learning, makes us familiar with the basic ideas behind TensorFlow Lite and Core ML.

Chapter 2CNN Based Age and Gender Identification Using Core ML, teaches us how to build an iOS application to detect the age, gender, and emotion of a person from a camera feed or from the user's photo gallery using the existing data models that were built for the same purpose.

 

Chapter 3Applying Neural Style Transfer on Photos, teaches us how to build a complete iOS and Android application in which image transformations are applied to our own images in a fashion similar to the Instagram app.

Chapter 4Deep Diving into the ML Kit with Firebase, explores the Google Firebase-based ML Kit platform for mobile applications.

Chapter 5, A Snapchat-Like AR Filter on Android, takes us on a journey where we will build an AR filter that is used on applications such as Snapchat and Instagram using TensorFlow Lite.

Chapter 6Handwritten Digit Classifier Using Adversarial Learning, explains how to build an Android application that identifies handwritten digits. 

Chapter 7Face-Swapping with Your Friends Using OpenCV, takes a close look at building an application where a face in an image is replaced by another face.

Chapter 8, Classifying Food Using Transfer Learning, explains how to classify food items using transfer learning. 

Chapter 9What's Next?, gives us a glimpse into all the applications built throughout the book and their relevance in the future.

To get the most out of this book

If you have prior knowledge of building mobile apps, that will help greatly. If not, it is advisable to learn the basics of Java or Kotlin for Android, or Swift for iOS. 

If you have basic knowledge of Python, that will help you build your own data model, but Python skill is not mandatory. 

The applications in the book are built using a MacBook Pro. Most of the command-line operations are shown with the assumption that you have a bash shell installed on your machine. They may not work in a Windows development environment.

Download the code

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

 

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Machine-Learning-Projects-for-Mobile-Applications. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781788994590_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "So, we will start our iterations from 1.0 and start minimizing errors in the right direction."

A block of code is set as follows:

def estimate_house_price(sqft, location): 
 price = < DO MAGIC HERE >
 return price

Any command-line input or output is written as follows:

/usr/bin/ruby -e "$(curl -fsSL \
   https://raw.githubusercontent.com/Homebrew/install/master/install)"

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Let's select Single View App from the initial screen, illustrated in this screenshot."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

 

 

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.