Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to convert yolo_NAS/ckpt_best.pth to tflite model. #993

Closed
vijay2712 opened this issue May 13, 2023 · 3 comments
Closed

How to convert yolo_NAS/ckpt_best.pth to tflite model. #993

vijay2712 opened this issue May 13, 2023 · 3 comments
Labels
📃 Documentation Improvements or additions to documentation

Comments

@vijay2712
Copy link

Please share the documentation to test the model on mobile application

@dagshub
Copy link

dagshub bot commented May 13, 2023

@avideci
Copy link
Contributor

avideci commented May 15, 2023

Hi, I recently opened a PR that supports compilation to CoreML (Apple devices):
#1007
It is a simple as drag-and-drop to the XCode worksapce. XCode generates inference classes and you can try your model right away.

As of TensorFlow runtimes, they have great documentation about how to convert to TFLite: https://www.tensorflow.org/lite/models/convert/
We recommend converting to TensorFlow (preferbly Keras is possible, converts better) and then to TFLite.
You can convert Tensorflow/Keras to TFLite, or ONNX to TFLite, following these docs.

I would recommend:

  1. Convert pytroch to ONNX using torch.onnx.export
  2. Convert ONNX to TensorFlow/Keras
  3. Convert Keras (h5) / TensorFlow (pb/saved model) to TFLite.
  4. Use the checkpoint from step 3 with a TFLite interpreter (runtime) on your mobile device.

If you seek performance with TFlite, I recommend checking the GPUDelegates together with MediaPipe by Google.
Worth saying TFlite runs also on browsers and is universal, unlike CoreML.

@vijay2712
Copy link
Author

Thanks @avideci I will check

@Louis-Dupont Louis-Dupont added 📃 Documentation Improvements or additions to documentation and removed ☑️ Solution proposed labels Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📃 Documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants