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:
...