From f77c3574af01b653d7ba23a77912ccf3b5e4162a Mon Sep 17 00:00:00 2001 From: Yuantao Feng Date: Mon, 21 Feb 2022 21:49:07 +0800 Subject: [PATCH] Merge pull request #21607 from fengyuentau:fix_FaceDetectorYN_dynamic_shape Use YuNet of fixed input shape to fix not-supported-dynamic-zero-shape for FaceDetectorYN * use yunet with input of fixed shape * update yunet used in face recognition regression --- modules/dnn/src/onnx/onnx_importer.cpp | 4 +--- modules/objdetect/test/test_face.cpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/dnn/src/onnx/onnx_importer.cpp b/modules/dnn/src/onnx/onnx_importer.cpp index f9fda41112..7cfc546b12 100644 --- a/modules/dnn/src/onnx/onnx_importer.cpp +++ b/modules/dnn/src/onnx/onnx_importer.cpp @@ -2614,9 +2614,7 @@ void ONNXImporter::parseShape(LayerParams& layerParams, const opencv_onnx::NodeP if (isDynamicShape) { CV_LOG_ERROR(NULL, "DNN/ONNX(Shape): dynamic 'zero' shapes are not supported, input " << toString(inpShape, node_proto.input(0))); - // FIXIT repair assertion - // Disabled to pass face detector tests from #20422 - // CV_Assert(!isDynamicShape); // not supported + CV_Assert(!isDynamicShape); // not supported } addConstant(node_proto.output(0), shapeMat); } diff --git a/modules/objdetect/test/test_face.cpp b/modules/objdetect/test/test_face.cpp index 2e944c50df..d33032fa2f 100644 --- a/modules/objdetect/test/test_face.cpp +++ b/modules/objdetect/test/test_face.cpp @@ -78,7 +78,7 @@ TEST(Objdetect_face_detection, regression) // } // Initialize detector - std::string model = findDataFile("dnn/onnx/models/yunet-202109.onnx", false); + std::string model = findDataFile("dnn/onnx/models/yunet-202202.onnx", false); Ptr faceDetector = FaceDetectorYN::create(model, "", Size(300, 300)); faceDetector->setScoreThreshold(0.7f); @@ -178,7 +178,7 @@ TEST(Objdetect_face_recognition, regression) } // Initialize detector - std::string detect_model = findDataFile("dnn/onnx/models/yunet-202109.onnx", false); + std::string detect_model = findDataFile("dnn/onnx/models/yunet-202202.onnx", false); Ptr faceDetector = FaceDetectorYN::create(detect_model, "", Size(150, 150), score_thresh, nms_thresh); std::string recog_model = findDataFile("dnn/onnx/models/face_recognizer_fast.onnx", false);