Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
7cf52de4
Commit
7cf52de4
authored
Jul 30, 2018
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnn: modified IE search, R2 compatibility fixed
parent
9433784e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
83 deletions
+93
-83
CMakeLists.txt
CMakeLists.txt
+12
-8
OpenCVDetectInferenceEngine.cmake
cmake/OpenCVDetectInferenceEngine.cmake
+64
-60
CMakeLists.txt
modules/dnn/CMakeLists.txt
+2
-14
op_inf_engine.cpp
modules/dnn/src/op_inf_engine.cpp
+2
-0
op_inf_engine.hpp
modules/dnn/src/op_inf_engine.hpp
+13
-1
No files found.
CMakeLists.txt
View file @
7cf52de4
...
@@ -1407,15 +1407,19 @@ if(WITH_HALIDE OR HAVE_HALIDE)
...
@@ -1407,15 +1407,19 @@ if(WITH_HALIDE OR HAVE_HALIDE)
status
(
" Halide:"
HAVE_HALIDE THEN
"YES (
${
HALIDE_LIBRARIES
}
${
HALIDE_INCLUDE_DIRS
}
)"
ELSE NO
)
status
(
" Halide:"
HAVE_HALIDE THEN
"YES (
${
HALIDE_LIBRARIES
}
${
HALIDE_INCLUDE_DIRS
}
)"
ELSE NO
)
endif
()
endif
()
if
(
WITH_INF_ENGINE OR HAVE_INF_ENGINE
)
if
(
WITH_INF_ENGINE OR INF_ENGINE_TARGET
)
if
(
HAVE_INF_ENGINE
)
if
(
INF_ENGINE_TARGET
)
set
(
__msg
"YES"
)
set
(
__msg
"YES (
${
INF_ENGINE_RELEASE
}
/
${
INF_ENGINE_VERSION
}
)"
)
if
(
DEFINED INF_ENGINE_VERSION
)
get_target_property
(
_lib
${
INF_ENGINE_TARGET
}
IMPORTED_LOCATION
)
set
(
__msg
"YES (ver
${
INF_ENGINE_VERSION
}
)"
)
if
(
NOT _lib
)
endif
()
get_target_property
(
_lib_rel
${
INF_ENGINE_TARGET
}
IMPORTED_IMPLIB_RELEASE
)
get_target_property
(
_lib_dbg
${
INF_ENGINE_TARGET
}
IMPORTED_IMPLIB_DEBUG
)
set
(
_lib
"
${
_lib_rel
}
/
${
_lib_dbg
}
"
)
endif
()
get_target_property
(
_inc
${
INF_ENGINE_TARGET
}
INTERFACE_INCLUDE_DIRECTORIES
)
status
(
" Inference Engine:"
"
${
__msg
}
"
)
status
(
" Inference Engine:"
"
${
__msg
}
"
)
status
(
" libs:"
"
${
INF_ENGINE_LIBRARIES
}
"
)
status
(
" libs:"
"
${
_lib
}
"
)
status
(
" includes:"
"
${
INF_ENGINE_INCLUDE_DIRS
}
"
)
status
(
" includes:"
"
${
_inc
}
"
)
else
()
else
()
status
(
" Inference Engine:"
"NO"
)
status
(
" Inference Engine:"
"NO"
)
endif
()
endif
()
...
...
cmake/OpenCVDetectInferenceEngine.cmake
View file @
7cf52de4
# The script detects Intel(R) Inference Engine installation
# The script detects Intel(R) Inference Engine installation
#
#
#
Parameter
s:
#
Cache variable
s:
# IN
TEL_CVSDK_DIR - Path to Inference Engine root folder
# IN
F_ENGINE_OMP_DIR - directory with OpenMP library to link with (needed by some versions of IE)
# I
E_PLUGINS_PATH - Path to folder with Inference Engine plugins
# I
NF_ENGINE_RELEASE - a number reflecting IE source interface (linked with OpenVINO release)
#
#
# On return this will define:
# Detect parameters:
# 1. Native cmake IE package:
# - enironment variable InferenceEngine_DIR is set to location of cmake module
# 2. Custom location:
# - INF_ENGINE_INCLUDE_DIRS - headers search location
# - INF_ENGINE_LIB_DIRS - library search location
# 3. OpenVINO location:
# - environment variable INTEL_CVSDK_DIR is set to location of OpenVINO installation dir
# - INF_ENGINE_PLATFORM - part of name of library directory representing its platform (default ubuntu_16.04)
#
#
# HAVE_INF_ENGINE - True if Intel Inference Engine was found
# Result:
# INF_ENGINE_INCLUDE_DIRS - Inference Engine include folder
# INF_ENGINE_TARGET - set to name of imported library target representing InferenceEngine
# INF_ENGINE_LIBRARIES - Inference Engine libraries and it's dependencies
#
#
macro
(
ie_fail
)
set
(
HAVE_INF_ENGINE FALSE
)
return
()
endmacro
()
if
(
NOT HAVE_CXX11
)
if
(
NOT HAVE_CXX11
)
message
(
WARNING
"DL Inference engine requires C++11. You can turn it on via ENABLE_CXX11=ON CMake flag."
)
message
(
WARNING
"DL Inference engine requires C++11. You can turn it on via ENABLE_CXX11=ON CMake flag."
)
ie_fail
()
endif
()
find_package
(
InferenceEngine QUIET
)
if
(
InferenceEngine_FOUND
)
set
(
INF_ENGINE_LIBRARIES
"
${
InferenceEngine_LIBRARIES
}
"
)
set
(
INF_ENGINE_INCLUDE_DIRS
"
${
InferenceEngine_INCLUDE_DIRS
}
"
)
set
(
INF_ENGINE_VERSION
"
${
InferenceEngine_VERSION
}
"
)
set
(
HAVE_INF_ENGINE TRUE
)
return
()
return
()
endif
()
endif
()
ocv_check_environment_variables
(
INTEL_CVSDK_DIR INF_ENGINE_ROOT_DIR IE_PLUGINS_PATH
)
# =======================
if
(
NOT INF_ENGINE_ROOT_DIR OR NOT EXISTS
"
${
INF_ENGINE_ROOT_DIR
}
/include/inference_engine.hpp"
)
set
(
ie_root_paths
"
${
INF_ENGINE_ROOT_DIR
}
"
)
if
(
DEFINED INTEL_CVSDK_DIR
)
list
(
APPEND ie_root_paths
"
${
INTEL_CVSDK_DIR
}
/"
)
list
(
APPEND ie_root_paths
"
${
INTEL_CVSDK_DIR
}
/deployment_tools/inference_engine"
)
endif
()
if
(
NOT ie_root_paths
)
function
(
add_custom_ie_build _inc _lib _lib_rel _lib_dbg _msg
)
list
(
APPEND ie_root_paths
"/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/"
)
if
(
NOT _inc OR
NOT
(
_lib OR _lib_rel OR _lib_dbg
))
return
()
endif
()
endif
()
add_library
(
inference_engine UNKNOWN IMPORTED
)
find_path
(
INF_ENGINE_ROOT_DIR include/inference_engine.hpp PATHS
${
ie_root_paths
}
)
set_target_properties
(
inference_engine PROPERTIES
if
(
INF_ENGINE_ROOT_DIR MATCHES
"-NOTFOUND$"
)
IMPORTED_LOCATION
"
${
_lib
}
"
unset
(
INF_ENGINE_ROOT_DIR CACHE
)
IMPORTED_IMPLIB_RELEASE
"
${
_lib_rel
}
"
IMPORTED_IMPLIB_DEBUG
"
${
_lib_dbg
}
"
INTERFACE_INCLUDE_DIRECTORIES
"
${
_inc
}
"
)
find_library
(
omp_lib iomp5 PATHS
"
${
INF_ENGINE_OMP_DIR
}
"
NO_DEFAULT_PATH
)
if
(
NOT omp_lib
)
message
(
WARNING
"OpenMP for IE have not been found. Set INF_ENGINE_OMP_DIR variable if you experience build errors."
)
else
()
set_target_properties
(
inference_engine PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES
"
${
omp_lib
}
"
)
endif
()
endif
()
endif
()
set
(
INF_ENGINE_VERSION
"Unknown"
CACHE STRING
""
)
set
(
INF_ENGINE_TARGET inference_engine PARENT_SCOPE
)
message
(
STATUS
"Detected InferenceEngine:
${
_msg
}
"
)
endfunction
()
set
(
INF_ENGINE_INCLUDE_DIRS
"
${
INF_ENGINE_ROOT_DIR
}
/include"
CACHE PATH
"Path to Inference Engine include directory"
)
# ======================
if
(
NOT INF_ENGINE_ROOT_DIR
find_package
(
InferenceEngine QUIET
)
OR NOT EXISTS
"
${
INF_ENGINE_ROOT_DIR
}
"
if
(
InferenceEngine_FOUND
)
OR NOT EXISTS
"
${
INF_ENGINE_ROOT_DIR
}
/include/inference_engine.hpp"
set
(
INF_ENGINE_TARGET IE::inference_engine
)
)
set
(
INF_ENGINE_VERSION
"
${
InferenceEngine_VERSION
}
"
CACHE STRING
""
)
message
(
WARNING
"DL IE: Can't detect INF_ENGINE_ROOT_DIR location."
)
message
(
STATUS
"Detected InferenceEngine: cmake package"
)
ie_fail
()
endif
()
endif
()
set
(
INF_ENGINE_LIBRARIES
""
)
if
(
NOT INF_ENGINE_TARGET AND INF_ENGINE_LIB_DIRS AND INF_ENGINE_INCLUDE_DIRS
)
find_path
(
ie_custom_inc
"inference_engine.hpp"
PATHS
"
${
INF_ENGINE_INCLUDE_DIRS
}
"
NO_DEFAULT_PATH
)
set
(
ie_lib_list inference_engine
)
find_library
(
ie_custom_lib
"inference_engine"
PATHS
"
${
INF_ENGINE_LIB_DIRS
}
"
NO_DEFAULT_PATH
)
find_library
(
ie_custom_lib_rel
"inference_engine"
PATHS
"
${
INF_ENGINE_LIB_DIRS
}
/Release"
NO_DEFAULT_PATH
)
find_library
(
ie_custom_lib_dbg
"inference_engine"
PATHS
"
${
INF_ENGINE_LIB_DIRS
}
/Debug"
NO_DEFAULT_PATH
)
add_custom_ie_build
(
"
${
ie_custom_inc
}
"
"
${
ie_custom_lib
}
"
"
${
ie_custom_lib_rel
}
"
"
${
ie_custom_lib_dbg
}
"
"INF_ENGINE_{INCLUDE,LIB}_DIRS"
)
endif
()
if
(
NOT IS_ABSOLUTE
"
${
IE_PLUGINS_PATH
}
"
)
set
(
_loc
"$ENV{INTEL_CVSDK_DIR}"
)
set
(
IE_PLUGINS_PATH
"
${
INF_ENGINE_ROOT_DIR
}
/
${
IE_PLUGINS_PATH
}
"
)
if
(
NOT INF_ENGINE_TARGET AND _loc
)
set
(
INF_ENGINE_PLATFORM
"ubuntu_16.04"
CACHE STRING
"InferenceEngine platform (library dir)"
)
find_path
(
ie_custom_env_inc
"inference_engine.hpp"
PATHS
"
${
_loc
}
/deployment_tools/inference_engine/include"
NO_DEFAULT_PATH
)
find_library
(
ie_custom_env_lib
"inference_engine"
PATHS
"
${
_loc
}
/deployment_tools/inference_engine/lib/
${
INF_ENGINE_PLATFORM
}
/intel64"
NO_DEFAULT_PATH
)
find_library
(
ie_custom_env_lib_rel
"inference_engine"
PATHS
"
${
_loc
}
/deployment_tools/inference_engine/lib/intel64/Release"
NO_DEFAULT_PATH
)
find_library
(
ie_custom_env_lib_dbg
"inference_engine"
PATHS
"
${
_loc
}
/deployment_tools/inference_engine/lib/intel64/Debug"
NO_DEFAULT_PATH
)
add_custom_ie_build
(
"
${
ie_custom_env_inc
}
"
"
${
ie_custom_env_lib
}
"
"
${
ie_custom_env_lib_rel
}
"
"
${
ie_custom_env_lib_dbg
}
"
"OpenVINO (
${
_loc
}
)"
)
endif
()
endif
()
link_directories
(
# Add more features to the target
${
INF_ENGINE_ROOT_DIR
}
/external/mkltiny_lnx/lib
${
INF_ENGINE_ROOT_DIR
}
/external/cldnn/lib
)
foreach
(
lib
${
ie_lib_list
}
)
if
(
INF_ENGINE_TARGET
)
find_library
(
${
lib
}
NAMES
${
lib
}
HINTS
${
IE_PLUGINS_PATH
}
)
if
(
NOT INF_ENGINE_RELEASE
)
if
(
NOT
${
lib
}
)
message
(
WARNING
"InferenceEngine version have not been set, 2018R2 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors."
)
message
(
WARNING
"DL IE: Can't find library: '
${
lib
}
'"
)
ie_fail
()
endif
()
endif
()
list
(
APPEND INF_ENGINE_LIBRARIES
${${
lib
}}
)
set
(
INF_ENGINE_RELEASE
"2018020000"
CACHE STRING
"Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)"
)
endforeach
()
set_target_properties
(
${
INF_ENGINE_TARGET
}
PROPERTIES
INTERFACE_COMPILE_DEFINITIONS
"HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=
${
INF_ENGINE_RELEASE
}
"
set
(
HAVE_INF_ENGINE TRUE
)
)
endif
()
modules/dnn/CMakeLists.txt
View file @
7cf52de4
...
@@ -85,12 +85,6 @@ else()
...
@@ -85,12 +85,6 @@ else()
set
(
sources_options EXCLUDE_OPENCL
)
set
(
sources_options EXCLUDE_OPENCL
)
endif
()
endif
()
if
(
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
}
)
if
(
CMAKE_CXX_COMPILER_ID STREQUAL
"GNU"
)
if
(
CMAKE_CXX_COMPILER_ID STREQUAL
"GNU"
)
ocv_append_source_files_cxx_compiler_options
(
fw_srcs
"-Wno-suggest-override"
)
# GCC
ocv_append_source_files_cxx_compiler_options
(
fw_srcs
"-Wno-suggest-override"
)
# GCC
...
@@ -98,9 +92,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
...
@@ -98,9 +92,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
ocv_append_source_files_cxx_compiler_options
(
fw_srcs
"-Wno-inconsistent-missing-override"
)
# Clang
ocv_append_source_files_cxx_compiler_options
(
fw_srcs
"-Wno-inconsistent-missing-override"
)
# Clang
endif
()
endif
()
ocv_glob_module_sources
(
${
sources_options
}
SOURCES
${
fw_srcs
}
)
ocv_glob_module_sources
(
${
sources_options
}
SOURCES
${
fw_srcs
}
)
ocv_create_module
(
${
libs
}
)
ocv_create_module
(
${
libs
}
${
INF_ENGINE_TARGET
}
)
ocv_add_samples
()
ocv_add_samples
()
ocv_add_accuracy_tests
()
ocv_add_accuracy_tests
(
${
INF_ENGINE_TARGET
}
)
ocv_add_perf_tests
()
ocv_add_perf_tests
()
ocv_option
(
${
the_module
}
_PERF_CAFFE
"Add performance tests of Caffe framework"
OFF
)
ocv_option
(
${
the_module
}
_PERF_CAFFE
"Add performance tests of Caffe framework"
OFF
)
...
@@ -120,9 +114,3 @@ if(BUILD_PERF_TESTS)
...
@@ -120,9 +114,3 @@ if(BUILD_PERF_TESTS)
endif
()
endif
()
endif
()
endif
()
endif
()
endif
()
# Test Intel's Inference Engine models
if
(
HAVE_INF_ENGINE AND TARGET opencv_test_dnn
)
ocv_target_include_directories
(
opencv_test_dnn PRIVATE
${
INF_ENGINE_INCLUDE_DIRS
}
)
ocv_target_link_libraries
(
opencv_test_dnn LINK_PRIVATE
${
INF_ENGINE_LIBRARIES
}
)
endif
()
modules/dnn/src/op_inf_engine.cpp
View file @
7cf52de4
...
@@ -334,6 +334,7 @@ size_t InfEngineBackendNet::getBatchSize() const noexcept
...
@@ -334,6 +334,7 @@ size_t InfEngineBackendNet::getBatchSize() const noexcept
return
0
;
return
0
;
}
}
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2018R2)
InferenceEngine
::
StatusCode
InfEngineBackendNet
::
AddExtension
(
const
InferenceEngine
::
IShapeInferExtensionPtr
&
extension
,
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
InferenceEngine
::
StatusCode
InfEngineBackendNet
::
AddExtension
(
const
InferenceEngine
::
IShapeInferExtensionPtr
&
extension
,
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
{
{
CV_Error
(
Error
::
StsNotImplemented
,
""
);
CV_Error
(
Error
::
StsNotImplemented
,
""
);
...
@@ -345,6 +346,7 @@ InferenceEngine::StatusCode InfEngineBackendNet::reshape(const InferenceEngine::
...
@@ -345,6 +346,7 @@ InferenceEngine::StatusCode InfEngineBackendNet::reshape(const InferenceEngine::
CV_Error
(
Error
::
StsNotImplemented
,
""
);
CV_Error
(
Error
::
StsNotImplemented
,
""
);
return
InferenceEngine
::
StatusCode
::
OK
;
return
InferenceEngine
::
StatusCode
::
OK
;
}
}
#endif
void
InfEngineBackendNet
::
init
(
int
targetId
)
void
InfEngineBackendNet
::
init
(
int
targetId
)
{
{
...
...
modules/dnn/src/op_inf_engine.hpp
View file @
7cf52de4
...
@@ -21,6 +21,17 @@
...
@@ -21,6 +21,17 @@
#if defined(__GNUC__) && __GNUC__ >= 5
#if defined(__GNUC__) && __GNUC__ >= 5
//#pragma GCC diagnostic pop
//#pragma GCC diagnostic pop
#endif
#endif
#define INF_ENGINE_RELEASE_2018R1 2018010000
#define INF_ENGINE_RELEASE_2018R2 2018020000
#ifndef INF_ENGINE_RELEASE
#warning("IE version have not been provided via command-line. Using 2018R2 by default")
#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2018R2
#endif
#define INF_ENGINE_VER_MAJOR_GT(ver) (((INF_ENGINE_RELEASE) / 10000) > ((ver) / 10000))
#endif // HAVE_INF_ENGINE
#endif // HAVE_INF_ENGINE
namespace
cv
{
namespace
dnn
{
namespace
cv
{
namespace
dnn
{
...
@@ -92,9 +103,10 @@ public:
...
@@ -92,9 +103,10 @@ public:
virtual
size_t
getBatchSize
()
const
noexcept
CV_OVERRIDE
;
virtual
size_t
getBatchSize
()
const
noexcept
CV_OVERRIDE
;
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2018R2)
virtual
InferenceEngine
::
StatusCode
AddExtension
(
const
InferenceEngine
::
IShapeInferExtensionPtr
&
extension
,
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
;
virtual
InferenceEngine
::
StatusCode
AddExtension
(
const
InferenceEngine
::
IShapeInferExtensionPtr
&
extension
,
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
;
virtual
InferenceEngine
::
StatusCode
reshape
(
const
InputShapes
&
inputShapes
,
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
;
virtual
InferenceEngine
::
StatusCode
reshape
(
const
InputShapes
&
inputShapes
,
InferenceEngine
::
ResponseDesc
*
resp
)
noexcept
;
#endif
void
init
(
int
targetId
);
void
init
(
int
targetId
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment