diff --git a/cmake/OpenCVDetectInferenceEngine.cmake b/cmake/OpenCVDetectInferenceEngine.cmake index a8bee58486..0611eccc5b 100644 --- a/cmake/OpenCVDetectInferenceEngine.cmake +++ b/cmake/OpenCVDetectInferenceEngine.cmake @@ -129,9 +129,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/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} diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt index 27ecd142fb..08704ef9dc 100644 --- a/modules/dnn/CMakeLists.txt +++ b/modules/dnn/CMakeLists.txt @@ -129,7 +129,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/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 d639f378ab..5acdc3fa1e 100644 --- a/modules/dnn/src/layers/blank_layer.cpp +++ b/modules/dnn/src/layers/blank_layer.cpp @@ -147,7 +147,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 0ed9e3f7ac..8a0f4a67c6 100644 --- a/modules/dnn/src/layers/concat_layer.cpp +++ b/modules/dnn/src/layers/concat_layer.cpp @@ -358,7 +358,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); diff --git a/modules/dnn/src/layers/pooling_layer.cpp b/modules/dnn/src/layers/pooling_layer.cpp index a932f04816..fc3bc4fc36 100644 --- a/modules/dnn/src/layers/pooling_layer.cpp +++ b/modules/dnn/src/layers/pooling_layer.cpp @@ -473,7 +473,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()) diff --git a/modules/dnn/src/op_inf_engine.hpp b/modules/dnn/src/op_inf_engine.hpp index 6a2f73692e..62b2c2f567 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)) @@ -58,7 +59,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 diff --git a/modules/objdetect/src/qrcode.cpp b/modules/objdetect/src/qrcode.cpp index 116766a619..5ba433aeb4 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); diff --git a/modules/objdetect/test/test_cascadeandhog.cpp b/modules/objdetect/test/test_cascadeandhog.cpp index 27a49620c4..e44ae88384 100644 --- a/modules/objdetect/test/test_cascadeandhog.cpp +++ b/modules/objdetect/test/test_cascadeandhog.cpp @@ -1140,7 +1140,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); @@ -1289,7 +1289,7 @@ void HOGDescriptorTester::computeGradient(InputArray _img, InputOutputArray _gra 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); diff --git a/modules/python/src2/hdr_parser.py b/modules/python/src2/hdr_parser.py index 130c19058e..462b53e826 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'): 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); + } + }