I'm trying to convert a YOLOv5 model to a TFLite model for mobile devices, but I'm having issues with the generated file. The TFLite model is so large in size and is giving completely wrong predictions compared to the original YOLOv5 model. the original YOLOv5s file is ~13.7 while the TFLite model is ~26.9, I converted it as follows:
!python export.py --weights best.pt --include tflite --img 640 --data data.yaml
and then:
converter = tf.lite.TFLiteConverter.from_saved_model('best_saved_model')
tflite_model = converter.convert()
with open('model.tflite', 'wb') as f:
f.write(tflite_model)
Can anyone provide guidance on how to convert a YOLOv5 model to TFLite properly and ensure that the predictions are accurate? Any help would be greatly appreciated!