From fd7cb1be854c76e02233ba5254eaa233b8770928 Mon Sep 17 00:00:00 2001 From: alexlyulkov Date: Thu, 27 Jun 2024 18:51:35 +0300 Subject: [PATCH] Merge pull request #25739 from alexlyulkov:al/openvino2022-fixed-blank Fixed blank layer for OpenVINO 2022.1 #25739 Changed blank layer because it didn't work with old OpenVINO versions(2022.1). The blank layer was implemented using ConvertLike layer, now it is implemented using ShapeOf and Reshape layers. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [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 - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake --- modules/dnn/src/layers/blank_layer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/dnn/src/layers/blank_layer.cpp b/modules/dnn/src/layers/blank_layer.cpp index e95991b3d2..41eab0cd1c 100644 --- a/modules/dnn/src/layers/blank_layer.cpp +++ b/modules/dnn/src/layers/blank_layer.cpp @@ -161,7 +161,11 @@ public: const std::vector >& nodes) CV_OVERRIDE { auto ieInpNode = nodes[0].dynamicCast()->node; - auto blank = std::make_shared(ieInpNode, ieInpNode); + // We use Reshape as blank layer. + // Previously, we used Concat layer, but it didn't work with scalar tensor. + // Also we used ConvertLike layer, but it did't work with old OpenVINO versions. + auto shape = std::make_shared(ieInpNode); + auto blank = std::make_shared(ieInpNode, shape, false); return Ptr(new InfEngineNgraphNode(blank)); } #endif // HAVE_DNN_NGRAPH