Python 冻结图形到Tflite转换错误->;ValueError-为输入数组提供输入形状';wav数据';

Python 冻结图形到Tflite转换错误->;ValueError-为输入数组提供输入形状';wav数据';,python,tensorflow,deep-learning,speech-recognition,tensor,Python,Tensorflow,Deep Learning,Speech Recognition,Tensor,我遵循Tensorflow for speech commands分类中给出的代码,为城市声音数据集训练自定义分类器。已成功创建冻结的图形。但当我尝试使用下面给出的方法将其转换为Tflite时 converter = tf.lite.TFLiteConverter.from_frozen_graph('five_words.pb', ['wav_data'], ['labels_softmax'], {"wav_data" :None}) tflite_model = converter.con

我遵循Tensorflow for speech commands分类中给出的代码,为城市声音数据集训练自定义分类器。已成功创建冻结的图形。但当我尝试使用下面给出的方法将其转换为Tflite时

converter = tf.lite.TFLiteConverter.from_frozen_graph('five_words.pb', ['wav_data'], ['labels_softmax'], {"wav_data" :None})
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
它给出了以下错误

ValueError                                Traceback (most recent call last)
<ipython-input-30-fc0e59056dc1> in <module>()
----> 1 tflite_model = converter.convert()
      2 open("converted_model.tflite", "wb").write(tflite_model)

/usr/local/lib/python3.6/dist-packages/tensorflow_core/lite/python/lite.py in convert(self)
    887         if not shape:
    888           raise ValueError("Provide an input shape for input array "
--> 889                            "'{0}'.".format(_get_tensor_name(tensor)))
    890         # Note that shape_list might be empty for scalar shapes.
    891         shape_list = shape.as_list()

ValueError: Provide an input shape for input array 'wav_data'.
ValueError回溯(最近一次调用)
在()
---->1 tflite_model=converter.convert()
2打开(“转换的_模型.tflite”,“wb”).写入(tflite_模型)
/convert(self)中的usr/local/lib/python3.6/dist-packages/tensorflow_core/lite/python/lite.py
887如果不是形状:
888 raise VALUERROR(“为输入数组提供输入形状”
-->889“{0}.”。格式(_get_tensor_name(tensor)))
890#请注意,对于标量形状,形状列表可能为空。
891 shape_list=shape.as_list()
ValueError:为输入数组“wav_数据”提供输入形状。
图形结构:



我输入的数据每个单词都有5个文件夹,每个文件夹由100个音频文件组成,因此我的输入张量(即'wav_data')

的形状是什么,因为错误跟踪表明您需要提供输入数组“wav_data”的形状。检查wav_数据的形状,并用数组替换None

例如
converter=tf.lite.TFLiteConverter.from_freezed_图形('five_words.pb',['wav_data'],['labels_softmax'],{'wav_data::None})
可以是
converter=tf.lite.TFLiteConverter.from_freezed_图形('five_words.pb',['wav_data'],['labels_softmax'],{'wav_data'],{'wav_data:[1160,3]})