模块'tensorflow.contrib.lite.python.lite'没有属性'TFLiteConverter'

时间:2019-10-01 12:05:11

标签: python tensorflow keras neural-network tensorflow-lite

我使用Google colab尝试将keras神经网络文件转换为tensorflow lite。

pip install --upgrade "tensorflow==1.7.*"

import tensorflow
from tensorflow.contrib import lite
#from  tensorflow.contrib.lite.python import convert_saved_model
converter = lite.TFLiteConverter.from_keras_model_file( 'weights-origin.hdf5')
tfmodel = converter.convert()

open ("model.tflite" , "wb") .write(tfmodel)

我收到此消息:

AttributeError                            Traceback (most recent call last)
<ipython-input-4-b02b2298ffe4> in <module>()
----> 1 converter = lite.TFLiteConverter.from_keras_model_file( 'weights-origin.hdf5')
      2 tfmodel = converter.convert()
      3 #convert_saved_model.convert(saved_model_dir="/frozen_inference_graph.pb",output_tflite="/TF_Lite_Model")
      4 open ("model.tflite" , "wb") .write(tfmodel)

AttributeError: module 'tensorflow.contrib.lite.python.lite' has no attribute 'TFLiteConverter'

TensorFlow AttributeError: module tensorflow.contrib.lite.python.lite has no attribute TFLiteConverter的答案 没有帮助我。

0 个答案:

没有答案