Closed Roshnee closed 3 years ago
Hello @Roshnee, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.
If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7
. To install run:
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
❔Question
I have tensorflow 2.3.1 installed.
I was able to convert the pytorch model into an onnx file using, python models/export.py --weights yolov5s.pt --img 640 --batch 1
i also was able to convert .onnx into a tensorflow model using the following code, `import onnx from onnx_tf.backend import prepare import tensorflow as tf
onnx_model = onnx.load('yolov5s.onnx') tf_rep = prepare(onnx_model) tf_rep.export_graph("yolov5.pb") `
This yolov5.pb directory consists of the saved_model.pb file and 2 other folders: variables (2 files) and assets (empty folder)
I couldnt further convert it to a tflite model. I used the following code, `import tensorflow as tf
saved_model_dir = 'yolov5.pb'
Convert the model.
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) tflite_model = converter.convert()
Save the TF Lite model.
with tf.io.gfile.GFile('model.tflite', 'wb') as f: f.write(tflite_model)`
This causes a strange error:
I also used:
_tflite_convert --saved_model_dir=yolov5 --outputfile=yolo.tflite
which gives me the same error.
Additional context
UPDATE:
looks like the error is because the conversion from onnx to tensorflow model is the saved model and not the frozen tf file. By finding the signature of the saved model using
saved_model_cli show --dir yolov5_trial2 --all
gives me weird signature def for input and output arrays
Please help.