Nguyễn Khang
Nguyễn Khang

Reputation: 43

How to convert yolov5 trained model into tflite in google colab to install on mobile app?

I have used Yolov5 to train the model in google colab and how can I export the .tflite file of the trained model so that it can be used for mobile applications. Thanks for help me

Upvotes: 0

Views: 4947

Answers (2)

modernToking
modernToking

Reputation: 60

You can look in this github(https://github.com/hunglc007/tensorflow-yolov4-tflite), i think you find something useful

Upvotes: 0

Farmaker
Farmaker

Reputation: 2790

Assuming that you have the latest TensorFlow version 2.7.0 use the general method for that purpose that it is shown here:

import tensorflow as tf

# Convert the model
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) # path to the SavedModel directory
tflite_model = converter.convert()

# Save the model.
with open('model.tflite', 'wb') as f:
  f.write(tflite_model)

Get back with your results and tag me if you have problems

Upvotes: 1

Related Questions