2
votes

I am porting this TensorFlow JS tutorial to Android. I must convert this JSON graph TensorFlow model to .tflite so I can use it there.

I googled about TensorFlow model conversion tools but couldn't find anything. I also looked at whether the Android TensorFlow-lite library has a way to import these graph models, but I didn't find anything either.

I tried converting it with the following Python script I found here, but it expects a .pb file:

import tensorflow as tf

converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
1
It's 2021 - still no way to do it? - Pawel

1 Answers

1
votes

TFLite converter currently doesn't support loading tf-js models. However, you could try using tflite's own posenet model (https://www.tensorflow.org/lite/models/pose_estimation/overview)

Hope this could make things easier.