首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有混合误差的微控制器TfLite

具有混合误差的微控制器TfLite
EN

Stack Overflow用户
提问于 2020-06-27 21:02:47
回答 1查看 220关注 0票数 0

为了在新的OpenMV上运行,我将我的.h5文件转换为量化的tflite,但当我运行它时,我得到一个错误,说“混合模型在TFLite H7上不受支持。”

我不确定为什么我的模型看起来是混合的;我用来转换的代码如下:

代码语言:javascript
复制
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)

如果有人能指导我,如果我做错了什么,或者如果有更好的方法来转换它,我将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2020-06-27 21:13:32

试试这段代码

代码语言:javascript
复制
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)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62610369

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档