Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning Projects for Mobile Applications

You're reading from   Machine Learning Projects for Mobile Applications Build Android and iOS applications using TensorFlow Lite and Core ML

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781788994590
Length 246 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Karthikeyan NG Karthikeyan NG
Author Profile Icon Karthikeyan NG
Karthikeyan NG
Arrow right icon
View More author details
Toc

Building the TensorFlow model

In this application, we will build an MNIST dataset-based TensorFlow model to be used in our Android application. Once we have the TensorFlow model, we will convert that into a TensorFlow Lite model. The step-by-step procedure on downloading the model and building the TensorFlow model is as follows.

Here is the architecture diagram on how our model works. The way to achieve the same is explained further:

With TensorFlow, we can download the data with one line of Python code, as follows:

import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# Reading data
mnist = input_data.read_data_sets("./data/", one_hot=True)

Now we have the MNIST dataset downloaded. After that, we will read the data as shown precedingly. Now we can run the script to download the dataset. We will run the script from the console as follows:

...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime