onnx infer speed is too slow
See original GitHub issuei used pytorch2onnx.py to transfer res50_coco_256x192.pth to onnx. also i transferd it to torchscript. i tested onnx and torchscript model infer dynamic_batch inputs. all were used gpu with cuda, onnx speed was slow with batchsize==10(530ms/avg),although when batchsize==1 was 55ms/avg but torchscript was fast with batchsize==10(40ms/avg),batchsize==1 was 8ms/avg
i wonder why onnx infer was slow
pth2pt code:
traces_script_module = torch.jit.trace(model, one_img, check_trace=False)
traces_script_module.save('res50_coco_256x192.pt')
pth2onnx code:
torch.onnx.export(
model,
one_img,
output_file,
export_params=True,
keep_initializers_as_inputs=True,
verbose=show,
opset_version=opset_version,
input_names=['input.1'],
output_names=['output'],
dynamic_axes={"input.1":{0: "batch_size"}, "output":{0: "batch_size"}}
)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
ONNX Inference Speed extremely slow compare to .pt Model
Hi, I tried to inference an image of resolution 1024*1536 using onnx and .pt model As you can see the huge time difference...
Read more >ONNX Runtime Performance Tuning
The ONNX Go Live “OLive” tool is a Python package that automates the process of accelerating models with ONNX Runtime(ORT). It contains two...
Read more >Scaling-up PyTorch inference: Serving billions of daily NLP ...
We set up two benchmark configurations, one with ONNX Runtime configured for CPU, and one with the ONNX runtime using the GPU through...
Read more >onnxruntime inference is way slower than pytorch on GPU
After running your example GPU only I found that time differs only ~x2, so the speed difference may be caused by framework characteristics....
Read more >Yolov6 Slow inference speed on the Nvidia Jetson NX board
... camera as input source like image and video, however inference speed is very slow. ... --onnx=/home/jetson/yolov7/best-yolov7nano.onnx ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have tested both 10 batches and 1 batch of Lite-HRNet.
@liuxufenfeiya Can you please share the code you used to convert it into torchscript?