From 2349a097365fa77ee2d4a7dccd86e30f350fa2a2 Mon Sep 17 00:00:00 2001 From: Liubov Batanina Date: Mon, 31 Aug 2020 12:52:55 +0300 Subject: [PATCH] Support Reshape with zero dim --- modules/dnn/src/onnx/onnx_importer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/dnn/src/onnx/onnx_importer.cpp b/modules/dnn/src/onnx/onnx_importer.cpp index 8cb2c5eda1..153d026e4b 100644 --- a/modules/dnn/src/onnx/onnx_importer.cpp +++ b/modules/dnn/src/onnx/onnx_importer.cpp @@ -335,6 +335,10 @@ void ONNXImporter::populateNet(Net dstNet) { inpShape[j] = tensorShape.dim(j).dim_value(); } + if (!inpShape.empty()) + { + inpShape[0] = std::max(inpShape[0], 1); // It's OK to have undetermined batch size + } outShapes[valueInfoProto.name()] = inpShape; }