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

MNN batch inference time not more efficient than single image #3184

Open
danielbr33 opened this issue Jan 28, 2025 · 1 comment
Open

MNN batch inference time not more efficient than single image #3184

danielbr33 opened this issue Jan 28, 2025 · 1 comment
Labels
User The user ask question about how to use. Or don't use MNN correctly and cause bug.

Comments

@danielbr33
Copy link

You can use C++ API to do it. How ever, it's not more efficient to use multi batch for inference.

Why is multi batch computing inefficient using MNN?

Is this true for all operators?

Originally posted by @mingyunzzu in #673

Can somebody explain why inference with batch isn't more efficient in MNN? When I run detection on single image it takes 7 miliseconds and when I run on batch of 32 images it takes 8 miliseconds per image. This is only the time of inference measured by time of runSession without preparing images and postprocessing. What can I use to reach better results?

@jxt1234
Copy link
Collaborator

jxt1234 commented Jan 29, 2025

  1. The issue's bug has been resolved. Now batch inference time depend on the compute flops of device. If one image has reach the peak flops, then batch image will not more efficient.
  2. The get the device's compute peak flops, can use ./run_test.out speed/MatMulBConst
  3. Normally GPU has more flops than CPU, you can use opencl instead of CPU to forward.

@jxt1234 jxt1234 added the User The user ask question about how to use. Or don't use MNN correctly and cause bug. label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User The user ask question about how to use. Or don't use MNN correctly and cause bug.
Projects
None yet
Development

No branches or pull requests

2 participants