发新帖

用LSTM训练出来的h5文件转tflite文件出错

[复制链接]
42 0

快来加入 TensorFlowers 大家庭!

您需要 登录 才可以下载或查看,没有帐号?加入社区

x

用LSTM训练好的h5模型:model_test.h5, 根据官方文档转换tflite文件。
converter = tf.lite.TFLiteConverter.from_keras_model_file("model_test.h5")
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
报如下错误:
  1. <div><div>Use tf.compat.v1.graph_util.extract_sub_graph</div><div>Traceback (most recent call last):</div><div>  File "D:/code/load_forecast/test/test1.py", line 5, in <module></div><div>    tflite_model = converter.convert()</div><div>  File "D:\python\python3\lib\site-packages\tensorflow\lite\python\lite.py", line 456, in convert</div><div>    **converter_kwargs)</div><div>  File "D:\python\python3\lib\site-packages\tensorflow\lite\python\convert.py", line 397, in toco_convert_impl</div><div>    input_data.SerializeToString())</div><div>  File "D:\python\python3\lib\site-packages\tensorflow\lite\python\convert.py", line 172, in toco_convert_protos</div><div>    "TOCO failed. See console for info.\n%s\n%s\n" % (stdout, stderr))</div><div>tensorflow.lite.python.convert.ConverterError: TOCO failed. See console for info.</div></div><div><div>2018-12-06 13:41:26.495220: I tensorflow/lite/toco/import_tensorflow.cc:1329] Unable to determine output type for op: TensorArrayGatherV3</div><div>2018-12-06 13:41:26.506452: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 120 operators, 212 arrays (0 quantized)</div><div>2018-12-06 13:41:26.508258: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 120 operators, 212 arrays (0 quantized)</div><div>2018-12-06 13:41:26.513681: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] After general graph transformations pass 1: 106 operators, 194 arrays (0 quantized)</div><div>2018-12-06 13:41:26.515613: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] Before dequantization graph transformations: 106 operators, 194 arrays (0 quantized)</div><div>2018-12-06 13:41:26.517624: F tensorflow/lite/toco/tooling_util.cc:625] Check failed: dim >= 1 (0 vs. 1)</div></div>
复制代码
也尝试过用h5先转pb文件,再用pb转tflite文件。
h5文件能够成功转pb文件,但是pb转tflite文件时出错;
M{7W$BGM%R9HQIE@}{`3J6X.png
我知道答案 回答被采纳将会获得10 金币 + 5 金币 已有0人回答
本楼点评(0) 收起
您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

快速回复 返回顶部 返回列表