Python Tensorflow:SSD_mobilenet_v2_2中的TFLiteConverter(已保存型号->;TFLite)
我已经安装了tensorflow 2.3.1,我的ssd_mobile_net_v2_2是从下载的。我想把这个模型转换成tf_lite版本。我的代码是: 但是错误发生了: tensorflow.lite.python.convert.ConverterError::0:错误:loc(“Func/statefulPartitionCall/input/_0”):要求所有操作数和结果具有兼容的元素类型 :0:注意:loc(“Func/StatefulPartitionedCall/input/_0”):请参阅当前操作:%1=“tf.Identity”(%arg0){device=”“}:(tensor)->tensor 似乎我需要设置输入数据类型,但我不知道如何设置 非常感谢您的回复。我查看后发现:Python Tensorflow:SSD_mobilenet_v2_2中的TFLiteConverter(已保存型号->;TFLite),python,tensorflow,tensorflow-datasets,tensorflow-lite,Python,Tensorflow,Tensorflow Datasets,Tensorflow Lite,我已经安装了tensorflow 2.3.1,我的ssd_mobile_net_v2_2是从下载的。我想把这个模型转换成tf_lite版本。我的代码是: 但是错误发生了: tensorflow.lite.python.convert.ConverterError::0:错误:loc(“Func/statefulPartitionCall/input/_0”):要求所有操作数和结果具有兼容的元素类型 :0:注意:loc(“Func/StatefulPartitionedCall/input/_0
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model("ssd_mobilenet_v2_2",signature_keys=['serving_default'])
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.experimental_new_converter = True
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS, tf.lite.OpsSet.SELECT_TF_OPS]
model = converter.convert()
open("converted_model.tflite", "wb").write(model)
我每晚使用的是tensorflow
我没有使用另一个版本的解决方案来自:
注意:tf nightly==2.4谢谢您的回复。但是你现在使用的tf夜间版本是什么?我已经尝试过tf nightly==2.3.0.dev20200513,但是错误显示:您可以尝试运行我的代码吗?也许ssd_mobilenet型号是新的,因此它将有许多不兼容之处。我已经获得了这个版本
2.4.0-dev20200812
。当我尝试你的代码时,我也遇到了同样的错误。在你转换的lite模型中,输入形状是什么?按运行:输入形状=输入细节[0]['shape']打印(输入形状)