0

I am a newbie on the TensorFlow object detection library. I have a specific data set what I have to produce myself and labeled it with thousands of jpg. I have run the file to detect the object from these images.. any way.The end of the process i have gotten frozen_graph and from it I exported model.ckpl file to inference graph folder everything goes fine, and I have tested model.ckpl model on the object_detection.ipynb file it works fine. Until this step, there is no problem. However,Am not able to understand how could convert that model.ckpl file to model.tflite file to use on android studio app.

I have see many things like but I am no idea what is the input_tensors = [...] output_tensors = [...] I may already know but what it was actually...

Could you show me how could I convert it?

Vikrant
  • 4,920
  • 17
  • 48
  • 72
ozzcet
  • 11
  • 2

3 Answers3

0

Use tensorboard to find out your input and output layer. For reference follow these links -

https://heartbeat.fritz.ai/intro-to-machine-learning-on-android-how-to-convert-a-custom-model-to-tensorflow-lite-e07d2d9d50e3

Tensorflow Convert pb file to TFLITE using python

0

If you don't know your inputs and outputs, use summarize_graph tool and feed it your frozen model. See command here https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/graph_transforms#inspecting-graphs

Karim Nosseir
  • 540
  • 2
  • 8
0

If you have trained your model from scratch you must be having the .meta file. Also you need to specify the output node names using which you can create a .pb file. Please refer to below link on steps to create this file:

Tensorflow: How to convert .meta, .data and .index model files into one graph.pb file

Once this is created you can further convert your .pb to tflite as below:

import tensorflow as tf

graph_def_file = "model.pb"
input_arrays = ["model_inputs"]
output_arrays = ["model_outputs"]

converter = tf.lite.TFLiteConverter.from_frozen_graph(
        graph_def_file, input_arrays, output_arrays)

tflite_model = converter.convert()

open("converted_model.tflite", "wb").write(tflite_model)
Kaushik Roy
  • 1,627
  • 2
  • 11
  • 13