将Keras模型转换为TensorFlow Lite的问题

时间:2019-07-21 00:18:45

标签: python tensorflow keras

Python:

from tensorflow.contrib import lite
converter = lite.TFLiteConverter.from_keras_model_file(filepath) # Your model's name
model = converter.convert()
file = open( 'model.tflite' , 'wb' ) 
file.write( model )

输出:

ValueError                                Traceback (most recent call last)
<ipython-input-88-4a1e951d08b6> in <module>
      1 from tensorflow.contrib import lite
----> 2 converter = lite.TFLiteConverter.from_keras_model_file(filepath)
      3 model = converter.convert()
      4 file = open( 'model.tflite' , 'wb' )
      5 file.write( model )

ValueError: Unknown metric function:top_2_accuracy

我有三个输出精度,分别是top_cat_accuracytop_2_accuracytop_3_accuracy。该如何解决?

0 个答案:

没有答案