From: Liubov Batanina Date: Fri, 18 Sep 2020 13:01:14 +0000 (+0300) Subject: Merge pull request #18353 from l-bat:issue_18350 X-Git-Tag: submit/tizen/20210224.033012~2^2~15^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebb528976f6e7e4572a8fadf1004ffcebc9ca584;p=platform%2Fupstream%2Fopencv.git Merge pull request #18353 from l-bat:issue_18350 * Fixed bug in ONNX Mul op * Replaced node --- diff --git a/modules/dnn/src/onnx/onnx_importer.cpp b/modules/dnn/src/onnx/onnx_importer.cpp index 318c2cc290..58e5cf75f5 100644 --- a/modules/dnn/src/onnx/onnx_importer.cpp +++ b/modules/dnn/src/onnx/onnx_importer.cpp @@ -1051,6 +1051,16 @@ void ONNXImporter::populateNet(Net dstNet) } else { + // Scale layer allocate output with the first input shape + if (total(outShapes[node_proto.input(0)]) < total(outShapes[node_proto.input(1)])) + { + opencv_onnx::NodeProto proto; + proto.add_input(node_proto.input(1)); + proto.add_input(node_proto.input(0)); + proto.add_output(layerParams.name); + node_proto = proto; + } + if (isDiv) { LayerParams powerParams; diff --git a/modules/dnn/test/test_onnx_importer.cpp b/modules/dnn/test/test_onnx_importer.cpp index 4234fa8d8b..993ba56be4 100644 --- a/modules/dnn/test/test_onnx_importer.cpp +++ b/modules/dnn/test/test_onnx_importer.cpp @@ -267,6 +267,13 @@ TEST_P(Test_ONNX_layers, ReduceMaxGlobal) testONNXModels("reduce_max"); } +TEST_P(Test_ONNX_layers, Scale) +{ + if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) + applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER); + testONNXModels("scale"); +} + TEST_P(Test_ONNX_layers, ReduceMean3D) { if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target != DNN_TARGET_CPU)