From 98c33c605dfb09bd4b974cc35db87c5077e677b3 Mon Sep 17 00:00:00 2001 From: Zihao Mu Date: Wed, 20 Jul 2022 19:02:16 +0800 Subject: [PATCH] batchsize dynamic is set to index 0. --- modules/dnn/src/onnx/onnx_importer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dnn/src/onnx/onnx_importer.cpp b/modules/dnn/src/onnx/onnx_importer.cpp index 7390d03..e90581e 100644 --- a/modules/dnn/src/onnx/onnx_importer.cpp +++ b/modules/dnn/src/onnx/onnx_importer.cpp @@ -1303,7 +1303,7 @@ void ONNXImporter::parseReduce(LayerParams& layerParams, const opencv_onnx::Node layerParams.set("dim", DictValue::arrayInt(&targetShape[0], targetShape.size())); // Set batchsize dim as dynamic to be compatible with batch size >= 2. - if (targetShape[0] == 1 && targetShape.size() > 1) + if (targetShape.size() > 1) { std::vector dynamicAxes = {0}; // The index of batchsize dim is 0. std::vector inputIndices = {0}; -- 2.7.4