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

作者您好,请问我用fastapi写了一个paddlers的接口,传入大图像路径开始推理,但是推理比较慢?请问有什么办法提高下推理速度吗 #197

Closed
funny000 opened this issue May 9, 2024 · 4 comments
Assignees
Labels
question Further information is requested stale old issue/PR without interaction for a long time

Comments

@funny000
Copy link

funny000 commented May 9, 2024

Thanks for your issue. To help us better solve the issue, please provide the following information:

  1. PaddleRS version: (please specify the branch as well,e.g. PaddleRS release/1.0)
  2. PaddlePaddle version: (e.g. PaddlePaddle 2.3.0)
  3. Operation system: (e.g. Linux/Windows/MacOS)
  4. Python version: (e.g. Python3.7/8)
  5. CUDA/cuDNN version: (e.g. CUDA10.2/cuDNN 7.6.5)
  6. Additional context: (add any other context about the problem)

欢迎您的提问。辛苦您提供以下信息,以方便我们快速定位和解决问题:

  1. PaddleRS版本:PaddleRS release/1.0
  2. PaddlePaddle版本:PaddlePaddle 2.3.0
  3. 操作系统信息:Linux
  4. Python版本号:Python3.9
  5. CUDA/cuDNN版本:CUDA12.0
  6. 其他内容: 无
@funny000 funny000 added the question Further information is requested label May 9, 2024
@github-actions github-actions bot added triage new issue/PR waiting to be dealed and removed triage new issue/PR waiting to be dealed labels May 9, 2024
@Bobholamovic
Copy link
Member

你好,请问你是想寻找低并发请求时降低模型推理延时的办法吗?如果是这样的话,我建议首先确认服务使用静态图而非动态图格式的模型,导出静态图模型的方式可以参考这里。对于图像分割和变化检测任务,还可以试试PaddleRS的滑窗推理API(支持动态图和静态图),使用方式可以参考这里

@funny000
Copy link
Author

谢谢作者,是低并发降低推理延迟的问题,模型已经导出静态图了,用的滑窗推理,就是图像比较大,现在batchsize为1,blocksize512,一张图需要10分钟左右,我再尝试加大batchsize试试,

@Bobholamovic
Copy link
Member

嗯嗯,可以尝试调整batch size、窗口大小、滑动步长、重叠部分融合策略,这些参数都会影响推理速度与效果。如果图像实在太大,而部署服务的机器资源充足,也可以考虑对图像进行分块,然后使用多个进程(每个进程分别有一个模型实例,每个模型实例占用一块GPU)对分块进行并行处理,最后融合。

Copy link

github-actions bot commented Jul 9, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale old issue/PR without interaction for a long time label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale old issue/PR without interaction for a long time
Projects
None yet
Development

No branches or pull requests

2 participants