diff --git a/modules/dnn/src/onnx/onnx_importer.cpp b/modules/dnn/src/onnx/onnx_importer.cpp index 995800310f..318c2cc290 100644 --- a/modules/dnn/src/onnx/onnx_importer.cpp +++ b/modules/dnn/src/onnx/onnx_importer.cpp @@ -1588,7 +1588,9 @@ void ONNXImporter::populateNet(Net dstNet) Mat shapes = getBlob(node_proto, constBlobs, node_proto.input_size() - 1); CV_CheckEQ(shapes.size[0], 4, ""); CV_CheckEQ(shapes.size[1], 1, ""); - CV_CheckTypeEQ(shapes.depth(), CV_32S, ""); + CV_CheckDepth(shapes.depth(), shapes.depth() == CV_32S || shapes.depth() == CV_32F, ""); + if (shapes.depth() == CV_32F) + shapes.convertTo(shapes, CV_32S); int height = shapes.at(2); int width = shapes.at(3); if (node_proto.input_size() == 3) diff --git a/modules/dnn/test/test_onnx_importer.cpp b/modules/dnn/test/test_onnx_importer.cpp index 2a4555619f..4234fa8d8b 100644 --- a/modules/dnn/test/test_onnx_importer.cpp +++ b/modules/dnn/test/test_onnx_importer.cpp @@ -636,6 +636,11 @@ TEST_P(Test_ONNX_layers, MatmulWithTwoInputs) testONNXModels("matmul_with_two_inputs"); } +TEST_P(Test_ONNX_layers, ResizeOpset11_Torch1_6) +{ + testONNXModels("resize_opset11_torch1.6"); +} + INSTANTIATE_TEST_CASE_P(/*nothing*/, Test_ONNX_layers, dnnBackendsAndTargets()); class Test_ONNX_nets : public Test_ONNX_layers