From 870a775d7d891c82278723485d5719fd2f69748f Mon Sep 17 00:00:00 2001 From: Dmitry Kurtaev Date: Tue, 14 Apr 2020 13:54:54 +0300 Subject: [PATCH 01/12] Align DLIE and nGraph average pooling layers --- modules/dnn/src/layers/pooling_layer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dnn/src/layers/pooling_layer.cpp b/modules/dnn/src/layers/pooling_layer.cpp index 83f3df0522..cd16ec7f3b 100644 --- a/modules/dnn/src/layers/pooling_layer.cpp +++ b/modules/dnn/src/layers/pooling_layer.cpp @@ -325,7 +325,7 @@ public: ieLayer.setRoundingType(ceilMode ? InferenceEngine::Builder::PoolingLayer::RoundingType::CEIL : InferenceEngine::Builder::PoolingLayer::RoundingType::FLOOR); - ieLayer.setExcludePad(type == AVE && padMode == "SAME"); + ieLayer.setExcludePad(!avePoolPaddedArea); InferenceEngine::Builder::Layer l = ieLayer; if (!padMode.empty()) From 91b01002875ea505a28dab221f5ad7c8932b08bb Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sun, 12 Apr 2020 23:36:21 +0300 Subject: [PATCH 02/12] Fixed compilation when NN builder is not built --- modules/dnn/CMakeLists.txt | 8 +++++++- modules/dnn/src/op_inf_engine.hpp | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt index 8b7dd2faea..8b7ab91142 100644 --- a/modules/dnn/CMakeLists.txt +++ b/modules/dnn/CMakeLists.txt @@ -107,7 +107,13 @@ endif() set(dnn_runtime_libs "") if(INF_ENGINE_TARGET) - ocv_option(OPENCV_DNN_IE_NN_BUILDER_2019 "Build with Inference Engine NN Builder API support" ON) # future: NOT HAVE_NGRAPH + set(use_nn_builder OFF) + if(TARGET inference_engine_nn_builder OR # custom imported target + TARGET IE::inference_engine_nn_builder OR # default imported target via InferenceEngineConfig.cmake + INF_ENGINE_RELEASE VERSION_LESS "2020000000") # compatibility with older versions on IE + set(use_nn_builder ON) + endif() + ocv_option(OPENCV_DNN_IE_NN_BUILDER_2019 "Build with Inference Engine NN Builder API support" ${use_nn_builder}) # future: NOT HAVE_NGRAPH if(OPENCV_DNN_IE_NN_BUILDER_2019) message(STATUS "DNN: Enabling Inference Engine NN Builder API support") add_definitions(-DHAVE_DNN_IE_NN_BUILDER_2019=1) diff --git a/modules/dnn/src/op_inf_engine.hpp b/modules/dnn/src/op_inf_engine.hpp index 54bc76941b..59fa920738 100644 --- a/modules/dnn/src/op_inf_engine.hpp +++ b/modules/dnn/src/op_inf_engine.hpp @@ -58,7 +58,9 @@ #include +#ifdef HAVE_DNN_IE_NN_BUILDER_2019 #include +#endif #if defined(__GNUC__) && INF_ENGINE_VER_MAJOR_LT(INF_ENGINE_RELEASE_2020_1) #pragma GCC visibility pop From 18550b4601bdbbeb467870bc736efdee47e817df Mon Sep 17 00:00:00 2001 From: Vadim Levin Date: Wed, 15 Apr 2020 14:12:31 +0300 Subject: [PATCH 03/12] test: Added tests for VideoCapture constructors in java --- .../misc/java/test/VideoCaptureTest.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/videoio/misc/java/test/VideoCaptureTest.java b/modules/videoio/misc/java/test/VideoCaptureTest.java index e61277492f..9609a55620 100644 --- a/modules/videoio/misc/java/test/VideoCaptureTest.java +++ b/modules/videoio/misc/java/test/VideoCaptureTest.java @@ -35,10 +35,30 @@ public class VideoCaptureTest extends OpenCVTestCase { assertFalse(capture.isOpened()); } - public void testVideoCapture() { + public void testDefaultConstructor() { capture = new VideoCapture(); assertNotNull(capture); assertFalse(capture.isOpened()); } + public void testConstructorWithFilename() { + capture = new VideoCapture("some_file.avi"); + assertNotNull(capture); + } + + public void testConstructorWithFilenameAndExplicitlySpecifiedAPI() { + capture = new VideoCapture("some_file.avi", Videoio.CAP_ANY); + assertNotNull(capture); + } + + public void testConstructorWithIndex() { + capture = new VideoCapture(0); + assertNotNull(capture); + } + + public void testConstructorWithIndexAndExplicitlySpecifiedAPI() { + capture = new VideoCapture(0, Videoio.CAP_ANY); + assertNotNull(capture); + } + } From ef68cc3d5f5b37ffafa63b72d25eca9e8f9e9fb9 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 27 Feb 2020 14:28:50 +0300 Subject: [PATCH 04/12] dnn: use OpenVINO 2020.2 defines original commit: 45263d76429390a4c625f262248312dd68c57111 --- cmake/OpenCVDetectInferenceEngine.cmake | 4 ++-- modules/dnn/src/op_inf_engine.hpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/OpenCVDetectInferenceEngine.cmake b/cmake/OpenCVDetectInferenceEngine.cmake index 2937cc706d..7eb81d6ef5 100644 --- a/cmake/OpenCVDetectInferenceEngine.cmake +++ b/cmake/OpenCVDetectInferenceEngine.cmake @@ -135,9 +135,9 @@ endif() if(INF_ENGINE_TARGET) if(NOT INF_ENGINE_RELEASE) - message(WARNING "InferenceEngine version has not been set, 2020.1 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.") + message(WARNING "InferenceEngine version has not been set, 2020.2 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.") endif() - set(INF_ENGINE_RELEASE "2020010000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)") + set(INF_ENGINE_RELEASE "2020020000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)") set_target_properties(${INF_ENGINE_TARGET} PROPERTIES INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}" ) diff --git a/modules/dnn/src/op_inf_engine.hpp b/modules/dnn/src/op_inf_engine.hpp index 54bc76941b..588742fc9d 100644 --- a/modules/dnn/src/op_inf_engine.hpp +++ b/modules/dnn/src/op_inf_engine.hpp @@ -24,10 +24,11 @@ #define INF_ENGINE_RELEASE_2019R2 2019020000 #define INF_ENGINE_RELEASE_2019R3 2019030000 #define INF_ENGINE_RELEASE_2020_1 2020010000 +#define INF_ENGINE_RELEASE_2020_2 2020020000 #ifndef INF_ENGINE_RELEASE -#warning("IE version have not been provided via command-line. Using 2019.1 by default") -#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2020_1 +#warning("IE version have not been provided via command-line. Using 2020.2 by default") +#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2020_2 #endif #define INF_ENGINE_VER_MAJOR_GT(ver) (((INF_ENGINE_RELEASE) / 10000) > ((ver) / 10000)) From 1d8c73cf6c9d0ef1022d3a302aef0e13bc255602 Mon Sep 17 00:00:00 2001 From: Vadim Levin Date: Wed, 15 Apr 2020 14:25:39 +0300 Subject: [PATCH 05/12] feature: Added `explicit` support to header parser - It is safe to remove `explicit` keyword for constructors with 1 argument, because it is C++ specific keyword and does not affect any of the generated binding. --- modules/python/src2/hdr_parser.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/python/src2/hdr_parser.py b/modules/python/src2/hdr_parser.py index 780a263ced..eba7000d47 100755 --- a/modules/python/src2/hdr_parser.py +++ b/modules/python/src2/hdr_parser.py @@ -430,9 +430,10 @@ class CppHeaderParser(object): # filter off some common prefixes, which are meaningless for Python wrappers. # note that we do not strip "static" prefix, which does matter; # it means class methods, not instance methods - decl_str = self.batch_replace(decl_str, [("static inline", ""), ("inline", ""),\ - ("CV_EXPORTS_W", ""), ("CV_EXPORTS", ""), ("CV_CDECL", ""), ("CV_WRAP ", " "), ("CV_INLINE", ""), - ("CV_DEPRECATED", ""), ("CV_DEPRECATED_EXTERNAL", "")]).strip() + decl_str = self.batch_replace(decl_str, [("static inline", ""), ("inline", ""), ("explicit ", ""), + ("CV_EXPORTS_W", ""), ("CV_EXPORTS", ""), ("CV_CDECL", ""), + ("CV_WRAP ", " "), ("CV_INLINE", ""), + ("CV_DEPRECATED", ""), ("CV_DEPRECATED_EXTERNAL", "")]).strip() if decl_str.strip().startswith('virtual'): From f39784c5842a8db7de5249c1acf3b94a41cc3d1e Mon Sep 17 00:00:00 2001 From: Tomoaki Teshima Date: Wed, 15 Apr 2020 23:25:12 +0900 Subject: [PATCH 06/12] fix test failure on Jetson TX2 --- modules/cudabgsegm/test/test_bgsegm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cudabgsegm/test/test_bgsegm.cpp b/modules/cudabgsegm/test/test_bgsegm.cpp index c0c319ff42..56a039387b 100644 --- a/modules/cudabgsegm/test/test_bgsegm.cpp +++ b/modules/cudabgsegm/test/test_bgsegm.cpp @@ -110,7 +110,7 @@ CUDA_TEST_P(MOG2, Update) mog2_gold->apply(frame, foreground_gold); - ASSERT_MAT_SIMILAR(foreground_gold, foreground, detectShadow ? 13e-3 : 18e-8); + ASSERT_MAT_SIMILAR(foreground_gold, foreground, detectShadow ? 13e-3 : 2e-4); } } From ff4ce9f7b19036f7822ecf5c1f686636077700df Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 13 Apr 2020 21:17:11 +0000 Subject: [PATCH 07/12] build: winpack_dldt with dldt 2020.2 --- ...20200413-dldt-disable-unused-targets.patch | 202 ++++++++++++++++++ .../20200413-dldt-fix-binaries-location.patch | 13 ++ .../2020.2/20200413-dldt-pdb.patch | 14 ++ ...200415-ngraph-disable-unused-options.patch | 14 ++ platforms/winpack_dldt/2020.2/patch.config.py | 4 + .../winpack_dldt/2020.2/sysroot.config.py | 56 +++++ platforms/winpack_dldt/build_package.py | 44 +++- 7 files changed, 336 insertions(+), 11 deletions(-) create mode 100644 platforms/winpack_dldt/2020.2/20200413-dldt-disable-unused-targets.patch create mode 100644 platforms/winpack_dldt/2020.2/20200413-dldt-fix-binaries-location.patch create mode 100644 platforms/winpack_dldt/2020.2/20200413-dldt-pdb.patch create mode 100644 platforms/winpack_dldt/2020.2/20200415-ngraph-disable-unused-options.patch create mode 100644 platforms/winpack_dldt/2020.2/patch.config.py create mode 100644 platforms/winpack_dldt/2020.2/sysroot.config.py diff --git a/platforms/winpack_dldt/2020.2/20200413-dldt-disable-unused-targets.patch b/platforms/winpack_dldt/2020.2/20200413-dldt-disable-unused-targets.patch new file mode 100644 index 0000000000..c42c760589 --- /dev/null +++ b/platforms/winpack_dldt/2020.2/20200413-dldt-disable-unused-targets.patch @@ -0,0 +1,202 @@ +diff --git a/inference-engine/CMakeLists.txt b/inference-engine/CMakeLists.txt +index e7ea6547..7333d19c 100644 +--- a/inference-engine/CMakeLists.txt ++++ b/inference-engine/CMakeLists.txt +@@ -72,11 +72,11 @@ if(ENABLE_TESTS) + add_subdirectory(tests) + endif() + +-add_subdirectory(tools) ++#add_subdirectory(tools) + + # gflags and format_reader targets are kept inside of samples directory and + # they must be built even if samples build is disabled (required for tests and tools). +-add_subdirectory(samples) ++#add_subdirectory(samples) + + file(GLOB_RECURSE SAMPLES_SOURCES samples/*.cpp samples/*.hpp samples/*.h) + add_cpplint_target(sample_cpplint +@@ -154,10 +154,10 @@ endif() + # Developer package + # + +-ie_developer_export_targets(format_reader) ++#ie_developer_export_targets(format_reader) + ie_developer_export_targets(${NGRAPH_LIBRARIES}) + +-ie_developer_export() ++#ie_developer_export() + + configure_file( + "${IE_MAIN_SOURCE_DIR}/cmake/developer_package_config.cmake.in" +diff --git a/inference-engine/src/legacy_api/CMakeLists.txt b/inference-engine/src/legacy_api/CMakeLists.txt +index a03a5f23..63d4f687 100644 +--- a/inference-engine/src/legacy_api/CMakeLists.txt ++++ b/inference-engine/src/legacy_api/CMakeLists.txt +@@ -22,7 +22,7 @@ source_group("include" FILES ${PUBLIC_HEADERS}) + + # Create object library + +-add_library(${TARGET_NAME}_obj OBJECT ++add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL + ${LIBRARY_SRC} + ${NN_BUILDER_LIBRARY_SRC} + ${PUBLIC_HEADERS}) +diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt +index 2071c126..015d8ff8 100644 +--- a/inference-engine/src/inference_engine/CMakeLists.txt ++++ b/inference-engine/src/inference_engine/CMakeLists.txt +@@ -98,7 +98,7 @@ add_clang_format_target(${TARGET_NAME}_plugin_api_clang_format FOR_SOURCES ${plu + + # Create common base object library + +-add_library(${TARGET_NAME}_common_obj OBJECT ++add_library(${TARGET_NAME}_common_obj OBJECT EXCLUDE_FROM_ALL + ${IE_BASE_SOURCE_FILES}) + + target_compile_definitions(${TARGET_NAME}_common_obj PRIVATE IMPLEMENT_INFERENCE_ENGINE_API) +@@ -110,7 +110,7 @@ target_include_directories(${TARGET_NAME}_common_obj SYSTEM PRIVATE + + # Create object library + +-add_library(${TARGET_NAME}_obj OBJECT ++add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL + ${LIBRARY_SRC} + ${LIBRARY_HEADERS} + ${PUBLIC_HEADERS}) +@@ -200,7 +200,7 @@ add_clang_format_target(${TARGET_NAME}_nn_builder_clang_format FOR_TARGETS ${TAR + + # Static library used for unit tests which are always built + +-add_library(${TARGET_NAME}_s STATIC ++add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL + $ + $ + $ +diff --git a/inference-engine/src/mkldnn_plugin/CMakeLists.txt b/inference-engine/src/mkldnn_plugin/CMakeLists.txt +index 52183e86..4fd6d7d4 100644 +--- a/inference-engine/src/mkldnn_plugin/CMakeLists.txt ++++ b/inference-engine/src/mkldnn_plugin/CMakeLists.txt +@@ -163,9 +163,9 @@ add_library(mkldnn_plugin_layers_no_opt OBJECT ${CROSS_COMPILED_SOURCES}) + set_ie_threading_interface_for(mkldnn_plugin_layers_no_opt) + target_compile_definitions(mkldnn_plugin_layers_no_opt PRIVATE "IMPLEMENT_INFERENCE_ENGINE_PLUGIN") + +-add_library(mkldnn_plugin_layers_no_opt_s OBJECT ${CROSS_COMPILED_SOURCES}) +-set_ie_threading_interface_for(mkldnn_plugin_layers_no_opt_s) +-target_compile_definitions(mkldnn_plugin_layers_no_opt_s PRIVATE "USE_STATIC_IE;IMPLEMENT_INFERENCE_ENGINE_PLUGIN") ++#add_library(mkldnn_plugin_layers_no_opt_s OBJECT ${CROSS_COMPILED_SOURCES}) ++#set_ie_threading_interface_for(mkldnn_plugin_layers_no_opt_s) ++#target_compile_definitions(mkldnn_plugin_layers_no_opt_s PRIVATE "USE_STATIC_IE;IMPLEMENT_INFERENCE_ENGINE_PLUGIN") + + set(object_libraries mkldnn_plugin_layers_no_opt) + set(mkldnn_plugin_object_libraries mkldnn_plugin_layers_no_opt_s) +@@ -190,7 +190,7 @@ if (ENABLE_SSE42) + endfunction() + + mkldnn_create_sse42_layers(mkldnn_plugin_layers_sse42) +- mkldnn_create_sse42_layers(mkldnn_plugin_layers_sse42_s) ++ #mkldnn_create_sse42_layers(mkldnn_plugin_layers_sse42_s) + + list(APPEND object_libraries mkldnn_plugin_layers_sse42) + list(APPEND mkldnn_plugin_object_libraries mkldnn_plugin_layers_sse42_s) +@@ -216,7 +216,7 @@ if (ENABLE_AVX2) + endfunction() + + mkldnn_create_avx2_layers(mkldnn_plugin_layers_avx2) +- mkldnn_create_avx2_layers(mkldnn_plugin_layers_avx2_s) ++ #mkldnn_create_avx2_layers(mkldnn_plugin_layers_avx2_s) + + list(APPEND object_libraries mkldnn_plugin_layers_avx2) + list(APPEND mkldnn_plugin_object_libraries mkldnn_plugin_layers_avx2_s) +@@ -242,7 +242,7 @@ if (ENABLE_AVX512F) + endfunction() + + mkldnn_create_avx512f_layers(mkldnn_plugin_layers_avx512) +- mkldnn_create_avx512f_layers(mkldnn_plugin_layers_avx512_s) ++ #mkldnn_create_avx512f_layers(mkldnn_plugin_layers_avx512_s) + + list(APPEND object_libraries mkldnn_plugin_layers_avx512) + list(APPEND mkldnn_plugin_object_libraries mkldnn_plugin_layers_avx512_s) +@@ -264,7 +264,7 @@ target_link_libraries(${TARGET_NAME} PRIVATE inference_engine inference_engine_l + + # add test object library + +-add_library(${TARGET_NAME}_obj OBJECT ${SOURCES} ${HEADERS}) ++add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL ${SOURCES} ${HEADERS}) + + target_include_directories(${TARGET_NAME}_obj PRIVATE $ + $ +diff --git a/inference-engine/src/preprocessing/CMakeLists.txt b/inference-engine/src/preprocessing/CMakeLists.txt +index c3ad1e58..b5913840 100644 +--- a/inference-engine/src/preprocessing/CMakeLists.txt ++++ b/inference-engine/src/preprocessing/CMakeLists.txt +@@ -124,7 +124,7 @@ endif() + + # Create object library + +-add_library(${TARGET_NAME}_obj OBJECT ++add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL + ${LIBRARY_SRC} + ${LIBRARY_HEADERS}) + +@@ -167,7 +167,7 @@ endif() + + # Static library used for unit tests which are always built + +-add_library(${TARGET_NAME}_s STATIC ++add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL + $) + + set_ie_threading_interface_for(${TARGET_NAME}_s) +diff --git a/inference-engine/src/vpu/common/CMakeLists.txt b/inference-engine/src/vpu/common/CMakeLists.txt +index 65215299..03ba4a4c 100644 +--- a/inference-engine/src/vpu/common/CMakeLists.txt ++++ b/inference-engine/src/vpu/common/CMakeLists.txt +@@ -53,7 +53,7 @@ add_common_target("vpu_common_lib" FALSE) + + # Unit tests support for graph transformer + if(WIN32) +- add_common_target("vpu_common_lib_test_static" TRUE) ++ #add_common_target("vpu_common_lib_test_static" TRUE) + else() + add_library("vpu_common_lib_test_static" ALIAS "vpu_common_lib") + endif() +diff --git a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt +index 982d3c7f..15fcf3e8 100644 +--- a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt ++++ b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt +@@ -64,7 +64,7 @@ add_graph_transformer_target("vpu_graph_transformer" FALSE) + + # Unit tests support for graph transformer + if(WIN32) +- add_graph_transformer_target("vpu_graph_transformer_test_static" TRUE) ++ #add_graph_transformer_target("vpu_graph_transformer_test_static" TRUE) + else() + add_library("vpu_graph_transformer_test_static" ALIAS "vpu_graph_transformer") + endif() +diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt +index ebf32c71..ad8cb435 100644 +--- a/inference-engine/thirdparty/CMakeLists.txt ++++ b/inference-engine/thirdparty/CMakeLists.txt +@@ -36,7 +36,7 @@ function(build_with_lto) + endif() + + add_subdirectory(pugixml) +- add_subdirectory(stb_lib) ++ #add_subdirectory(stb_lib) + add_subdirectory(ade) + add_subdirectory(fluid/modules/gapi) + +diff --git a/inference-engine/thirdparty/pugixml/CMakeLists.txt b/inference-engine/thirdparty/pugixml/CMakeLists.txt +index 8bcb2801..f7e031c0 100644 +--- a/inference-engine/thirdparty/pugixml/CMakeLists.txt ++++ b/inference-engine/thirdparty/pugixml/CMakeLists.txt +@@ -41,7 +41,7 @@ if(BUILD_SHARED_LIBS) + else() + add_library(pugixml STATIC ${SOURCES}) + if (MSVC) +- add_library(pugixml_mt STATIC ${SOURCES}) ++ #add_library(pugixml_mt STATIC ${SOURCES}) + #if (WIN32) + # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + # set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") diff --git a/platforms/winpack_dldt/2020.2/20200413-dldt-fix-binaries-location.patch b/platforms/winpack_dldt/2020.2/20200413-dldt-fix-binaries-location.patch new file mode 100644 index 0000000000..153e342ab9 --- /dev/null +++ b/platforms/winpack_dldt/2020.2/20200413-dldt-fix-binaries-location.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/developer_package.cmake b/cmake/developer_package.cmake +index bed73503..5124795a 100644 +--- a/cmake/developer_package.cmake ++++ b/cmake/developer_package.cmake +@@ -137,7 +137,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "") + set(CMAKE_BUILD_TYPE "Release") + endif() + +-set(OUTPUT_ROOT ${OpenVINO_MAIN_SOURCE_DIR}) ++set(OUTPUT_ROOT "${CMAKE_BINARY_DIR}") + + # Enable postfixes for Debug/Release builds + set(IE_DEBUG_POSTFIX_WIN "d") diff --git a/platforms/winpack_dldt/2020.2/20200413-dldt-pdb.patch b/platforms/winpack_dldt/2020.2/20200413-dldt-pdb.patch new file mode 100644 index 0000000000..5cf51e2e1f --- /dev/null +++ b/platforms/winpack_dldt/2020.2/20200413-dldt-pdb.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index edf8233f..cf197376 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -18,6 +18,9 @@ endif() + + project(OpenVINO) + ++set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /FS") ++set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") ++ + set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(IE_MAIN_SOURCE_DIR ${OpenVINO_MAIN_SOURCE_DIR}/inference-engine) + set(CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) diff --git a/platforms/winpack_dldt/2020.2/20200415-ngraph-disable-unused-options.patch b/platforms/winpack_dldt/2020.2/20200415-ngraph-disable-unused-options.patch new file mode 100644 index 0000000000..8151755d46 --- /dev/null +++ b/platforms/winpack_dldt/2020.2/20200415-ngraph-disable-unused-options.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index edf8233f..addac6cd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -78,8 +78,7 @@ function(build_ngraph) + if (NOT ANDROID) + ngraph_set(NGRAPH_UNIT_TEST_ENABLE TRUE) + ngraph_set(NGRAPH_UNIT_TEST_OPENVINO_ENABLE TRUE) +- # ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE TRUE) +- set(NGRAPH_ONNX_IMPORT_ENABLE TRUE CACHE BOOL "" FORCE) ++ ngraph_set(NGRAPH_ONNX_IMPORT_ENABLE TRUE) + else() + ngraph_set(NGRAPH_UNIT_TEST_ENABLE FALSE) + ngraph_set(NGRAPH_TEST_UTIL_ENABLE FALSE) diff --git a/platforms/winpack_dldt/2020.2/patch.config.py b/platforms/winpack_dldt/2020.2/patch.config.py new file mode 100644 index 0000000000..b40970cb20 --- /dev/null +++ b/platforms/winpack_dldt/2020.2/patch.config.py @@ -0,0 +1,4 @@ +applyPatch('20200413-dldt-disable-unused-targets.patch') +applyPatch('20200413-dldt-fix-binaries-location.patch') +applyPatch('20200413-dldt-pdb.patch') +applyPatch('20200415-ngraph-disable-unused-options.patch') diff --git a/platforms/winpack_dldt/2020.2/sysroot.config.py b/platforms/winpack_dldt/2020.2/sysroot.config.py new file mode 100644 index 0000000000..f51ac812a8 --- /dev/null +++ b/platforms/winpack_dldt/2020.2/sysroot.config.py @@ -0,0 +1,56 @@ +sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin') +copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph') +#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll') + +build_config = 'Release' if not self.config.build_debug else 'Debug' +build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config + +def copy_bin(name): + global build_bin_dir, sysroot_bin_dir + copytree(build_bin_dir / name, sysroot_bin_dir / name) + +dll_suffix = 'd' if self.config.build_debug else '' +def copy_dll(name): + global copy_bin, dll_suffix + copy_bin(name + dll_suffix + '.dll') + copy_bin(name + dll_suffix + '.pdb') + +copy_bin('cldnn_global_custom_kernels') +copy_bin('cache.json') +copy_dll('clDNNPlugin') +copy_dll('HeteroPlugin') +copy_dll('inference_engine') +copy_dll('inference_engine_legacy') +copy_dll('inference_engine_nn_builder') +copy_dll('inference_engine_transformations') # runtime +copy_dll('inference_engine_lp_transformations') # runtime +copy_dll('MKLDNNPlugin') # runtime +copy_dll('myriadPlugin') # runtime +copy_dll('ngraph') +copy_bin('plugins.xml') +copytree(self.build_dir / 'bin' / 'intel64' / 'pcie-ma248x.elf', sysroot_bin_dir / 'pcie-ma248x.elf') +copytree(self.build_dir / 'bin' / 'intel64' / 'usb-ma2x8x.mvcmd', sysroot_bin_dir / 'usb-ma2x8x.mvcmd') +copytree(self.build_dir / 'bin' / 'intel64' / 'usb-ma2450.mvcmd', sysroot_bin_dir / 'usb-ma2450.mvcmd') + +copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb' / 'bin', sysroot_bin_dir) +copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb', self.sysrootdir / 'tbb') + +sysroot_ie_dir = prepare_dir(self.sysrootdir / 'deployment_tools' / 'inference_engine') +sysroot_ie_lib_dir = prepare_dir(sysroot_ie_dir / 'lib' / 'intel64') + +copytree(self.srcdir / 'inference-engine' / 'include', sysroot_ie_dir / 'include') +if not self.config.build_debug: + copytree(self.build_dir / 'install' / 'lib' / 'ngraph.lib', sysroot_ie_lib_dir / 'ngraph.lib') + copytree(build_bin_dir / 'inference_engine.lib', sysroot_ie_lib_dir / 'inference_engine.lib') + copytree(build_bin_dir / 'inference_engine_nn_builder.lib', sysroot_ie_lib_dir / 'inference_engine_nn_builder.lib') + copytree(build_bin_dir / 'inference_engine_legacy.lib', sysroot_ie_lib_dir / 'inference_engine_legacy.lib') +else: + copytree(self.build_dir / 'install' / 'lib' / 'ngraphd.lib', sysroot_ie_lib_dir / 'ngraphd.lib') + copytree(build_bin_dir / 'inference_engined.lib', sysroot_ie_lib_dir / 'inference_engined.lib') + copytree(build_bin_dir / 'inference_engine_nn_builderd.lib', sysroot_ie_lib_dir / 'inference_engine_nn_builderd.lib') + copytree(build_bin_dir / 'inference_engine_legacyd.lib', sysroot_ie_lib_dir / 'inference_engine_legacyd.lib') + +sysroot_license_dir = prepare_dir(self.sysrootdir / 'etc' / 'licenses') +copytree(self.srcdir / 'LICENSE', sysroot_license_dir / 'dldt-LICENSE') +copytree(self.srcdir / 'ngraph/LICENSE', sysroot_license_dir / 'ngraph-LICENSE') +copytree(self.sysrootdir / 'tbb/LICENSE', sysroot_license_dir / 'tbb-LICENSE') diff --git a/platforms/winpack_dldt/build_package.py b/platforms/winpack_dldt/build_package.py index 4e0f44d9bb..768ddc5ff8 100644 --- a/platforms/winpack_dldt/build_package.py +++ b/platforms/winpack_dldt/build_package.py @@ -249,12 +249,17 @@ class BuilderDLDT: cmake_vars = dict( CMAKE_BUILD_TYPE=build_config, + TREAT_WARNING_AS_ERROR='OFF', ENABLE_SAMPLES='OFF', ENABLE_TESTS='OFF', BUILD_TESTS='OFF', ENABLE_OPENCV='OFF', ENABLE_GNA='OFF', + NGRAPH_DOC_BUILD_ENABLE='OFF', NGRAPH_UNIT_TEST_ENABLE='OFF', + NGRAPH_UNIT_TEST_OPENVINO_ENABLE='OFF', + NGRAPH_TEST_UTIL_ENABLE='OFF', + NGRAPH_ONNX_IMPORT_ENABLE='OFF', CMAKE_INSTALL_PREFIX=str(self.build_dir / 'install'), ) @@ -263,17 +268,32 @@ class BuilderDLDT: cmd += self.config.cmake_option_dldt cmd.append(str(self.srcdir)) - execute(cmd, cwd=self.build_dir) - # build - cmd = [self.cmake_path, '--build', '.', '--config', build_config, # '--target', 'install', - '--', '/v:n', '/m:2', '/consoleloggerparameters:NoSummary' - ] - execute(cmd, cwd=self.build_dir) + build_dir = self.build_dir + if self.config.build_subst_drive: + if os.path.exists(self.config.build_subst_drive + ':\\'): + execute(['subst', self.config.build_subst_drive + ':', '/D']) + def fix_path(p): + return str(p).replace(str(self.outdir), self.config.build_subst_drive + ':') + execute(['subst', self.config.build_subst_drive + ':', str(self.outdir)]) + cmd = [fix_path(c) for c in cmd] + build_dir = Path(fix_path(build_dir)) + try: + execute(cmd, cwd=build_dir) - # install ngraph only - cmd = [self.cmake_path, '-DBUILD_TYPE=' + build_config, '-P', 'cmake_install.cmake'] - execute(cmd, cwd=self.build_dir / 'ngraph') + # build + cmd = [self.cmake_path, '--build', '.', '--config', build_config, # '--target', 'install', + '--', '/v:n', '/m:2', '/consoleloggerparameters:NoSummary' + ] + execute(cmd, cwd=build_dir) + + # install ngraph only + cmd = [self.cmake_path, '-DBUILD_TYPE=' + build_config, '-P', 'cmake_install.cmake'] + execute(cmd, cwd=build_dir / 'ngraph') + except: + if self.config.build_subst_drive: + execute(['subst', self.config.build_subst_drive + ':', '/D']) + raise log.info('DLDT build completed') @@ -413,10 +433,11 @@ class Builder: def main(): dldt_src_url = 'https://github.com/opencv/dldt.git' - dldt_src_commit = '2020.1' - dldt_release = '2020010000' + dldt_src_commit = '2020.2' + dldt_release = '2020020000' build_cache_dir_default = os.environ.get('BUILD_CACHE_DIR', '.build_cache') + build_subst_drive = os.environ.get('BUILD_SUBST_DRIVE', None) parser = argparse.ArgumentParser( description='Build OpenCV Windows package with Inference Engine (DLDT)', @@ -424,6 +445,7 @@ def main(): parser.add_argument('output_dir', nargs='?', default='.', help='Output directory') parser.add_argument('opencv_dir', nargs='?', default=os.path.join(SCRIPT_DIR, '../..'), help='Path to OpenCV source dir') parser.add_argument('--build_cache_dir', default=build_cache_dir_default, help='Build cache directory (sources and binaries cache of build dependencies, default = "%s")' % build_cache_dir_default) + parser.add_argument('--build_subst_drive', default=build_subst_drive, help='Drive letter to workaround Windows limit for 260 symbols in path (error MSB3491)') parser.add_argument('--cmake_option', action='append', help='Append OpenCV CMake option') parser.add_argument('--cmake_option_dldt', action='append', help='Append CMake option for DLDT project') From f64d8078635a44b5bb78c097598304c5db8ced50 Mon Sep 17 00:00:00 2001 From: Paul Jurczak Date: Wed, 15 Apr 2020 16:06:14 -0600 Subject: [PATCH 08/12] Added to description of WCube constructor `WCube` constructor reorders `min_point`, `max_point` parameters when necessary. I added this info to the description. --- modules/viz/include/opencv2/viz/widgets.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/viz/include/opencv2/viz/widgets.hpp b/modules/viz/include/opencv2/viz/widgets.hpp index 1b73110b58..72e3986dfc 100644 --- a/modules/viz/include/opencv2/viz/widgets.hpp +++ b/modules/viz/include/opencv2/viz/widgets.hpp @@ -374,8 +374,8 @@ namespace cv public: /** @brief Constructs a WCube. - @param min_point Specifies minimum point of the bounding box. - @param max_point Specifies maximum point of the bounding box. + @param min_point Specifies minimum (or maximum) point of the bounding box. + @param max_point Specifies maximum (or minimum) point of the bounding box, opposite to the first parameter. @param wire_frame If true, cube is represented as wireframe. @param color Color of the cube. From c2e484a4658aab155384df85c4ac7f689f85a427 Mon Sep 17 00:00:00 2001 From: Tomoaki Teshima Date: Thu, 16 Apr 2020 08:24:14 +0900 Subject: [PATCH 09/12] fix wrong condition check --- modules/objdetect/src/qrcode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/objdetect/src/qrcode.cpp b/modules/objdetect/src/qrcode.cpp index 12d89919f9..aa8a9d22b2 100644 --- a/modules/objdetect/src/qrcode.cpp +++ b/modules/objdetect/src/qrcode.cpp @@ -32,7 +32,7 @@ static bool checkQRInputImage(InputArray img, Mat& gray) return false; // image data is not enough for providing reliable results } int incn = img.channels(); - CV_Check(incn, incn == 1 || incn == 3 || incn == 3, ""); + CV_Check(incn, incn == 1 || incn == 3 || incn == 4, ""); if (incn == 3 || incn == 4) { cvtColor(img, gray, COLOR_BGR2GRAY); From 7aaa91836738fc83226ab17e4edf1eb6e05be76a Mon Sep 17 00:00:00 2001 From: Alanli Date: Thu, 16 Apr 2020 09:05:00 +0900 Subject: [PATCH 10/12] doc: formula miss --- .../py_ml/py_svm/py_svm_basics/py_svm_basics.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/py_tutorials/py_ml/py_svm/py_svm_basics/py_svm_basics.markdown b/doc/py_tutorials/py_ml/py_svm/py_svm_basics/py_svm_basics.markdown index 7f1f39592e..c8dbe39920 100644 --- a/doc/py_tutorials/py_ml/py_svm/py_svm_basics/py_svm_basics.markdown +++ b/doc/py_tutorials/py_ml/py_svm/py_svm_basics/py_svm_basics.markdown @@ -83,7 +83,7 @@ Let us define a kernel function \f$K(p,q)\f$ which does a dot product between tw \begin{aligned} K(p,q) = \phi(p).\phi(q) &= \phi(p)^T \phi(q) \\ &= (p_{1}^2,p_{2}^2,\sqrt{2} p_1 p_2).(q_{1}^2,q_{2}^2,\sqrt{2} q_1 q_2) \\ - &= p_1 q_1 + p_2 q_2 + 2 p_1 q_1 p_2 q_2 \\ + &= p_{1}^2 q_{1}^2 + p_{2}^2 q_{2}^2 + 2 p_1 q_1 p_2 q_2 \\ &= (p_1 q_1 + p_2 q_2)^2 \\ \phi(p).\phi(q) &= (p.q)^2 \end{aligned} From 5e5385a814b577d0fab8cc791865f8a5fe2ba3e5 Mon Sep 17 00:00:00 2001 From: Dmitry Kurtaev Date: Wed, 15 Apr 2020 18:12:56 +0300 Subject: [PATCH 11/12] Remove NodeVector for nGraph --- modules/dnn/src/ie_ngraph.cpp | 12 ++++++++++++ modules/dnn/src/layers/blank_layer.cpp | 2 +- modules/dnn/src/layers/concat_layer.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/dnn/src/ie_ngraph.cpp b/modules/dnn/src/ie_ngraph.cpp index f0975d05a0..e3f0966ab4 100644 --- a/modules/dnn/src/ie_ngraph.cpp +++ b/modules/dnn/src/ie_ngraph.cpp @@ -77,7 +77,11 @@ public: return type_info; } +#if INF_ENGINE_VER_MAJOR_GT(2020020000) + NgraphCustomOp(const ngraph::OutputVector& inputs, +#else NgraphCustomOp(const ngraph::NodeVector& inputs, +#endif const std::map& params = {}): Op(inputs), params(params) { @@ -103,7 +107,11 @@ public: std::shared_ptr copy_with_new_args(const ngraph::NodeVector& new_args) const override { +#if INF_ENGINE_VER_MAJOR_GT(2020020000) + return std::make_shared(ngraph::as_output_vector(new_args), params); +#else return std::make_shared(new_args, params); +#endif } bool visit_attributes(ngraph::AttributeVisitor& visitor) override @@ -270,7 +278,11 @@ InfEngineNgraphNode::InfEngineNgraphNode(const std::vector >& n {"internals", shapesToStr(internals)} }; +#if INF_ENGINE_VER_MAJOR_GT(2020020000) + ngraph::OutputVector inp_nodes; +#else ngraph::NodeVector inp_nodes; +#endif for (const auto& node : nodes) inp_nodes.emplace_back(node.dynamicCast()->node); node = std::make_shared(inp_nodes, params); diff --git a/modules/dnn/src/layers/blank_layer.cpp b/modules/dnn/src/layers/blank_layer.cpp index bda5f6171d..e7b385e969 100644 --- a/modules/dnn/src/layers/blank_layer.cpp +++ b/modules/dnn/src/layers/blank_layer.cpp @@ -139,7 +139,7 @@ public: const std::vector >& nodes) CV_OVERRIDE { auto& ieInpNode = nodes[0].dynamicCast()->node; - ngraph::NodeVector inp{ieInpNode}; + ngraph::OutputVector inp{ieInpNode}; auto blank = std::make_shared(inp, 0); return Ptr(new InfEngineNgraphNode(blank)); } diff --git a/modules/dnn/src/layers/concat_layer.cpp b/modules/dnn/src/layers/concat_layer.cpp index c3ca1a4afd..d85d9e4b01 100644 --- a/modules/dnn/src/layers/concat_layer.cpp +++ b/modules/dnn/src/layers/concat_layer.cpp @@ -323,7 +323,7 @@ public: std::vector maxDims(numDims, 0); CV_Assert(inputs.size() == nodes.size()); - ngraph::NodeVector inp_nodes; + ngraph::OutputVector inp_nodes; for (int i = 0; i < nodes.size(); ++i) { inp_nodes.push_back(nodes[i].dynamicCast()->node); From 96075ce0c96a1fcefb24b6923b05b306e9cd2207 Mon Sep 17 00:00:00 2001 From: Tomoaki Teshima Date: Fri, 17 Apr 2020 00:59:15 +0900 Subject: [PATCH 12/12] avoid test failure on Arm platform --- modules/objdetect/test/test_cascadeandhog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/objdetect/test/test_cascadeandhog.cpp b/modules/objdetect/test/test_cascadeandhog.cpp index 106f3341b2..83100dd796 100644 --- a/modules/objdetect/test/test_cascadeandhog.cpp +++ b/modules/objdetect/test/test_cascadeandhog.cpp @@ -1154,7 +1154,7 @@ void HOGDescriptorTester::compute(InputArray _img, vector& descriptors, actual_hog->compute(img, actual_descriptors, winStride, padding, locations); double diff_norm = cvtest::norm(actual_descriptors, descriptors, NORM_L2 + NORM_RELATIVE); - const double eps = FLT_EPSILON * 100; + const double eps = 2.0e-3; if (diff_norm > eps) { ts->printf(cvtest::TS::SUMMARY, "Norm of the difference: %lf\n", diff_norm); @@ -1299,7 +1299,7 @@ void HOGDescriptorTester::computeGradient(const Mat& img, Mat& grad, Mat& qangle const char* args[] = { "Gradient's", "Qangles's" }; actual_hog->computeGradient(img, actual_mats[0], actual_mats[1], paddingTL, paddingBR); - const double eps = FLT_EPSILON * 100; + const double eps = 8.0e-3; for (i = 0; i < 2; ++i) { double diff_norm = cvtest::norm(actual_mats[i], reference_mats[i], NORM_L2 + NORM_RELATIVE);