Reputation: 313
I have yolo model as yolov5s.yaml
and i have saved my weights file as best.pt
.
Now want to convert yolo model to ONNX and run on c++ interface .
I have gone through this https://github.com/ultralytics/yolov5/issues/251 but not able to do .Any help or useful resources will be helpful .
Thanks
Upvotes: 2
Views: 9343
Reputation: 1
I tried run the examples provided in the first link successfully, the statements are: git clone github.com/ultralytics/yolov5 # clone repo cd yolov5 pip install -r requirements.txt # base requirements pip install coremltools>=4.1 onnx>=1.9.0 scikit-learn==0.19.2 # export requirements python models/export.py --weights yolov5s.pt --img 640 --batch 1 # export at 640x640 with batch size 1
It shows the export was successfully. The weight file in above example is yolov5s.pt. What kind of errors did you get by running these statements with your best.pt file?
Upvotes: 0
Reputation: 1
I could run the example mentioned in https://github.com/ultralytics/yolov5/issues/251 successfully. My torch version is 1.8.0.
Probably your weights file best.pt has invalid values. Did you ever try to use the weights file in above link to export the module successfully?
BTW: you can find examples in https://github.com/microsoft/onnxruntime/tree/master/samples/c_cxx for usage of ONNXRuntime C++ api to run it.
Upvotes: 0