Commit e79be78e authored by Alexander Alekhin's avatar Alexander Alekhin

dnn(workaround): switch to CPU target if compiled without OpenCL

parent 4a6d582f
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <opencv2/imgproc.hpp> #include <opencv2/imgproc.hpp>
#include <opencv2/core/utils/configuration.private.hpp> #include <opencv2/core/utils/configuration.private.hpp>
#include <opencv2/core/utils/logger.hpp>
namespace cv { namespace cv {
namespace dnn { namespace dnn {
...@@ -846,6 +847,13 @@ struct Net::Impl ...@@ -846,6 +847,13 @@ struct Net::Impl
if (!netWasAllocated || this->blobsToKeep != blobsToKeep_) if (!netWasAllocated || this->blobsToKeep != blobsToKeep_)
{ {
#ifndef HAVE_OPENCL
if (preferableBackend == DNN_BACKEND_DEFAULT && preferableTarget == DNN_TARGET_OPENCL)
{
CV_LOG_WARNING(NULL, "DNN: OpenCL target is not available in this OpenCV build, switching to CPU.")
preferableTarget = DNN_TARGET_CPU;
}
#endif
clear(); clear();
allocateLayers(blobsToKeep_); allocateLayers(blobsToKeep_);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment