为了在新的OpenMV上运行,我将我的.h5文件转换为量化的tflite,但当我运行它时,我得到一个错误,说“混合模型在TFLite H7上不受支持。”
我不确定为什么我的模型看起来是混合的;我用来转换的代码如下:
model = load_model('inceptionV3.h5')
# Convert the model.
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
tflite_model = converter.convert()
# Save the TF Lite model.
with tf.io.gfile.GFile('inceptionV3_openmv2.tflite', 'wb') as f:
f.write(tflite_model)如果有人能指导我,如果我做错了什么,或者如果有更好的方法来转换它,我将不胜感激。
发布于 2020-06-27 21:13:32
试试这段代码
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_keras_model_file("inceptionV3.h5")
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
converter.target_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
tf_model = converter.convert()
open ("inceptionV3_openmv2.tflite" , "wb") .write(tf_model)https://stackoverflow.com/questions/62610369
复制相似问题