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

Using CUDA is slower #8

Open
opentld opened this issue Sep 23, 2020 · 2 comments
Open

Using CUDA is slower #8

opentld opened this issue Sep 23, 2020 · 2 comments

Comments

@opentld
Copy link

opentld commented Sep 23, 2020

I tried to change your codes to support cuda, but after using CUDA, the program is slower. When not using cuda, it takes about 0.2 seconds to infer a picture, but after using cuda, it becomes 1.6 seconds. The following is my code, why is this happening?


ProposalNetwork::ProposalNetwork(const ProposalNetwork::Config &config)
{
_net = cv::dnn::readNetFromCaffe(config.protoText, config.caffeModel);

if (_net.empty())
{
throw std::invalid_argument("invalid protoText or caffeModel");
}
else
{
if (config.useGPU)
{
_net.setPreferableBackend(cv::dnn::DNN_BACKEND_CUDA);
_net.setPreferableTarget(cv::dnn::DNN_TARGET_CUDA);
std::cout << "using CUDA" << std::endl;
}
}
_threshold = config.threshold;
}

@ksachdeva

@opentld
Copy link
Author

opentld commented Sep 23, 2020

p.s. I have compiled opencv that supports cuda

@ksachdeva

@drafterleo
Copy link

I have the same problem. Were you solve it?

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