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

onnx inference is slow #1246

Open
oaifaye opened this issue Oct 25, 2023 · 1 comment
Open

onnx inference is slow #1246

oaifaye opened this issue Oct 25, 2023 · 1 comment

Comments

@oaifaye
Copy link

oaifaye commented Oct 25, 2023

I compared onnx with PPOCR on CPU and found that using python was 9 times faster than tract. I wonder if this is normal

@cospectrum
Copy link

I compared onnx with PPOCR on CPU and found that using python was 9 times faster than tract. I wonder if this is normal

onnx uses multiple threads by default. The tract is single-threaded and will of course be slower on one input. However, since tract is thread safe, I still use it in some cases.

If the task is by its nature divided into batches, for example, processing several images from a video stream, in combination with rayon there will be good speed; in my area, tract will very often be faster than onnx.
Also, if, for example, the task is to write a web server, tract can process each client independently, while the onnx model will have to be wrapped in a mutex and in this case the clients will wait for each other, which will be slow under constant load.

It all depends on the subject area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants