Giter Site home page Giter Site logo

Comments (12)

UNeedCryDear avatar UNeedCryDear commented on June 19, 2024

确认下你的ORT有无调用到GPU,你这个速度是没有调用到GPU的速度。
另外ORT调用GPU,第一次运行会比较慢,所以需要启用warm up,另外有一点是,如果你输入每次都是不一样大小的话,那warm up对这种动态效果就不是很好,反而可能更慢,这点python下面会好一些。

from yolov5-seg-opencv-onnxruntime-cpp.

1404561326521 avatar 1404561326521 commented on June 19, 2024

我的输入图像尺寸固定为1440×1080,这个具体要怎么调用GPU啊,大佬可以指点一下不

from yolov5-seg-opencv-onnxruntime-cpp.

UNeedCryDear avatar UNeedCryDear commented on June 19, 2024

image

from yolov5-seg-opencv-onnxruntime-cpp.

LYHTZHANGJIANG avatar LYHTZHANGJIANG commented on June 19, 2024

image

我测试就推理的时间,要接近100多ms, 跟cpu没什么区别,但是是按照你这样的设置了呀? 请问是什么问题呀?

from yolov5-seg-opencv-onnxruntime-cpp.

1404561326521 avatar 1404561326521 commented on June 19, 2024

我在读模型时确实启用了cuda,但是速度还是200多毫秒
image

from yolov5-seg-opencv-onnxruntime-cpp.

UNeedCryDear avatar UNeedCryDear commented on June 19, 2024

@LYHTZHANGJIANG @1404561326521

代码这里设置为true并不代表一定能调用成功,我的策略就是如果启用cuda失败回退带CPU推理。这就是为什么即使你设置了cuda为true,但是仍然和cpu速度一样。

首先请确认下自己的cuda和cudnn是否安装成功,和onnx的版本是否可以匹配,和显卡是否匹配,特别是30系之后的显卡,至少要cuda11.x的版本才行,低于这个版本无法使用cuda。

其次如果会debug,你可以打断点在read模型的时候,看下是否跳转到了 cpu上面去了。如果不会跟代码,就开任务管理器,看下对应的显卡显存有无上涨,引擎修改为cuda看下有无增长。另外,z这里的显卡说的是英伟达的显卡,而非核显或者AMD的显卡

image

from yolov5-seg-opencv-onnxruntime-cpp.

1404561326521 avatar 1404561326521 commented on June 19, 2024

我就是在任务管理器观察的,运行时cpu占用率提高了很多,gpu的占用率基本没变化

from yolov5-seg-opencv-onnxruntime-cpp.

UNeedCryDear avatar UNeedCryDear commented on June 19, 2024

另外有一点,我再次测试了下我的最新代码,可以成功跑在ort1.9~ort1.16.x,所以请检查一下你自己的环境之类的有无问题,onnxruntime是否下载的gpu版本

from yolov5-seg-opencv-onnxruntime-cpp.

LYHTZHANGJIANG avatar LYHTZHANGJIANG commented on June 19, 2024

另外有一点,我再次测试了下我的最新代码,可以成功跑在ort1.9~ort1.16.x,所以请检查一下你自己的环境之类的有无问题,onnxruntime是否下载的gpu版本

我的环境是4090 cuda12,ort12.0 是gpu版本,我debug打印看了,是走的cuda,cpu和gpu耗时都是80ms左右,我想问问您那边推理单张图像耗时是多少?

from yolov5-seg-opencv-onnxruntime-cpp.

UNeedCryDear avatar UNeedCryDear commented on June 19, 2024

@LYHTZHANGJIANG

我的环境是4090 cuda12,ort12.0 是gpu版本,我debug打印看了,是走的cuda,cpu和gpu耗时都是80ms左右,我想问问您那边推理单张图像耗时是多少?

默认640x640的突破的话,前两三张会慢,后面可以达到18-30ms之间(3060,不进行结果绘制,只计算输入图片开始到拿到结果,没有绘制结果),取决于原图大小和上面目标的数量,毕竟计算mask的时候耗时还是比较高的。推理速度的话很快,基本上2-7ms之间,具体没有很详细的计算,大概就是这么个速度。
另外有一点,这个速度是release下面测试的,如果你是debug模式,速度慢是正常的。

from yolov5-seg-opencv-onnxruntime-cpp.

LYHTZHANGJIANG avatar LYHTZHANGJIANG commented on June 19, 2024

@LYHTZHANGJIANG

我的环境是4090 cuda12,ort12.0 是gpu版本,我debug打印看了,是走的cuda,cpu和gpu耗时都是80ms左右,我想问问您那边推理单张图像耗时是多少?

默认640x640的突破的话,前两三张会慢,后面可以达到18-30ms之间(3060,不进行结果绘制,只计算输入图片开始到拿到结果,没有绘制结果),取决于原图大小和上面目标的数量,毕竟计算mask的时候耗时还是比较高的。推理速度的话很快,基本上2-7ms之间,具体没有很详细的计算,大概就是这么个速度。 另外有一点,这个速度是release下面测试的,如果你是debug模式,速度慢是正常的。

我的问题解决了,我是环境版本不对应就没能加速,cuda11.6和11.1 ort12是可以的,单跑推理7ms。但是我跑transformer CPU和GPU的耗时还是一样,我观察了显存是变化了的,请问您这边有遇到过吗?

from yolov5-seg-opencv-onnxruntime-cpp.

UNeedCryDear avatar UNeedCryDear commented on June 19, 2024

模型小,或者GPU前面几次推理速度慢,多跑几次取个均值看下

from yolov5-seg-opencv-onnxruntime-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.