提交 2f3a9ba1 编写于 作者: D Dmitry Kurtaev

Update OpenCVDetectInferenceEngine.cmake

上级 7972f47e
......@@ -46,9 +46,13 @@ endif()
set(INF_ENGINE_LIBRARIES "")
set(ie_lib_list inference_engine)
if(UNIX)
list(APPEND ie_lib_list mklml_intel iomp5)
endif()
link_directories(
${INTEL_CVSDK_DIR}/external/mklml_lnx/lib
${INTEL_CVSDK_DIR}/inference_engine/external/mklml_lnx/lib
${INTEL_CVSDK_DIR}/external/cldnn/lib
${INTEL_CVSDK_DIR}/inference_engine/external/cldnn/lib
)
foreach(lib ${ie_lib_list})
find_library(${lib}
......@@ -56,9 +60,6 @@ foreach(lib ${ie_lib_list})
# For inference_engine
HINTS ${IE_PLUGINS_PATH}
HINTS "$ENV{IE_PLUGINS_PATH}"
# For mklml_intel, iomp5
HINTS ${INTEL_CVSDK_DIR}/external/mklml_lnx/lib
HINTS ${INTEL_CVSDK_DIR}/inference_engine/external/mklml_lnx/lib
)
if(NOT ${lib})
ie_fail()
......@@ -67,7 +68,3 @@ foreach(lib ${ie_lib_list})
endforeach()
set(HAVE_INF_ENGINE TRUE)
include_directories(${INF_ENGINE_INCLUDE_DIRS})
list(APPEND OPENCV_LINKER_LIBS ${INF_ENGINE_LIBRARIES})
add_definitions(-DHAVE_INF_ENGINE)
......@@ -59,7 +59,7 @@ ocv_create_module(${extra_libs})
ocv_target_link_libraries(${the_module} LINK_PRIVATE
"${ZLIB_LIBRARIES}" "${OPENCL_LIBRARIES}" "${VA_LIBRARIES}"
"${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}" "${INF_ENGINE_LIBRARIES}"
"${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}"
"${ITT_LIBRARIES}"
"${OPENCV_HAL_LINKER_LIBS}"
)
......
......@@ -73,14 +73,22 @@ endif()
set(include_dirs ${fw_inc})
set(sources_options "")
set(libs libprotobuf ${LAPACK_LIBRARIES})
if(OPENCV_DNN_OPENCL AND HAVE_OPENCL)
list(APPEND include_dirs ${OPENCL_INCLUDE_DIRS})
else()
set(sources_options EXCLUDE_OPENCL)
endif()
if(WITH_INF_ENGINE AND HAVE_INF_ENGINE)
add_definitions(-DHAVE_INF_ENGINE=1)
list(APPEND include_dirs ${INF_ENGINE_INCLUDE_DIRS})
list(APPEND libs ${INF_ENGINE_LIBRARIES})
endif()
ocv_module_include_directories(${include_dirs})
ocv_glob_module_sources(${sources_options} SOURCES ${fw_srcs})
ocv_create_module(libprotobuf ${LAPACK_LIBRARIES})
ocv_create_module(${libs})
ocv_add_samples()
ocv_add_accuracy_tests()
ocv_add_perf_tests()
......
......@@ -1915,9 +1915,8 @@ Net::Net() : impl(new Net::Impl)
Net Net::readFromModelOptimizer(const String& xml, const String& bin)
{
Net cvNet;
#ifndef HAVE_INF_ENGINE
CV_Error(Error::StsError, "Build OpenCV with Inference Engine to enable loading models from Model Optimizer.");
CV_ErrorNoReturn(Error::StsError, "Build OpenCV with Inference Engine to enable loading models from Model Optimizer.");
#else
InferenceEngine::CNNNetReader reader;
reader.ReadNetwork(xml);
......@@ -1931,6 +1930,7 @@ Net Net::readFromModelOptimizer(const String& xml, const String& bin)
inputsNames.push_back(it.first);
}
Net cvNet;
cvNet.setInputsNames(inputsNames);
Ptr<InfEngineBackendNode> backendNode(new InfEngineBackendNode(0));
......@@ -1949,8 +1949,8 @@ Net Net::readFromModelOptimizer(const String& xml, const String& bin)
cvNet.setPreferableBackend(DNN_BACKEND_INFERENCE_ENGINE);
cvNet.impl->skipInfEngineInit = true;
#endif // HAVE_INF_ENGINE
return cvNet;
#endif // HAVE_INF_ENGINE
}
Net::~Net()
......@@ -2894,9 +2894,8 @@ Net readNet(const String& _model, const String& _config, const String& _framewor
std::swap(model, config);
return readNetFromModelOptimizer(config, model);
}
CV_Error(Error::StsError, "Cannot determine an origin framework of files: " +
model + (config.empty() ? "" : ", " + config));
return Net();
CV_ErrorNoReturn(Error::StsError, "Cannot determine an origin framework of files: " +
model + (config.empty() ? "" : ", " + config));
}
Net readNetFromModelOptimizer(const String &xml, const String &bin)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册