Commit 2f3a9ba1 authored by Dmitry Kurtaev's avatar Dmitry Kurtaev

Update OpenCVDetectInferenceEngine.cmake

parent 7972f47e
...@@ -46,9 +46,13 @@ endif() ...@@ -46,9 +46,13 @@ endif()
set(INF_ENGINE_LIBRARIES "") set(INF_ENGINE_LIBRARIES "")
set(ie_lib_list inference_engine) set(ie_lib_list inference_engine)
if(UNIX)
list(APPEND ie_lib_list mklml_intel iomp5) link_directories(
endif() ${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}) foreach(lib ${ie_lib_list})
find_library(${lib} find_library(${lib}
...@@ -56,9 +60,6 @@ foreach(lib ${ie_lib_list}) ...@@ -56,9 +60,6 @@ foreach(lib ${ie_lib_list})
# For inference_engine # For inference_engine
HINTS ${IE_PLUGINS_PATH} HINTS ${IE_PLUGINS_PATH}
HINTS "$ENV{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}) if(NOT ${lib})
ie_fail() ie_fail()
...@@ -67,7 +68,3 @@ foreach(lib ${ie_lib_list}) ...@@ -67,7 +68,3 @@ foreach(lib ${ie_lib_list})
endforeach() endforeach()
set(HAVE_INF_ENGINE TRUE) 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}) ...@@ -59,7 +59,7 @@ ocv_create_module(${extra_libs})
ocv_target_link_libraries(${the_module} LINK_PRIVATE ocv_target_link_libraries(${the_module} LINK_PRIVATE
"${ZLIB_LIBRARIES}" "${OPENCL_LIBRARIES}" "${VA_LIBRARIES}" "${ZLIB_LIBRARIES}" "${OPENCL_LIBRARIES}" "${VA_LIBRARIES}"
"${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}" "${INF_ENGINE_LIBRARIES}" "${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}"
"${ITT_LIBRARIES}" "${ITT_LIBRARIES}"
"${OPENCV_HAL_LINKER_LIBS}" "${OPENCV_HAL_LINKER_LIBS}"
) )
......
...@@ -73,14 +73,22 @@ endif() ...@@ -73,14 +73,22 @@ endif()
set(include_dirs ${fw_inc}) set(include_dirs ${fw_inc})
set(sources_options "") set(sources_options "")
set(libs libprotobuf ${LAPACK_LIBRARIES})
if(OPENCV_DNN_OPENCL AND HAVE_OPENCL) if(OPENCV_DNN_OPENCL AND HAVE_OPENCL)
list(APPEND include_dirs ${OPENCL_INCLUDE_DIRS}) list(APPEND include_dirs ${OPENCL_INCLUDE_DIRS})
else() else()
set(sources_options EXCLUDE_OPENCL) set(sources_options EXCLUDE_OPENCL)
endif() 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_module_include_directories(${include_dirs})
ocv_glob_module_sources(${sources_options} SOURCES ${fw_srcs}) ocv_glob_module_sources(${sources_options} SOURCES ${fw_srcs})
ocv_create_module(libprotobuf ${LAPACK_LIBRARIES}) ocv_create_module(${libs})
ocv_add_samples() ocv_add_samples()
ocv_add_accuracy_tests() ocv_add_accuracy_tests()
ocv_add_perf_tests() ocv_add_perf_tests()
......
...@@ -1915,9 +1915,8 @@ Net::Net() : impl(new Net::Impl) ...@@ -1915,9 +1915,8 @@ Net::Net() : impl(new Net::Impl)
Net Net::readFromModelOptimizer(const String& xml, const String& bin) Net Net::readFromModelOptimizer(const String& xml, const String& bin)
{ {
Net cvNet;
#ifndef HAVE_INF_ENGINE #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 #else
InferenceEngine::CNNNetReader reader; InferenceEngine::CNNNetReader reader;
reader.ReadNetwork(xml); reader.ReadNetwork(xml);
...@@ -1931,6 +1930,7 @@ Net Net::readFromModelOptimizer(const String& xml, const String& bin) ...@@ -1931,6 +1930,7 @@ Net Net::readFromModelOptimizer(const String& xml, const String& bin)
inputsNames.push_back(it.first); inputsNames.push_back(it.first);
} }
Net cvNet;
cvNet.setInputsNames(inputsNames); cvNet.setInputsNames(inputsNames);
Ptr<InfEngineBackendNode> backendNode(new InfEngineBackendNode(0)); Ptr<InfEngineBackendNode> backendNode(new InfEngineBackendNode(0));
...@@ -1949,8 +1949,8 @@ Net Net::readFromModelOptimizer(const String& xml, const String& bin) ...@@ -1949,8 +1949,8 @@ Net Net::readFromModelOptimizer(const String& xml, const String& bin)
cvNet.setPreferableBackend(DNN_BACKEND_INFERENCE_ENGINE); cvNet.setPreferableBackend(DNN_BACKEND_INFERENCE_ENGINE);
cvNet.impl->skipInfEngineInit = true; cvNet.impl->skipInfEngineInit = true;
#endif // HAVE_INF_ENGINE
return cvNet; return cvNet;
#endif // HAVE_INF_ENGINE
} }
Net::~Net() Net::~Net()
...@@ -2894,9 +2894,8 @@ Net readNet(const String& _model, const String& _config, const String& _framewor ...@@ -2894,9 +2894,8 @@ Net readNet(const String& _model, const String& _config, const String& _framewor
std::swap(model, config); std::swap(model, config);
return readNetFromModelOptimizer(config, model); return readNetFromModelOptimizer(config, model);
} }
CV_Error(Error::StsError, "Cannot determine an origin framework of files: " + CV_ErrorNoReturn(Error::StsError, "Cannot determine an origin framework of files: " +
model + (config.empty() ? "" : ", " + config)); model + (config.empty() ? "" : ", " + config));
return Net();
} }
Net readNetFromModelOptimizer(const String &xml, const String &bin) Net readNetFromModelOptimizer(const String &xml, const String &bin)
......
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