hunglc007 / tensorflow-yolov4-tflite

YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
https://github.com/hunglc007/tensorflow-yolov4-tflite
MIT License
2.25k stars 1.24k forks source link

How to convert a trained model to a tflite file #217

Closed czy9987 closed 3 years ago

czy9987 commented 4 years ago

I added the following code to the end of the train.py file and got the tflite file, but when I used this tflite file, I found that there was a problem, please tell me what to do?

Code: saved_model_dir = './log/model_save' tf.saved_model.save(model, saved_model_dir) converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) tflite_model = converter.convert() with open('checkpoints/model_save_8211/detect.tflite', 'wb') as f: f.write(tflite_model)