convert Tensorflow Hub model to TF Lite

54 Views Asked by At

I tried to convert a model downloaded from tensorflow hub: faster_rcnn/openimages_v4/inception_resnet_v2 to TF Lite without success.

This model interests me in particular because it has been trained with openimages_v4.

Has anyone managed to do it?

import tensorflow as tf
import tensorflow_hub as hub

# Download Google Object Detection TensorFlow Faster-RCNN model from TensorFlow Hub
module_handle = "https://tfhub.dev/google/faster_rcnn/openimages_v4/inception_resnet_v2/1"
model = hub.load(module_handle)

# model TensorFlow > modelo TensorFlow Lite
converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()

# save model 
with open('model.tflite', 'wb') as f:
    f.write(tflite_model)

Error: 'AutoTrackable' object has no attribute 'call'

0

There are 0 best solutions below