简体   繁体   中英

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 )

I would suggest going for a longer but tested path.

1) Convert your model directly as .pb frozen graph format or convert from h5 to .pb using How to export Keras.h5 to tensorflow.pb?

2) Convert .pb to tflite as described by me here: https://medium.com/@prashantdandriyal7/darknet-to-tensorflow-to-tensorflowlite-b783d55b106a

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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