Python tensorflow lite中输入的张量类型错误

Python tensorflow lite中输入的张量类型错误,python,tensorflow,machine-learning,deep-learning,tensorflow-lite,Python,Tensorflow,Machine Learning,Deep Learning,Tensorflow Lite,我正在尝试转换从tflite中tensorflow 2.x中的DNNClassifier预制估计器创建的模型。 我对模型进行了训练,并将其保存在.pb文件中。 当我尝试在tflite中转换时,我得到以下信息: WARNING:tensorflow:From C:\Users\Utente\anaconda3\lib\site-packages\tensorflow\python\training\saver.py:1276: checkpoint_exists (from tensorflow.

我正在尝试转换从tflite中tensorflow 2.x中的DNNClassifier预制估计器创建的模型。 我对模型进行了训练,并将其保存在.pb文件中。 当我尝试在tflite中转换时,我得到以下信息:

WARNING:tensorflow:From C:\Users\Utente\anaconda3\lib\site-packages\tensorflow\python\training\saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
INFO:tensorflow:Restoring parameters from from_estimator/modello1\variables\variables
INFO:tensorflow:The given SavedModel MetaGraphDef contains SignatureDefs with the following keys: {'classification', 'serving_default', 'predict'}
INFO:tensorflow:input tensors info: 
INFO:tensorflow:Tensor's key in saved_model's tensor_map: inputs
INFO:tensorflow: tensor name: input_example_tensor:0, shape: (-1), type: DT_STRING
INFO:tensorflow:output tensors info: 
INFO:tensorflow:Tensor's key in saved_model's tensor_map: classes
INFO:tensorflow: tensor name: dnn/head/Tile:0, shape: (-1, 4), type: DT_STRING
INFO:tensorflow:Tensor's key in saved_model's tensor_map: scores
INFO:tensorflow: tensor name: dnn/head/predictions/probabilities:0, shape: (-1, 4), type: DT_FLOAT
INFO:tensorflow:Restoring parameters from from_estimator/modello1\variables\variables
WARNING:tensorflow:From C:\Users\Utente\anaconda3\lib\site-packages\tensorflow\lite\python\util.py:238: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants`
WARNING:tensorflow:From C:\Users\Utente\anaconda3\lib\site-packages\tensorflow\python\framework\graph_util_impl.py:270: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
INFO:tensorflow:Froze 6 variables.
INFO:tensorflow:Converted 6 variables to const ops.
它表示输入张量的形状是字符串类型

对于模型转换,我使用了以下代码

converter = tf.lite.TFLiteConverter.from_saved_model(estimator_path)
converter.target_ops = [tf.lite.OpsSet.TFLITE_BUILTINS, tf.lite.OpsSet.SELECT_TF_OPS]
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
converter.allow_custom_ops=True
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
我尝试过以其他方式转换,但总是出错。 我还尝试转换另一个预制估计器模型(DNNClassifier),例如tensorflow上的虹膜分类器,结果是相同的。 这是tensorflow.org上的教程

下一步将在android上运行此模型,但输入张量应为浮点类型。
我是tensorflow的新手,我不知道如何继续

Hi@tinooox,你找到这个问题的解决方案了吗?TFlite甚至支持tf.string输入吗?谢谢你的回复!不,tflite还不支持DNNClassifier,我已经创建了我自己的NNHi@tinooox,你找到解决这个问题的方法了吗?TFlite甚至支持tf.string输入吗?谢谢你的回复!不,tflite还不支持DNNClassifier,我已经创建了自己的NN