Skip to content

Commit ebb5289

Browse files
authored
Merge pull request opencv#18353 from l-bat:issue_18350
* Fixed bug in ONNX Mul op * Replaced node
1 parent e668cff commit ebb5289

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

modules/dnn/src/onnx/onnx_importer.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,16 @@ void ONNXImporter::populateNet(Net dstNet)
10511051
}
10521052
else
10531053
{
1054+
// Scale layer allocate output with the first input shape
1055+
if (total(outShapes[node_proto.input(0)]) < total(outShapes[node_proto.input(1)]))
1056+
{
1057+
opencv_onnx::NodeProto proto;
1058+
proto.add_input(node_proto.input(1));
1059+
proto.add_input(node_proto.input(0));
1060+
proto.add_output(layerParams.name);
1061+
node_proto = proto;
1062+
}
1063+
10541064
if (isDiv)
10551065
{
10561066
LayerParams powerParams;

modules/dnn/test/test_onnx_importer.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ TEST_P(Test_ONNX_layers, ReduceMaxGlobal)
267267
testONNXModels("reduce_max");
268268
}
269269

270+
TEST_P(Test_ONNX_layers, Scale)
271+
{
272+
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
273+
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
274+
testONNXModels("scale");
275+
}
276+
270277
TEST_P(Test_ONNX_layers, ReduceMean3D)
271278
{
272279
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target != DNN_TARGET_CPU)

0 commit comments

Comments
 (0)