summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/opencv
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2023-10-19 08:47:16 +0200
committerKhem Raj <raj.khem@gmail.com>2023-10-19 07:58:51 -0700
commit3efcb6b16d9fe8ab90b1432a980f09a15b25d9c2 (patch)
tree9bdbbaef4787a38aadf481c2651c1ad0c05a8a0d /meta-oe/recipes-support/opencv
parentd08453978c31ee41d28206c6ff198d7d9d701d88 (diff)
downloadmeta-openembedded-3efcb6b16d9fe8ab90b1432a980f09a15b25d9c2.tar.gz
opencv: refresh protobuf-v22 compatibility patch with backported version
* as a bonus it fixes building with tests PACKAGECONFIG enabled as reported in: https://github.com/openembedded/meta-openembedded/commit/225ce6a14a8110ab6b573b4dc9f5297a03d17e0f#r129831882 Signed-off-by: Martin Jansa <martin.jansa@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support/opencv')
-rw-r--r--meta-oe/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch385
1 files changed, 88 insertions, 297 deletions
diff --git a/meta-oe/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch b/meta-oe/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch
index 536060cfd..265d723c6 100644
--- a/meta-oe/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch
+++ b/meta-oe/recipes-support/opencv/opencv/fix-build-with-protobuf-v22.patch
@@ -1,19 +1,60 @@
1From 5e4150826fea6f37276f348c65d94ce4847d1211 Mon Sep 17 00:00:00 2001 1From 75f7475fcfb35cbe4d8f5ccf5c4ac8bc78f2dc30 Mon Sep 17 00:00:00 2001
2From: Kumataro <Kumataro@users.noreply.github.com> 2From: Kumataro <Kumataro@users.noreply.github.com>
3Date: Sat, 7 Oct 2023 10:11:25 +0900 3Date: Thu, 19 Oct 2023 14:45:08 +0900
4Subject: [PATCH] 3rdparty: supporting protobuf v22 and later 4Subject: [PATCH] Merge pull request #24372 from Kumataro:fix24369
5 5
6Upstream-Status: Submitted [https://github.com/opencv/opencv/pull/24372] 6Supporting protobuf v22 and later(with abseil-cpp/C++17) #24372
7
8fix https://github.com/opencv/opencv/issues/24369
9related https://github.com/opencv/opencv/issues/23791
10
111. This patch supports external protobuf v22 and later, it required abseil-cpp and c++17.
12 Even if the built-in protobuf is upgraded to v22 or later,
13 the dependency on abseil-cpp and the requirement for C++17 will continue.
142. Some test for caffe required patched protobuf, so this patch disable them.
15
16This patch is tested by following libraries.
17- Protobuf: /usr/local/lib/libprotobuf.so (4.24.4)
18- abseil-cpp: YES (20230125)
19
20See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
21
22- [x] I agree to contribute to the project under Apache 2 License.
23- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
24- [x] The PR is proposed to the proper branch
25- [x] There is a reference to the original bug report and related work
26- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
27 Patch to opencv_extra has the same branch name.
28- [x] The feature is well documented and sample code can be built with the project CMake
29
30Upstream-Status: Backport [https://github.com/opencv/opencv/commit/6e4280ea81b59c6dca45bb9801b758377beead55]
7--- 31---
8 cmake/OpenCVFindProtobuf.cmake | 37 ++++++++++++++++++++++++++++++++++ 32 cmake/OpenCVFindProtobuf.cmake | 35 +++++++++++++++++++++++++++-----
9 modules/dnn/CMakeLists.txt | 9 +++++++++ 33 modules/dnn/CMakeLists.txt | 6 ++++++
10 2 files changed, 46 insertions(+) 34 modules/dnn/test/test_layers.cpp | 24 ++++++++++++++++++----
35 3 files changed, 56 insertions(+), 9 deletions(-)
11 36
12diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake 37diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake
13index 8835347d1d..9bd5c28db8 100644 38index 8835347d1d..5b1e17529f 100644
14--- a/cmake/OpenCVFindProtobuf.cmake 39--- a/cmake/OpenCVFindProtobuf.cmake
15+++ b/cmake/OpenCVFindProtobuf.cmake 40+++ b/cmake/OpenCVFindProtobuf.cmake
16@@ -67,6 +67,38 @@ else() 41@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
42 set(Protobuf_LIBRARIES "libprotobuf")
43 set(HAVE_PROTOBUF TRUE)
44 else()
45+ # we still need this for command PROTOBUF_GENERATE_CPP.
46+ set(protobuf_MODULE_COMPATIBLE ON)
47+
48 unset(Protobuf_VERSION CACHE)
49- find_package(Protobuf QUIET)
50+ find_package(Protobuf QUIET CONFIG)
51+ if(NOT Protobuf_FOUND)
52+ find_package(Protobuf QUIET)
53+ endif()
54
55 # Backwards compatibility
56 # Define camel case versions of input variables
57@@ -67,6 +73,20 @@ else()
17 endif() 58 endif()
18 endif() 59 endif()
19 60
@@ -21,82 +62,49 @@ index 8835347d1d..9bd5c28db8 100644
21+# In Protocol Buffers v22.0 and later drops C++11 support and depends abseil-cpp. 62+# In Protocol Buffers v22.0 and later drops C++11 support and depends abseil-cpp.
22+# Details: https://protobuf.dev/news/2022-08-03/ 63+# Details: https://protobuf.dev/news/2022-08-03/
23+# And if std::text_view is in abseil-cpp requests C++17 and later. 64+# And if std::text_view is in abseil-cpp requests C++17 and later.
24+if(HAVE_PROTOBUF)
25+ if("${Protobuf_VERSION}" MATCHES [[[0-9]+.([0-9]+).[0-9]+]])
26+ string(COMPARE GREATER_EQUAL "${CMAKE_MATCH_1}" "22" REQUEST_ABSL)
27+
28+ if(REQUEST_ABSL)
29+ string(COMPARE GREATER_EQUAL "${CMAKE_CXX_STANDARD}" "17" USED_AFTER_CXX17)
30+ if(NOT USED_AFTER_CXX17)
31+ message("CMAKE_CXX_STANDARD : ${CMAKE_CXX_STANDARD}")
32+ message("protobuf : ${Protobuf_VERSION}")
33+ message(FATAL_ERROR "protobuf(v22 and later) and abseil-cpp request CMAKE_CXX_STANDARD=17 and later.")
34+ endif()
35+
36+ ocv_check_modules(ABSL_STRINGS absl_strings)
37+ if(NOT ABSL_STRINGS_FOUND)
38+ message(FATAL_ERROR "protobuf(v22 and later) requests abseil-cpp(strings), but missing.")
39+ endif()
40+
41+ ocv_check_modules(ABSL_LOG absl_log)
42+ if(NOT ABSL_LOG_FOUND)
43+ message(FATAL_ERROR "protobuf(v22 and later) requests abseil-cpp(log), but missing.")
44+ endif()
45+ 65+
46+ endif() 66+if(HAVE_PROTOBUF)
47+ else() 67+ if(NOT (Protobuf_VERSION VERSION_LESS 22))
48+ message(FATAL_ERROR "Protobuf version(${Protobuf_VERSION}) is unexpected to split.") 68+ if((CMAKE_CXX_STANDARD EQUAL 98) OR (CMAKE_CXX_STANDARD LESS 17))
69+ message(STATUS "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is too old to support protobuf(${Protobuf_VERSION}) and/or abseil-cpp. Use C++17 or later. Turning HAVE_PROTOBUF off")
70+ set(HAVE_PROTOBUF FALSE)
49+ endif() 71+ endif()
72+ endif()
50+endif() 73+endif()
51+ 74+
52 if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP) 75 if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP)
53 message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})") 76 message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})")
54 endif() 77 endif()
55@@ -89,3 +121,8 @@ if(HAVE_PROTOBUF) 78@@ -74,15 +94,20 @@ endif()
56 BUILD_PROTOBUF THEN "build (${Protobuf_VERSION})" 79 if(HAVE_PROTOBUF)
57 ELSE "${__location} (${Protobuf_VERSION})") 80 list(APPEND CUSTOM_STATUS protobuf)
58 endif() 81 if(NOT BUILD_PROTOBUF)
59+ 82+ unset( __location)
60+if(HAVE_ABSL_STRINGS AND HAVE_ABSL_LOG) 83 if(TARGET "${Protobuf_LIBRARIES}")
61+ list(APPEND CUSTOM_STATUS absl) 84 get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION_RELEASE)
62+ list(APPEND CUSTOM_STATUS_absl " abseil-cpp:" "YES (${ABSL_STRINGS_VERSION})" ) 85 if(NOT __location)
63+endif() 86 get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION)
64diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt 87 endif()
65index 804b78ead2..d32007b37e 100644 88- elseif(Protobuf_LIBRARY)
66--- a/modules/dnn/CMakeLists.txt 89- set(__location "${Protobuf_LIBRARY}")
67+++ b/modules/dnn/CMakeLists.txt 90- else()
68@@ -149,6 +149,15 @@ if(NOT BUILD_PROTOBUF) 91- set(__location "${Protobuf_LIBRARIES}")
69 list(APPEND include_dirs ${Protobuf_INCLUDE_DIRS}) 92+ endif()
70 endif()
71
72+if(HAVE_ABSL_STRINGS)
73+ list(APPEND libs ${ABSL_STRINGS_LIBRARIES})
74+ list(APPEND include_dirs ${ABSL_STRTRINGS_INCLUDE_DIRS})
75+endif()
76+if(HAVE_ABSL_LOG)
77+ list(APPEND libs ${ABSL_LOG_LIBRARIES})
78+ list(APPEND include_dirs ${ABSL_LOG_INCLUDE_DIRS})
79+endif()
80+ 93+
81 set(sources_options "") 94+ if(NOT __location)
82 95+ if(Protobuf_LIBRARY)
83 list(APPEND libs ${LAPACK_LIBRARIES}) 96+ set(__location "${Protobuf_LIBRARY}")
84From 06a7669521d205f647d3e718322ccd153cdbbb77 Mon Sep 17 00:00:00 2001 97+ else()
85From: Kumataro <Kumataro@users.noreply.github.com> 98+ set(__location "${Protobuf_LIBRARIES}")
86Date: Sun, 8 Oct 2023 09:39:35 +0900 99+ endif()
87Subject: [PATCH] dnn: disable some tests for external protobuf 100 endif()
88 101 endif()
89--- 102 list(APPEND CUSTOM_STATUS_protobuf " Protobuf:"
90 modules/dnn/CMakeLists.txt | 5 +++++
91 modules/dnn/src/caffe/caffe_io.cpp | 24 ++++++++++++++++++++++--
92 modules/dnn/test/test_layers.cpp | 16 ++++++++++++++++
93 3 files changed, 43 insertions(+), 2 deletions(-)
94
95diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt 103diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt
96index d32007b37e..face38465f 100644 104index 804b78ead2..9fcc460909 100644
97--- a/modules/dnn/CMakeLists.txt 105--- a/modules/dnn/CMakeLists.txt
98+++ b/modules/dnn/CMakeLists.txt 106+++ b/modules/dnn/CMakeLists.txt
99@@ -254,6 +254,12 @@ ocv_create_module(${libs} ${dnn_runtime_libs}) 107@@ -245,6 +245,12 @@ ocv_create_module(${libs} ${dnn_runtime_libs})
100 ocv_add_samples() 108 ocv_add_samples()
101 ocv_add_accuracy_tests(${dnn_runtime_libs}) 109 ocv_add_accuracy_tests(${dnn_runtime_libs})
102 110
@@ -109,215 +117,13 @@ index d32007b37e..face38465f 100644
109 set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf") 117 set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf")
110 file(GLOB_RECURSE perf_srcs "${perf_path}/*.cpp") 118 file(GLOB_RECURSE perf_srcs "${perf_path}/*.cpp")
111 file(GLOB_RECURSE perf_hdrs "${perf_path}/*.hpp" "${perf_path}/*.h") 119 file(GLOB_RECURSE perf_hdrs "${perf_path}/*.hpp" "${perf_path}/*.h")
112@@ -318,3 +322,4 @@ if(OPENCV_TEST_DNN_TFLITE)
113 ocv_target_compile_definitions(opencv_perf_dnn PRIVATE "OPENCV_TEST_DNN_TFLITE=1")
114 endif()
115 endif()
116+
117diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp
118index ebecf95eea..ebceca84cf 100644
119--- a/modules/dnn/src/caffe/caffe_io.cpp
120+++ b/modules/dnn/src/caffe/caffe_io.cpp
121@@ -1130,7 +1130,17 @@ bool ReadProtoFromTextFile(const char* filename, Message* proto) {
122 parser.AllowUnknownField(true);
123 parser.SetRecursionLimit(1000);
124 #endif
125- return parser.Parse(&input, proto);
126+ const bool ret = parser.Parse(&input, proto);
127+
128+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
129+ if(!ret)
130+ {
131+ LOG(ERROR) << "Some data requires patched protobuf (available in OpenCV source tree only).";
132+ CV_Error_(Error::StsError,("Some data requires patched protobuf (available in OpenCV source tree only)."));
133+ }
134+#endif
135+
136+ return ret;
137 }
138
139 bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {
140@@ -1148,7 +1158,17 @@ bool ReadProtoFromTextBuffer(const char* data, size_t len, Message* proto) {
141 parser.AllowUnknownField(true);
142 parser.SetRecursionLimit(1000);
143 #endif
144- return parser.Parse(&input, proto);
145+ const bool ret = parser.Parse(&input, proto);
146+
147+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
148+ if(!ret)
149+ {
150+ LOG(ERROR) << "Some data requires patched protobuf (available in OpenCV source tree only).";
151+ CV_Error_(Error::StsError,("Some data requires patched protobuf (available in OpenCV source tree only)."));
152+ }
153+#endif
154+
155+ return ret;
156 }
157
158
159diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp 120diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp
160index 763d94b99c..a07d442d76 100644 121index 763d94b99c..6cb6d54b3f 100644
161--- a/modules/dnn/test/test_layers.cpp 122--- a/modules/dnn/test/test_layers.cpp
162+++ b/modules/dnn/test/test_layers.cpp 123+++ b/modules/dnn/test/test_layers.cpp
163@@ -754,7 +754,11 @@ TEST_F(Layer_RNN_Test, get_set_test) 124@@ -756,11 +756,15 @@ TEST_F(Layer_RNN_Test, get_set_test)
164 EXPECT_EQ(shape(outputs[1]), shape(nT, nS, nH));
165 }
166 125
167+#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
168 TEST_P(Test_Caffe_layers, Accum) 126 TEST_P(Test_Caffe_layers, Accum)
169+#else
170+TEST_P(Test_Caffe_layers, DISABLED_Accum) // requires patched protobuf (available in OpenCV source tree only)
171+#endif
172 {
173 if (backend == DNN_BACKEND_OPENCV && target != DNN_TARGET_CPU)
174 applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
175@@ -778,7 +782,11 @@ TEST_P(Test_Caffe_layers, ChannelNorm)
176 testLayerUsingCaffeModels("channel_norm", false, false);
177 }
178
179+#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
180 TEST_P(Test_Caffe_layers, DataAugmentation)
181+#else
182+TEST_P(Test_Caffe_layers, DISABLED_DataAugmentation) // requires patched protobuf (available in OpenCV source tree only)
183+#endif
184 {
185 if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
186 applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
187@@ -787,7 +795,11 @@ TEST_P(Test_Caffe_layers, DataAugmentation)
188 testLayerUsingCaffeModels("data_augmentation_8x6", true, false);
189 }
190
191+#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
192 TEST_P(Test_Caffe_layers, Resample)
193+#else
194+TEST_P(Test_Caffe_layers, DISABLED_Resample) // requires patched protobuf (available in OpenCV source tree only)
195+#endif
196 {
197 if (backend != DNN_BACKEND_OPENCV)
198 applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
199@@ -795,7 +807,11 @@ TEST_P(Test_Caffe_layers, Resample)
200 testLayerUsingCaffeModels("nearest", false, false);
201 }
202
203+#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
204 TEST_P(Test_Caffe_layers, Correlation)
205+#else
206+TEST_P(Test_Caffe_layers, DISABLED_Correlation) // requires patched protobuf (available in OpenCV source tree only)
207+#endif
208 {
209 if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
210 applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER,
211From 2c33798f41942aefc203183d673ce4846f32dba4 Mon Sep 17 00:00:00 2001
212From: Kumataro <Kumataro@users.noreply.github.com>
213Date: Sun, 8 Oct 2023 13:28:40 +0900
214Subject: [PATCH] use GREATER instead of GREATER_EQUAL and remove new blank
215 line at EOF
216
217---
218 cmake/OpenCVFindProtobuf.cmake | 6 ++++--
219 1 file changed, 4 insertions(+), 2 deletions(-)
220
221diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake
222index 9bd5c28db8..ba147526d6 100644
223--- a/cmake/OpenCVFindProtobuf.cmake
224+++ b/cmake/OpenCVFindProtobuf.cmake
225@@ -71,12 +71,14 @@ endif()
226 # In Protocol Buffers v22.0 and later drops C++11 support and depends abseil-cpp.
227 # Details: https://protobuf.dev/news/2022-08-03/
228 # And if std::text_view is in abseil-cpp requests C++17 and later.
229+
230 if(HAVE_PROTOBUF)
231 if("${Protobuf_VERSION}" MATCHES [[[0-9]+.([0-9]+).[0-9]+]])
232- string(COMPARE GREATER_EQUAL "${CMAKE_MATCH_1}" "22" REQUEST_ABSL)
233+ string(COMPARE GREATER "${CMAKE_MATCH_1}" "21" REQUEST_ABSL) # >=22
234
235 if(REQUEST_ABSL)
236- string(COMPARE GREATER_EQUAL "${CMAKE_CXX_STANDARD}" "17" USED_AFTER_CXX17)
237+ string(COMPARE GREATER "${CMAKE_CXX_STANDARD}" "16" USED_AFTER_CXX17) # >=17
238+
239 if(NOT USED_AFTER_CXX17)
240 message("CMAKE_CXX_STANDARD : ${CMAKE_CXX_STANDARD}")
241 message("protobuf : ${Protobuf_VERSION}")
242From cd709eefbeedd116bf3495b42280323b932791ff Mon Sep 17 00:00:00 2001
243From: Kumataro <Kumataro@users.noreply.github.com>
244Date: Mon, 9 Oct 2023 21:51:04 +0900
245Subject: [PATCH] fix for review
246
247---
248 cmake/OpenCVFindProtobuf.cmake | 5 ----
249 modules/dnn/src/caffe/caffe_io.cpp | 24 ++----------------
250 modules/dnn/test/test_layers.cpp | 40 +++++++++++++++---------------
251 3 files changed, 22 insertions(+), 47 deletions(-)
252
253diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake
254index ba147526d6..2faf1010bf 100644
255--- a/cmake/OpenCVFindProtobuf.cmake
256+++ b/cmake/OpenCVFindProtobuf.cmake
257@@ -123,8 +123,3 @@ if(HAVE_PROTOBUF)
258 BUILD_PROTOBUF THEN "build (${Protobuf_VERSION})"
259 ELSE "${__location} (${Protobuf_VERSION})")
260 endif()
261-
262-if(HAVE_ABSL_STRINGS AND HAVE_ABSL_LOG)
263- list(APPEND CUSTOM_STATUS absl)
264- list(APPEND CUSTOM_STATUS_absl " abseil-cpp:" "YES (${ABSL_STRINGS_VERSION})" )
265-endif()
266diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp
267index ebceca84cf..ebecf95eea 100644
268--- a/modules/dnn/src/caffe/caffe_io.cpp
269+++ b/modules/dnn/src/caffe/caffe_io.cpp
270@@ -1130,17 +1130,7 @@ bool ReadProtoFromTextFile(const char* filename, Message* proto) {
271 parser.AllowUnknownField(true);
272 parser.SetRecursionLimit(1000);
273 #endif
274- const bool ret = parser.Parse(&input, proto);
275-
276-#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
277- if(!ret)
278- {
279- LOG(ERROR) << "Some data requires patched protobuf (available in OpenCV source tree only).";
280- CV_Error_(Error::StsError,("Some data requires patched protobuf (available in OpenCV source tree only)."));
281- }
282-#endif
283-
284- return ret;
285+ return parser.Parse(&input, proto);
286 }
287
288 bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {
289@@ -1158,17 +1148,7 @@ bool ReadProtoFromTextBuffer(const char* data, size_t len, Message* proto) {
290 parser.AllowUnknownField(true);
291 parser.SetRecursionLimit(1000);
292 #endif
293- const bool ret = parser.Parse(&input, proto);
294-
295-#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
296- if(!ret)
297- {
298- LOG(ERROR) << "Some data requires patched protobuf (available in OpenCV source tree only).";
299- CV_Error_(Error::StsError,("Some data requires patched protobuf (available in OpenCV source tree only)."));
300- }
301-#endif
302-
303- return ret;
304+ return parser.Parse(&input, proto);
305 }
306
307
308diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp
309index a07d442d76..5c6fc541d7 100644
310--- a/modules/dnn/test/test_layers.cpp
311+++ b/modules/dnn/test/test_layers.cpp
312@@ -754,17 +754,17 @@ TEST_F(Layer_RNN_Test, get_set_test)
313 EXPECT_EQ(shape(outputs[1]), shape(nT, nS, nH));
314 }
315
316-#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
317 TEST_P(Test_Caffe_layers, Accum)
318-#else
319-TEST_P(Test_Caffe_layers, DISABLED_Accum) // requires patched protobuf (available in OpenCV source tree only)
320-#endif
321 { 127 {
322+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF 128+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
323+ throw SkipTestException("Requires patched protobuf"); 129+ throw SkipTestException("Requires patched protobuf");
@@ -331,15 +137,9 @@ index a07d442d76..5c6fc541d7 100644
331 } 137 }
332 138
333 TEST_P(Test_Caffe_layers, FlowWarp) 139 TEST_P(Test_Caffe_layers, FlowWarp)
334@@ -782,42 +782,42 @@ TEST_P(Test_Caffe_layers, ChannelNorm) 140@@ -780,27 +784,39 @@ TEST_P(Test_Caffe_layers, ChannelNorm)
335 testLayerUsingCaffeModels("channel_norm", false, false);
336 }
337 141
338-#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
339 TEST_P(Test_Caffe_layers, DataAugmentation) 142 TEST_P(Test_Caffe_layers, DataAugmentation)
340-#else
341-TEST_P(Test_Caffe_layers, DISABLED_DataAugmentation) // requires patched protobuf (available in OpenCV source tree only)
342-#endif
343 { 143 {
344+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF 144+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
345+ throw SkipTestException("Requires patched protobuf"); 145+ throw SkipTestException("Requires patched protobuf");
@@ -352,11 +152,7 @@ index a07d442d76..5c6fc541d7 100644
352+#endif 152+#endif
353 } 153 }
354 154
355-#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
356 TEST_P(Test_Caffe_layers, Resample) 155 TEST_P(Test_Caffe_layers, Resample)
357-#else
358-TEST_P(Test_Caffe_layers, DISABLED_Resample) // requires patched protobuf (available in OpenCV source tree only)
359-#endif
360 { 156 {
361+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF 157+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
362+ throw SkipTestException("Requires patched protobuf"); 158+ throw SkipTestException("Requires patched protobuf");
@@ -368,11 +164,7 @@ index a07d442d76..5c6fc541d7 100644
368+#endif 164+#endif
369 } 165 }
370 166
371-#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
372 TEST_P(Test_Caffe_layers, Correlation) 167 TEST_P(Test_Caffe_layers, Correlation)
373-#else
374-TEST_P(Test_Caffe_layers, DISABLED_Correlation) // requires patched protobuf (available in OpenCV source tree only)
375-#endif
376 { 168 {
377+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF 169+#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
378+ throw SkipTestException("Requires patched protobuf"); 170+ throw SkipTestException("Requires patched protobuf");
@@ -381,12 +173,11 @@ index a07d442d76..5c6fc541d7 100644
381 applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, 173 applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER,
382 CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16); 174 CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
383 testLayerUsingCaffeModels("correlation", false, false, 0.0, 0.0, 2); 175 testLayerUsingCaffeModels("correlation", false, false, 0.0, 0.0, 2);
384 }
385+#endif 176+#endif
177 }
386 178
387 TEST_P(Test_Caffe_layers, Convolution2Inputs) 179 TEST_P(Test_Caffe_layers, Convolution2Inputs)
388 { 180@@ -1641,12 +1657,11 @@ private:
389@@ -1657,12 +1657,11 @@ private:
390 int outWidth, outHeight, zoomFactor; 181 int outWidth, outHeight, zoomFactor;
391 }; 182 };
392 183
@@ -402,7 +193,7 @@ index a07d442d76..5c6fc541d7 100644
402 #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000) 193 #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000)
403 if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD) 194 if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
404 applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception 195 applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH); // exception
405@@ -1686,6 +1685,7 @@ TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (availa 196@@ -1670,6 +1685,7 @@ TEST_P(Test_Caffe_layers, DISABLED_Interp) // requires patched protobuf (availa
406 197
407 // Test an implemented layer. 198 // Test an implemented layer.
408 testLayerUsingCaffeModels("layer_interp", false, false); 199 testLayerUsingCaffeModels("layer_interp", false, false);