From f5e852cdf0aac451575fa1d9dd2f2ad23087e09e Mon Sep 17 00:00:00 2001 From: kallaballa Date: Wed, 9 Nov 2022 01:32:07 +0100 Subject: [PATCH 01/12] define the number of dstChannels for HLS and HSV conversion as well --- modules/imgproc/src/color.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/imgproc/src/color.hpp b/modules/imgproc/src/color.hpp index 3f3b634790..e3c25f08d9 100644 --- a/modules/imgproc/src/color.hpp +++ b/modules/imgproc/src/color.hpp @@ -104,6 +104,10 @@ inline int dstChannels(int code) return 4; case COLOR_BGRA2BGR: case COLOR_RGBA2BGR: case COLOR_RGB2BGR: + case COLOR_HSV2RGB: case COLOR_HSV2BGR: case COLOR_RGB2HSV: case COLOR_BGR2HSV: + case COLOR_HLS2RGB: case COLOR_HLS2BGR: case COLOR_RGB2HLS: case COLOR_BGR2HLS: + case COLOR_HSV2RGB_FULL: case COLOR_HSV2BGR_FULL: case COLOR_RGB2HSV_FULL: case COLOR_BGR2HSV_FULL: + case COLOR_HLS2RGB_FULL: case COLOR_HLS2BGR_FULL: case COLOR_RGB2HLS_FULL: case COLOR_BGR2HLS_FULL: case COLOR_YUV2RGB: case COLOR_YUV2BGR: case COLOR_RGB2YUV: case COLOR_BGR2YUV: case COLOR_BGR5652BGR: case COLOR_BGR5552BGR: case COLOR_BGR5652RGB: case COLOR_BGR5552RGB: case COLOR_GRAY2BGR: From f0df78b7e743a8d735a4bc669ae64a155f08645d Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 18 Nov 2022 18:09:26 +0000 Subject: [PATCH 02/12] imgcodecs: ensure parameters are key-value pairs, fix HDR encoder --- .../imgcodecs/include/opencv2/imgcodecs.hpp | 7 +++ modules/imgcodecs/src/grfmt_hdr.cpp | 18 ++++++- modules/imgcodecs/src/grfmt_hdr.hpp | 6 --- modules/imgcodecs/src/loadsave.cpp | 48 +++++++++++++++++-- modules/imgcodecs/test/test_grfmt.cpp | 40 ++++++++++++---- modules/imgcodecs/test/test_read_write.cpp | 19 ++++++++ 6 files changed, 119 insertions(+), 19 deletions(-) diff --git a/modules/imgcodecs/include/opencv2/imgcodecs.hpp b/modules/imgcodecs/include/opencv2/imgcodecs.hpp index 49f76826b9..c4b570e68c 100644 --- a/modules/imgcodecs/include/opencv2/imgcodecs.hpp +++ b/modules/imgcodecs/include/opencv2/imgcodecs.hpp @@ -96,6 +96,7 @@ enum ImwriteFlags { IMWRITE_PXM_BINARY = 32, //!< For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1. IMWRITE_EXR_TYPE = (3 << 4) + 0, /* 48 */ //!< override EXR storage type (FLOAT (FP32) is default) IMWRITE_WEBP_QUALITY = 64, //!< For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used. + IMWRITE_HDR_COMPRESSION = (5 << 4) + 0, /* 80 */ //!< specify HDR compression IMWRITE_PAM_TUPLETYPE = 128,//!< For PAM, sets the TUPLETYPE field to the corresponding string value that is defined for the format IMWRITE_TIFF_RESUNIT = 256,//!< For TIFF, use to specify which DPI resolution unit to set; see libtiff documentation for valid values. IMWRITE_TIFF_XDPI = 257,//!< For TIFF, use to specify the X direction DPI. @@ -145,6 +146,12 @@ enum ImwritePAMFlags { IMWRITE_PAM_FORMAT_RGB_ALPHA = 5 }; +//! Imwrite HDR specific values for IMWRITE_HDR_COMPRESSION parameter key +enum ImwriteHDRCompressionFlags { + IMWRITE_HDR_COMPRESSION_NONE = 0, + IMWRITE_HDR_COMPRESSION_RLE = 1 +}; + //! @} imgcodecs_flags /** @brief Loads an image from a file. diff --git a/modules/imgcodecs/src/grfmt_hdr.cpp b/modules/imgcodecs/src/grfmt_hdr.cpp index a274b2233c..6e2f565e32 100644 --- a/modules/imgcodecs/src/grfmt_hdr.cpp +++ b/modules/imgcodecs/src/grfmt_hdr.cpp @@ -141,14 +141,28 @@ bool HdrEncoder::write( const Mat& input_img, const std::vector& params ) if(img.depth() != CV_32F) { img.convertTo(img, CV_32FC3, 1/255.0f); } - CV_Assert(params.empty() || params[0] == HDR_NONE || params[0] == HDR_RLE); + + int compression = IMWRITE_HDR_COMPRESSION_RLE; + for (size_t i = 0; i + 1 < params.size(); i += 2) + { + switch (params[i]) + { + case IMWRITE_HDR_COMPRESSION: + compression = params[i + 1]; + break; + default: + break; + } + } + CV_Check(compression, compression == IMWRITE_HDR_COMPRESSION_NONE || compression == IMWRITE_HDR_COMPRESSION_RLE, ""); + FILE *fout = fopen(m_filename.c_str(), "wb"); if(!fout) { return false; } RGBE_WriteHeader(fout, img.cols, img.rows, NULL); - if(params.empty() || params[0] == HDR_RLE) { + if (compression == IMWRITE_HDR_COMPRESSION_RLE) { RGBE_WritePixels_RLE(fout, const_cast(img.ptr()), img.cols, img.rows); } else { RGBE_WritePixels(fout, const_cast(img.ptr()), img.cols * img.rows); diff --git a/modules/imgcodecs/src/grfmt_hdr.hpp b/modules/imgcodecs/src/grfmt_hdr.hpp index fa29fbe0d2..f0a920083f 100644 --- a/modules/imgcodecs/src/grfmt_hdr.hpp +++ b/modules/imgcodecs/src/grfmt_hdr.hpp @@ -50,12 +50,6 @@ namespace cv { -enum HdrCompression -{ - HDR_NONE = 0, - HDR_RLE = 1 -}; - // Radiance rgbe (.hdr) reader class HdrDecoder CV_FINAL : public BaseImageDecoder { diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp index bd87c379ab..1bdc7029c0 100644 --- a/modules/imgcodecs/src/loadsave.cpp +++ b/modules/imgcodecs/src/loadsave.cpp @@ -662,7 +662,7 @@ bool imreadmulti(const String& filename, std::vector& mats, int flags) } static bool imwrite_( const String& filename, const std::vector& img_vec, - const std::vector& params, bool flipv ) + const std::vector& params_, bool flipv ) { bool isMultiImg = img_vec.size() > 1; std::vector write_vec; @@ -696,7 +696,27 @@ static bool imwrite_( const String& filename, const std::vector& img_vec, } encoder->setDestination( filename ); - CV_Assert(params.size() <= CV_IO_MAX_IMAGE_PARAMS*2); +#if CV_VERSION_MAJOR < 5 && defined(HAVE_IMGCODEC_HDR) + bool fixed = false; + std::vector params_pair(2); + if (dynamic_cast(encoder.get())) + { + if (params_.size() == 1) + { + CV_LOG_WARNING(NULL, "imwrite() accepts key-value pair of parameters, but single value is passed. " + "HDR encoder behavior has been changed, please use IMWRITE_HDR_COMPRESSION key."); + params_pair[0] = IMWRITE_HDR_COMPRESSION; + params_pair[1] = params_[0]; + fixed = true; + } + } + const std::vector& params = fixed ? params_pair : params_; +#else + const std::vector& params = params_; +#endif + + CV_Check(params.size(), (params.size() & 1) == 0, "Encoding 'params' must be key-value pairs"); + CV_CheckLE(params.size(), (size_t)(CV_IO_MAX_IMAGE_PARAMS*2), ""); bool code = false; try { @@ -936,7 +956,7 @@ Mat imdecode( InputArray _buf, int flags, Mat* dst ) } bool imencode( const String& ext, InputArray _image, - std::vector& buf, const std::vector& params ) + std::vector& buf, const std::vector& params_ ) { CV_TRACE_FUNCTION(); @@ -958,6 +978,28 @@ bool imencode( const String& ext, InputArray _image, image = temp; } +#if CV_VERSION_MAJOR < 5 && defined(HAVE_IMGCODEC_HDR) + bool fixed = false; + std::vector params_pair(2); + if (dynamic_cast(encoder.get())) + { + if (params_.size() == 1) + { + CV_LOG_WARNING(NULL, "imwrite() accepts key-value pair of parameters, but single value is passed. " + "HDR encoder behavior has been changed, please use IMWRITE_HDR_COMPRESSION key."); + params_pair[0] = IMWRITE_HDR_COMPRESSION; + params_pair[1] = params_[0]; + fixed = true; + } + } + const std::vector& params = fixed ? params_pair : params_; +#else + const std::vector& params = params_; +#endif + + CV_Check(params.size(), (params.size() & 1) == 0, "Encoding 'params' must be key-value pairs"); + CV_CheckLE(params.size(), (size_t)(CV_IO_MAX_IMAGE_PARAMS*2), ""); + bool code; if( encoder->setDestination(buf) ) { diff --git a/modules/imgcodecs/test/test_grfmt.cpp b/modules/imgcodecs/test/test_grfmt.cpp index cbf6289d23..81550bffba 100644 --- a/modules/imgcodecs/test/test_grfmt.cpp +++ b/modules/imgcodecs/test/test_grfmt.cpp @@ -301,21 +301,45 @@ TEST(Imgcodecs_Hdr, regression) Mat img_no_rle = imread(name_no_rle, -1); ASSERT_FALSE(img_no_rle.empty()) << "Could not open " << name_no_rle; - double min = 0.0, max = 1.0; - minMaxLoc(abs(img_rle - img_no_rle), &min, &max); - ASSERT_FALSE(max > DBL_EPSILON); + EXPECT_EQ(cvtest::norm(img_rle, img_no_rle, NORM_INF), 0.0); + string tmp_file_name = tempfile(".hdr"); - vectorparam(1); + vector param(2); + param[0] = IMWRITE_HDR_COMPRESSION; for(int i = 0; i < 2; i++) { - param[0] = i; + param[1] = i; imwrite(tmp_file_name, img_rle, param); Mat written_img = imread(tmp_file_name, -1); - ASSERT_FALSE(written_img.empty()) << "Could not open " << tmp_file_name; - minMaxLoc(abs(img_rle - written_img), &min, &max); - ASSERT_FALSE(max > DBL_EPSILON); + EXPECT_EQ(cvtest::norm(written_img, img_rle, NORM_INF), 0.0); } remove(tmp_file_name.c_str()); } + +TEST(Imgcodecs_Hdr, regression_imencode) +{ + string folder = string(cvtest::TS::ptr()->get_data_path()) + "/readwrite/"; + string name = folder + "rle.hdr"; + Mat img_ref = imread(name, -1); + ASSERT_FALSE(img_ref.empty()) << "Could not open " << name; + + vector params(2); + params[0] = IMWRITE_HDR_COMPRESSION; + { + vector buf; + params[1] = IMWRITE_HDR_COMPRESSION_NONE; + imencode(".hdr", img_ref, buf, params); + Mat img = imdecode(buf, -1); + EXPECT_EQ(cvtest::norm(img_ref, img, NORM_INF), 0.0); + } + { + vector buf; + params[1] = IMWRITE_HDR_COMPRESSION_RLE; + imencode(".hdr", img_ref, buf, params); + Mat img = imdecode(buf, -1); + EXPECT_EQ(cvtest::norm(img_ref, img, NORM_INF), 0.0); + } +} + #endif #ifdef HAVE_IMGCODEC_PXM diff --git a/modules/imgcodecs/test/test_read_write.cpp b/modules/imgcodecs/test/test_read_write.cpp index 985d5c110a..30692452b2 100644 --- a/modules/imgcodecs/test/test_read_write.cpp +++ b/modules/imgcodecs/test/test_read_write.cpp @@ -288,4 +288,23 @@ TEST(Imgcodecs_Image, write_umat) EXPECT_EQ(0, remove(dst_name.c_str())); } +TEST(Imgcodecs_Params, imwrite_regression_22752) +{ + const Mat img(16, 16, CV_8UC3, cv::Scalar::all(0)); + vector params; + params.push_back(IMWRITE_JPEG_QUALITY); +// params.push_back(100)); // Forget it. + EXPECT_ANY_THROW(cv::imwrite("test.jpg", img, params)); // parameters size or missing JPEG codec +} + +TEST(Imgcodecs_Params, imencode_regression_22752) +{ + const Mat img(16, 16, CV_8UC3, cv::Scalar::all(0)); + vector params; + params.push_back(IMWRITE_JPEG_QUALITY); +// params.push_back(100)); // Forget it. + vector buf; + EXPECT_ANY_THROW(cv::imencode("test.jpg", img, buf, params)); // parameters size or missing JPEG codec +} + }} // namespace From e9d64e0a8cea0b92378bde064b6d018c5eaa8a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Ma=C5=A1ek?= Date: Tue, 15 Nov 2022 01:18:46 +0100 Subject: [PATCH 03/12] Fix #22767: Ensure that the buttons are spaced to the size of the toolbar window, which is always visible. (rebased to 3.x) --- modules/highgui/src/window_w32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index 13ad679b4b..7c5668cb31 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -2253,7 +2253,7 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name, tbis.cbSize = sizeof(tbis); tbis.dwMask = TBIF_SIZE; - GetClientRect(window->hwnd, &rect); + GetClientRect(window->toolbar.toolbar, &rect); tbis.cx = (unsigned short)(rect.right - rect.left); SendMessage(window->toolbar.toolbar, TB_SETBUTTONINFO, @@ -2271,7 +2271,7 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name, trackbar->parent = window; trackbar->pos = 0; trackbar->data = 0; - trackbar->id = bcount; + trackbar->id = tbs.idCommand; trackbar->next = window->toolbar.first; trackbar->name = (char*)(trackbar + 1); memcpy( trackbar->name, trackbar_name, len + 1 ); From e5bea2bde4b8485a9051fb68aedaf08d9f7cf569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Ma=C5=A1ek?= Date: Tue, 15 Nov 2022 01:04:03 +0100 Subject: [PATCH 04/12] Fix #22766: Corrected off-by one error causing inconsistent row spacing. (rebased to 3.4) --- modules/highgui/src/window_w32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index 13ad679b4b..8dbff9875c 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -2212,7 +2212,7 @@ icvCreateTrackbar( const char* trackbar_name, const char* window_name, /* Retrieve current buttons count */ bcount = (int)SendMessage(window->toolbar.toolbar, TB_BUTTONCOUNT, 0, 0); - if(bcount > 1) + if (bcount > 0) { /* If this is not the first button then we need to separate it from the previous one */ From c63a6c472ddb232acbddf6e2d2d677490b057039 Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Mon, 21 Nov 2022 10:44:12 +0800 Subject: [PATCH 05/12] fix typo: Gausssian to Gaussian --- .../js_imgproc/js_gradients/js_gradients.markdown | 4 ++-- .../py_imgproc/py_gradients/py_gradients.markdown | 2 +- modules/video/src/bgfg_gaussmix2.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/js_tutorials/js_imgproc/js_gradients/js_gradients.markdown b/doc/js_tutorials/js_imgproc/js_gradients/js_gradients.markdown index 21e36a0bd9..e97f93a78f 100644 --- a/doc/js_tutorials/js_imgproc/js_gradients/js_gradients.markdown +++ b/doc/js_tutorials/js_imgproc/js_gradients/js_gradients.markdown @@ -15,7 +15,7 @@ We will see each one of them. ### 1. Sobel and Scharr Derivatives -Sobel operators is a joint Gausssian smoothing plus differentiation operation, so it is more +Sobel operators is a joint Gaussian smoothing plus differentiation operation, so it is more resistant to noise. You can specify the direction of derivatives to be taken, vertical or horizontal (by the arguments, yorder and xorder respectively). You can also specify the size of kernel by the argument ksize. If ksize = -1, a 3x3 Scharr filter is used which gives better results than 3x3 Sobel @@ -97,4 +97,4 @@ Try it -\endhtmlonly \ No newline at end of file +\endhtmlonly diff --git a/doc/py_tutorials/py_imgproc/py_gradients/py_gradients.markdown b/doc/py_tutorials/py_imgproc/py_gradients/py_gradients.markdown index 9b07d14f50..0a52cd431c 100644 --- a/doc/py_tutorials/py_imgproc/py_gradients/py_gradients.markdown +++ b/doc/py_tutorials/py_imgproc/py_gradients/py_gradients.markdown @@ -17,7 +17,7 @@ We will see each one of them. ### 1. Sobel and Scharr Derivatives -Sobel operators is a joint Gausssian smoothing plus differentiation operation, so it is more +Sobel operators is a joint Gaussian smoothing plus differentiation operation, so it is more resistant to noise. You can specify the direction of derivatives to be taken, vertical or horizontal (by the arguments, yorder and xorder respectively). You can also specify the size of kernel by the argument ksize. If ksize = -1, a 3x3 Scharr filter is used which gives better results than 3x3 Sobel diff --git a/modules/video/src/bgfg_gaussmix2.cpp b/modules/video/src/bgfg_gaussmix2.cpp index 69e4baf657..8e12634bd9 100644 --- a/modules/video/src/bgfg_gaussmix2.cpp +++ b/modules/video/src/bgfg_gaussmix2.cpp @@ -47,7 +47,7 @@ //International Conference Pattern Recognition, UK, August, 2004 //http://www.zoranz.net/Publications/zivkovic2004ICPR.pdf //The code is very fast and performs also shadow detection. -//Number of Gausssian components is adapted per pixel. +//Number of Gaussian components is adapted per pixel. // // and // @@ -97,7 +97,7 @@ namespace cv http://www.zoranz.net/Publications/zivkovic2004ICPR.pdf Advantages: - -fast - number of Gausssian components is constantly adapted per pixel. + -fast - number of Gaussian components is constantly adapted per pixel. -performs also shadow detection (see bgfg_segm_test.cpp example) */ From 90b144cf0a4a7c9945b83d3724dc0cf84a2e5328 Mon Sep 17 00:00:00 2001 From: fwcd Date: Tue, 1 Nov 2022 18:24:10 +0100 Subject: [PATCH 06/12] Cocoa/highgui: Set activateIgnoringOtherApps --- modules/highgui/src/window_cocoa.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/highgui/src/window_cocoa.mm b/modules/highgui/src/window_cocoa.mm index 36db7e836b..1cf55f9397 100644 --- a/modules/highgui/src/window_cocoa.mm +++ b/modules/highgui/src/window_cocoa.mm @@ -579,6 +579,8 @@ CV_IMPL int cvNamedWindow( const char* name, int flags ) [window setContentView:[[CVView alloc] init]]; + [NSApp activateIgnoringOtherApps:YES]; + [window setHasShadow:YES]; [window setAcceptsMouseMovedEvents:YES]; [window useOptimizedDrawing:YES]; From aba2167d9cc7dd7ff21cbca48a7713e55500da1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Ma=C5=A1ek?= Date: Tue, 22 Nov 2022 11:47:27 +0100 Subject: [PATCH 07/12] Merge pull request #22838 from dan-masek:fix_issue_22837 Fix issue 22837: No more blank buttons on toolbar after resizing the window --- modules/highgui/src/window_w32.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index 7764a9913c..eb17d5fc01 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -1939,26 +1939,19 @@ static LRESULT CALLBACK HGToolbarProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPAR case WM_NCCALCSIZE: { LRESULT ret = CallWindowProc(window->toolbar.toolBarProc, hwnd, uMsg, wParam, lParam); - int rows = (int)SendMessage(hwnd, TB_GETROWS, 0, 0); + CvTrackbar* trackbar = window->toolbar.first; - if(window->toolbar.rows != rows) - { - SendMessage(window->toolbar.toolbar, TB_BUTTONCOUNT, 0, 0); - CvTrackbar* trackbar = window->toolbar.first; - - for( ; trackbar != 0; trackbar = trackbar->next ) - { - RECT rect = { 0 }; - SendMessage(window->toolbar.toolbar, TB_GETITEMRECT, - (WPARAM)trackbar->id, (LPARAM)&rect); - MoveWindow(trackbar->hwnd, rect.left + HG_BUDDY_WIDTH, rect.top, - rect.right - rect.left - HG_BUDDY_WIDTH, - rect.bottom - rect.top, FALSE); - MoveWindow(trackbar->buddy, rect.left, rect.top, - HG_BUDDY_WIDTH, rect.bottom - rect.top, FALSE); - } - window->toolbar.rows = rows; + for (; trackbar != 0; trackbar = trackbar->next) { + RECT rect = { 0 }; + SendMessage(window->toolbar.toolbar, TB_GETITEMRECT, + (WPARAM)trackbar->id, (LPARAM)&rect); + MoveWindow(trackbar->hwnd, rect.left + HG_BUDDY_WIDTH, rect.top, + rect.right - rect.left - HG_BUDDY_WIDTH, + rect.bottom - rect.top, FALSE); + MoveWindow(trackbar->buddy, rect.left, rect.top, + HG_BUDDY_WIDTH, rect.bottom - rect.top, FALSE); } + window->toolbar.rows = static_cast(SendMessage(hwnd, TB_GETROWS, 0, 0)); return ret; } } From 71a1150c95d455c1f640c088f0ccea22de8c86dd Mon Sep 17 00:00:00 2001 From: ClayXrex <87029308+ClayXrex@users.noreply.github.com> Date: Sat, 12 Nov 2022 12:31:57 +0100 Subject: [PATCH 08/12] fix: typo --- .../py_core/py_optimization/py_optimization.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/py_tutorials/py_core/py_optimization/py_optimization.markdown b/doc/py_tutorials/py_core/py_optimization/py_optimization.markdown index 61f403bf54..d24613a643 100644 --- a/doc/py_tutorials/py_core/py_optimization/py_optimization.markdown +++ b/doc/py_tutorials/py_core/py_optimization/py_optimization.markdown @@ -14,7 +14,7 @@ So in this chapter, you will learn: Apart from OpenCV, Python also provides a module **time** which is helpful in measuring the time of execution. Another module **profile** helps to get a detailed report on the code, like how much time each function in the code took, how many times the function was called, etc. But, if you are using -IPython, all these features are integrated in an user-friendly manner. We will see some important +IPython, all these features are integrated in a user-friendly manner. We will see some important ones, and for more details, check links in the **Additional Resources** section. Measuring Performance with OpenCV From 8832a9dbd5ffac0eac29d90d015973bd8a55d09a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 2 Dec 2022 22:48:40 +0000 Subject: [PATCH 09/12] cmake: ocv_check_modules: ignore -latomic and -lstdc++ --- cmake/OpenCVUtils.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake index 938c4e1f82..cf628d9951 100644 --- a/cmake/OpenCVUtils.cmake +++ b/cmake/OpenCVUtils.cmake @@ -866,7 +866,10 @@ macro(ocv_check_modules define) foreach(flag ${${define}_LDFLAGS}) if(flag MATCHES "^-L(.*)") list(APPEND _libs_paths ${CMAKE_MATCH_1}) - elseif(IS_ABSOLUTE "${flag}") + elseif(IS_ABSOLUTE "${flag}" + OR flag STREQUAL "-lstdc++" + OR flag STREQUAL "-latomic" + ) list(APPEND _libs "${flag}") elseif(flag MATCHES "^-l(.*)") set(_lib "${CMAKE_MATCH_1}") From 74d0b4cc780a1c82b1c512b3a303357cb329d73a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 30 Nov 2022 01:26:09 +0000 Subject: [PATCH 10/12] dnn(openvino): fix custom layers BlockingDesc --- modules/dnn/src/ie_ngraph.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/dnn/src/ie_ngraph.cpp b/modules/dnn/src/ie_ngraph.cpp index 235fa7dcbb..aee3e294e5 100644 --- a/modules/dnn/src/ie_ngraph.cpp +++ b/modules/dnn/src/ie_ngraph.cpp @@ -204,14 +204,13 @@ public: std::vector outDataConfig; #if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2020_2) InferenceEngine::SizeVector order; - size_t offset = std::numeric_limits::max(); for (int i = 0; i < node->get_input_size(); ++i) { InferenceEngine::DataConfig conf; auto shape = node->input_value(i).get_shape(); order.resize(shape.size()); std::iota(order.begin(), order.end(), 0); - conf.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32, shape, {shape, order, offset}); + conf.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32, shape, {shape, order}); inDataConfig.push_back(conf); } @@ -221,7 +220,7 @@ public: auto shape = node->output(i).get_shape(); order.resize(shape.size()); std::iota(order.begin(), order.end(), 0); - conf.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32, shape, {shape, order, offset}); + conf.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32, shape, {shape, order}); outDataConfig.push_back(conf); } #else From d16b3b2487471e8e92fd7566bf174551808dc98d Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 2 Dec 2022 23:55:16 +0000 Subject: [PATCH 11/12] dnn(test): restore openvino tests with 'Cannot get memory' message --- modules/dnn/test/test_backends.cpp | 6 -- modules/dnn/test/test_caffe_importer.cpp | 10 --- modules/dnn/test/test_darknet_importer.cpp | 10 --- modules/dnn/test/test_halide_layers.cpp | 6 -- modules/dnn/test/test_layers.cpp | 17 +---- modules/dnn/test/test_onnx_importer.cpp | 74 ++-------------------- modules/dnn/test/test_tf_importer.cpp | 51 +-------------- modules/dnn/test/test_torch_importer.cpp | 13 ---- 8 files changed, 6 insertions(+), 181 deletions(-) diff --git a/modules/dnn/test/test_backends.cpp b/modules/dnn/test/test_backends.cpp index 1a8b747a65..805e5f4e2d 100644 --- a/modules/dnn/test/test_backends.cpp +++ b/modules/dnn/test/test_backends.cpp @@ -207,12 +207,6 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_Caffe_Different_Width_Height) if (backend == DNN_BACKEND_HALIDE) applyTestTag(CV_TEST_TAG_DNN_SKIP_HALIDE); #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // May hang on some configurations if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, diff --git a/modules/dnn/test/test_caffe_importer.cpp b/modules/dnn/test/test_caffe_importer.cpp index f56512e932..c66f46d8b0 100644 --- a/modules/dnn/test/test_caffe_importer.cpp +++ b/modules/dnn/test/test_caffe_importer.cpp @@ -699,10 +699,6 @@ TEST_P(Test_Caffe_nets, FasterRCNN_vgg16) #endif #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Check 'backward_compatible_check || in_out_elements_equal' failed at core/src/op/reshape.cpp:427: // While validating node 'v1::Reshape bbox_pred_reshape (bbox_pred[0]:f32{1,84}, Constant_265242[0]:i64{4}) -> (f32{?,?,?,?})' with friendly_name 'bbox_pred_reshape': // Requested output shape {1,6300,4,1} is incompatible with input shape {1, 84} @@ -734,12 +730,6 @@ TEST_P(Test_Caffe_nets, FasterRCNN_zf) ); #endif -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#endif - if ((backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 || backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && target == DNN_TARGET_OPENCL_FP16) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16); diff --git a/modules/dnn/test/test_darknet_importer.cpp b/modules/dnn/test/test_darknet_importer.cpp index c9f8c6271f..98caeef4bc 100644 --- a/modules/dnn/test/test_darknet_importer.cpp +++ b/modules/dnn/test/test_darknet_importer.cpp @@ -916,20 +916,10 @@ TEST_P(Test_Darknet_layers, shortcut_leaky) } TEST_P(Test_Darknet_layers, shortcut_unequal) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#endif testDarknetLayer("shortcut_unequal"); } TEST_P(Test_Darknet_layers, shortcut_unequal_2) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#endif testDarknetLayer("shortcut_unequal_2"); } diff --git a/modules/dnn/test/test_halide_layers.cpp b/modules/dnn/test/test_halide_layers.cpp index c744d0feaa..4db5199232 100644 --- a/modules/dnn/test/test_halide_layers.cpp +++ b/modules/dnn/test/test_halide_layers.cpp @@ -637,12 +637,6 @@ TEST_P(NoParamActivation, Accuracy) Target targetId = get<1>(get<1>(GetParam())); std::string layer_type = get<0>(GetParam()); -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && targetId == DNN_TARGET_CPU && layer_type == "BNLL") - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#endif - LayerParams lp; lp.type = layer_type; lp.name = "testLayer"; diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp index b04a30fe64..29e8172793 100644 --- a/modules/dnn/test/test_layers.cpp +++ b/modules/dnn/test/test_layers.cpp @@ -1431,12 +1431,6 @@ static void test_dldt_fused_output(Backend backend, Target target) TEST_P(Test_DLDT_layers, fused_output) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#endif - CV_DNN_REGISTER_LAYER_CLASS(Unsupported, UnsupportedLayer); try { @@ -1596,16 +1590,7 @@ TEST_P(Test_Caffe_layers, Interp) TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (available in OpenCV source tree only) #endif { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) - applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, - CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION - ); -#elif defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception #endif diff --git a/modules/dnn/test/test_onnx_importer.cpp b/modules/dnn/test/test_onnx_importer.cpp index 3d1dd3858a..607302cf0f 100644 --- a/modules/dnn/test/test_onnx_importer.cpp +++ b/modules/dnn/test/test_onnx_importer.cpp @@ -103,12 +103,6 @@ TEST_P(Test_ONNX_layers, MaxPooling) } TEST_P(Test_ONNX_layers, MaxPooling_2) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#endif - testONNXModels("two_maxpooling", npy, 0, 0, false, false); } @@ -793,17 +787,6 @@ TEST_P(Test_ONNX_layers, Slice_Steps_2DInput) TEST_P(Test_ONNX_layers, Slice_Steps_3DInput) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) - applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, - CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION - ); -#endif - testONNXModels("slice_opset_11_steps_3d"); } @@ -814,20 +797,6 @@ TEST_P(Test_ONNX_layers, Slice_Steps_4DInput) TEST_P(Test_ONNX_layers, Slice_Steps_5DInput) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // IE exception: Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) - applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, - CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION - ); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#endif - testONNXModels("slice_opset_11_steps_5d"); } @@ -850,9 +819,6 @@ TEST_P(Test_ONNX_layers, Split_EltwiseMax) TEST_P(Test_ONNX_layers, LSTM_Activations) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // IE exception: Node Block1326/lstm/reshape_0/permute was not assigned on any pointed device if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, @@ -889,9 +855,6 @@ TEST_P(Test_ONNX_layers, LSTM_hidden) TEST_P(Test_ONNX_layers, LSTM_hidden_bidirectional) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // IE exception: Node Transpose_45 was not assigned on any pointed device. if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, @@ -919,11 +882,7 @@ TEST_P(Test_ONNX_layers, LSTM_cell_forward) } TEST_P(Test_ONNX_layers, LSTM_cell_bidirectional) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#elif defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000) +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000) // Ngraph operation Reshape with name LSTM_16/lstm_y/reshape has dynamic output shape on 0 port, but CPU plug-in supports only static shape if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -1285,16 +1244,7 @@ TEST_P(Test_ONNX_layers, MaxPoolSigmoid1d) TEST_P(Test_ONNX_layers, MaxPool1d_Twise) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) - applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, - CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION - ); -#elif defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2021040000) +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2021040000) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) { if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER); @@ -1309,11 +1259,7 @@ TEST_P(Test_ONNX_layers, MaxPool1d_Twise) TEST_P(Test_ONNX_layers, AvePool1d) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#elif defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2021040000) +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2021040000) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) { if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER); @@ -1328,19 +1274,7 @@ TEST_P(Test_ONNX_layers, AvePool1d) TEST_P(Test_ONNX_layers, PoolConv1d) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) - applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, - CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION - ); -#elif defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2021040000) +#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_LT(2021040000) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) { if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER); diff --git a/modules/dnn/test/test_tf_importer.cpp b/modules/dnn/test/test_tf_importer.cpp index d21a5589f9..2d94ba8df2 100644 --- a/modules/dnn/test/test_tf_importer.cpp +++ b/modules/dnn/test/test_tf_importer.cpp @@ -207,9 +207,6 @@ TEST_P(Test_TensorFlow_layers, conv_keras_atrous_conv2d_same) TEST_P(Test_TensorFlow_layers, conv_pool_nchw) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // [ GENERAL_ERROR ] AssertionFailed: !expired() if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -476,9 +473,6 @@ TEST_P(Test_TensorFlow_layers, slim_batch_norm) TEST_P(Test_TensorFlow_layers, pooling_max_pool_even) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // [ GENERAL_ERROR ] AssertionFailed: !expired() if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -491,9 +485,6 @@ TEST_P(Test_TensorFlow_layers, pooling_max_pool_even) TEST_P(Test_TensorFlow_layers, pooling_max_pool_odd_valid) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // [ GENERAL_ERROR ] AssertionFailed: !expired() if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -506,9 +497,6 @@ TEST_P(Test_TensorFlow_layers, pooling_max_pool_odd_valid) TEST_P(Test_TensorFlow_layers, pooling_max_pool_odd_same) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // [ GENERAL_ERROR ] AssertionFailed: !expired() if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -789,14 +777,6 @@ TEST_P(Test_TensorFlow_layers, BiasAdd) TEST_P(Test_TensorFlow_layers, l2_normalize_3d) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) - applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, - CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION - ); // accuracy if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -999,9 +979,6 @@ TEST_P(Test_TensorFlow_nets, Faster_RCNN_resnet50_coco_2018_01_28) ); #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // [ GENERAL_ERROR ] AssertionFailed: subgraphTopoSortsStep < subgraphs.size() if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -1210,9 +1187,6 @@ TEST_P(Test_TensorFlow_layers, fp16_weights_fp16_single_conv) TEST_P(Test_TensorFlow_layers, fp16_weights_fp16_max_pool_odd_same) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // [ GENERAL_ERROR ] AssertionFailed: !expired() if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -1241,9 +1215,6 @@ TEST_P(Test_TensorFlow_layers, fp16_weights_fp16_padding_valid) TEST_P(Test_TensorFlow_layers, fp16_weights_fp16_max_pool_even) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // [ GENERAL_ERROR ] AssertionFailed: !expired() if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -1268,9 +1239,6 @@ TEST_P(Test_TensorFlow_layers, fp16_weights_fp16_deconvolution) TEST_P(Test_TensorFlow_layers, fp16_weights_fp16_max_pool_odd_valid) { #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); // [ GENERAL_ERROR ] AssertionFailed: !expired() if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); @@ -1355,16 +1323,6 @@ TEST_P(Test_TensorFlow_layers, split_equals) TEST_P(Test_TensorFlow_layers, resize_nearest_neighbor) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) - applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, - CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION - ); -#endif runTensorFlowNet("resize_nearest_neighbor"); } TEST_P(Test_TensorFlow_layers, resize_nearest_neighbor_keras_upsampling2d) @@ -1434,14 +1392,7 @@ TEST_P(Test_TensorFlow_layers, relu6) TEST_P(Test_TensorFlow_layers, subpixel) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); -#elif defined(INF_ENGINE_RELEASE) +#if defined(INF_ENGINE_RELEASE) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER); if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) diff --git a/modules/dnn/test/test_torch_importer.cpp b/modules/dnn/test/test_torch_importer.cpp index 9205a3fbfa..d94ff4368a 100644 --- a/modules/dnn/test/test_torch_importer.cpp +++ b/modules/dnn/test/test_torch_importer.cpp @@ -255,19 +255,6 @@ TEST_P(Test_Torch_layers, net_inception_block) TEST_P(Test_Torch_layers, net_normalize) { -#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000) - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_CPU) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_CPU, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) - applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION); - // Cannot get memory! - if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16)) - applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, - CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION - ); -#endif runTorchNet("net_normalize", "", false, true); } From 4792837f2e357851e76315ebfbdbac31e4431ab8 Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Sat, 3 Dec 2022 05:29:04 +0000 Subject: [PATCH 12/12] Merge pull request #22865 from cpoerschke:3.4-issue-22860 ocl_minMaxIdx to call minmaxloc.cl for OpenCL 1.2+ only --- modules/core/src/minmax.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/core/src/minmax.cpp b/modules/core/src/minmax.cpp index 43785d839b..8f807bed56 100644 --- a/modules/core/src/minmax.cpp +++ b/modules/core/src/minmax.cpp @@ -973,6 +973,12 @@ bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int* minLoc return false; #endif + if (dev.deviceVersionMajor() == 1 && dev.deviceVersionMinor() < 2) + { + // 'static' storage class specifier used by "minmaxloc" is available from OpenCL 1.2+ only + return false; + } + bool doubleSupport = dev.doubleFPConfig() > 0, haveMask = !_mask.empty(), haveSrc2 = _src2.kind() != _InputArray::NONE; int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type),