yasenh / libtorch-yolov5

A LibTorch inference implementation of the yolov5
MIT License
372 stars 114 forks source link

getting warning and just yolov5s.torchscript.pt file when export model #7

Closed mheriyanto closed 3 years ago

mheriyanto commented 3 years ago

I installed Python>=3.8 and PyTorch>=1.6 and also ONNX>=1.7. I used export.py with your suggestion here: https://github.com/yasenh/libtorch-yolov5#torchscript-model-export

and I got these results, just got yolov5s.torchscript.pt, I didn't get yolov5s.onnx:

image

When I use weight (yolov5s.torchscript.pt) to run inference, I got these:

image

Is there any advice? Thank you.

yasenh commented 3 years ago

Hi @mheriyanto, so my env is PyTorch 1.5.1, and I can export the model with onnx 1.7.0 (but I didn't test it with onnxruntime). Anyway for this project, you only need the TorchScript version of model, could you give a try with PyTorch 1.5.1? And meanwhile I can test with PyTorch 1.6.0 as well.

mheriyanto commented 3 years ago

Hello @yasenh , I exported the TorchScript version of model using PyTorch 1.6.0 but model can't be used like before. So yesterday, I exported the TorchScript version of model using torch 1.5.1, torchvision 0.6.1 and onnx 1.7.0, I got yolov5s.torchscript.pt and yolov5s.onnx but there is warning about CoreML like this:

image

When I use weight (yolov5s.torchscript.pt) to run inference, I got these (on CPU):

image

on GPU:

image

yasenh commented 3 years ago

@mheriyanto whats your libtorch version?

mheriyanto commented 3 years ago

@yasenh LibTorch 1.4.0, OpenCV 4.2.0, CUDA 10.1, and Ubuntu 18.04.

yasenh commented 3 years ago

@mheriyanto Could you try LibTorch 1.5.1? wget https://download.pytorch.org/libtorch/cu101/libtorch-cxx11-abi-shared-with-deps-1.5.1%2Bcu101.zip

mheriyanto commented 3 years ago

@yasenh I tried LibTorch 1.5.1 with CUDA 10.1 and it worked for me. Thank you.

image