"# Convert Tensorflow model checkpoints to saved model"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "KAy1ciItdrDB"
},
"source": [
"Given the checkpoints exported from Tensorflow model training, our goal is to convert those checkpoints into saved model for inference purpose.\u003cbr\u003e\n",
"Checkpoints is a binary file which contains all the values of the weights, biases, gradients and all the other variables saved. This file has an extension .ckpt. Checkpoints do not contain any description of the computation defined by the model and thus are typically only useful when source code that will use the saved parameter values is available.\u003cbr\u003e\n",
"A saved model contains a complete tensorflow program, including trained parameters and computation. It does not require the original model building code to run, which makes it useful for sharing or deploying with TFLite, tensorflow.js, Tensorflow Serving or Tensorflow Hub."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Lg4uH43Qds0q"
},
"source": [
"**Note** - We also assume that the script will be used as a Google Colab notebook. But this can be changed according to the needs of users. They can modify this in case they are working on their local workstation, remote server or any other database. This colab notebook can be changed to a regular jupyter notebook running on a local machine according to the need of the users."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "BofYg406d4LV"
},
"source": [
"## Import libraries \u0026 clone the TF model directory"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "oegDgL7yaaAq"
},
"outputs": [],
"source": [
"# install model-garden official and RESTART RUNTIME of the colab\n",
"Given the saved model after Tensorflow model training, our goal is to convert saved model to TFLite for inference purpose on edge devices. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ZXpSX-w_8A1c"
},
"source": [
"Tensorflow Lite is a set of tools that enables on-device machine learning by helping developers run their models on mobile, embedded and edge devices."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "20sV-bx59GRD"
},
"source": [
"## **MUST CHANGE** - Define the parameters according to your need"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "icoDtIin9REv"
},
"outputs": [],
"source": [
"# path where the tflite model will be written with its name\n",