繁体   English   中英

将 tensorflow model 转换为 tensorflow lite (.h5 to.tflite) = ValueError: bad marshal data (unknown type code) 时出错

[英]Error while converting tensorflow model to tensorflow lite (.h5 to .tflite) = ValueError: bad marshal data (unknown type code)

I am using a pre-trained keras based and tensorflow based model with yolov2 architecture for potholes detection and I'm getting an error while converting my tensorflow model to tensorflow lite

from tensorflow.contrib import lite

converter = lite.TFLiteConverter.from_keras_model_file( 'model.h5' )
model = converter.convert()
file = open( 'model.tflite' , 'wb' )
file.write( model )

我建议走一条更长但经过测试的道路。

1) 将您的 model 直接转换为.pb冻结图形格式或使用如何将 Keras.h5 导出为 tensorflow.ph5转换为.pb

2)按照我在这里的描述将.pb转换为tflitehttps://medium.com/@prashantdandriyal7/darknet-to-tensorflow-to-tensorflowlite-b783d55b106a

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM