hpc203 / yolov5-dnn-cpp-python

用opencv的dnn模块做yolov5目标检测,包含C++和Python两个版本的程序

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenCV开了cuda加速,但是没有提升,会是什么原因呢?

cucrui opened this issue · comments

您好,opencv的cuda加速在yolact上很明显,大概有5倍的提升,但是在yolov5s上,几乎没有变化,想请教您可能是什么原因呢?非常感谢!

string modelFile = this->netname;
modelFile += ".onnx";
cout << "load modelFile : " << modelFile << endl; 
this->net = readNet(modelFile);
// 增加这两行用来加速 
this->net.setPreferableBackend(DNN_BACKEND_CUDA);
this->net.setPreferableTarget(DNN_TARGET_CUDA);