diff --git a/benchmark/config/face_detection_yunet.yaml b/benchmark/config/face_detection_yunet.yaml index cbe56e08..dd5c2a43 100644 --- a/benchmark/config/face_detection_yunet.yaml +++ b/benchmark/config/face_detection_yunet.yaml @@ -16,7 +16,8 @@ Benchmark: Model: name: "YuNet" - modelPath: "models/face_detection_yunet/face_detection_yunet_2021dec.onnx" + modelPath: "models/face_detection_yunet/face_detection_yunet_2022mar.onnx" confThreshold: 0.6 nmsThreshold: 0.3 - topK: 5000 \ No newline at end of file + topK: 5000 + diff --git a/models/face_detection_yunet/README.md b/models/face_detection_yunet/README.md index 9235e15e..b553b12b 100644 --- a/models/face_detection_yunet/README.md +++ b/models/face_detection_yunet/README.md @@ -5,6 +5,7 @@ YuNet is a light-weight, fast and accurate face detection model, which achieves Notes: - Model source: [here](https://github.com/ShiqiYu/libfacedetection.train/blob/a61a428929148171b488f024b5d6774f93cdbc13/tasks/task1/onnx/yunet.onnx). - For details on training this model, please visit https://github.com/ShiqiYu/libfacedetection.train. +- This ONNX model has fixed input shape, but OpenCV DNN infers on the exact shape of input image. See https://github.com/opencv/opencv_zoo/issues/44 for more information. ## Demo diff --git a/models/face_detection_yunet/demo.py b/models/face_detection_yunet/demo.py index 218ebb01..dcb7621f 100644 --- a/models/face_detection_yunet/demo.py +++ b/models/face_detection_yunet/demo.py @@ -33,7 +33,7 @@ def str2bool(v): parser = argparse.ArgumentParser(description='YuNet: A Fast and Accurate CNN-based Face Detector (https://github.com/ShiqiYu/libfacedetection).') parser.add_argument('--input', '-i', type=str, help='Path to the input image. Omit for using default camera.') -parser.add_argument('--model', '-m', type=str, default='face_detection_yunet_2021dec.onnx', help='Path to the model.') +parser.add_argument('--model', '-m', type=str, default='face_detection_yunet_2022mar.onnx', help='Path to the model.') parser.add_argument('--backend', '-b', type=int, default=backends[0], help=help_msg_backends.format(*backends)) parser.add_argument('--target', '-t', type=int, default=targets[0], help=help_msg_targets.format(*targets)) parser.add_argument('--conf_threshold', type=float, default=0.9, help='Filter out faces of confidence < conf_threshold.') diff --git a/models/face_detection_yunet/face_detection_yunet_2021dec-act_int8-wt_int8-quantized.onnx b/models/face_detection_yunet/face_detection_yunet_2021dec-act_int8-wt_int8-quantized.onnx deleted file mode 100644 index 91ccae0c..00000000 --- a/models/face_detection_yunet/face_detection_yunet_2021dec-act_int8-wt_int8-quantized.onnx +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8550b936bd9fb6362ece6e16b25a4e88d681c244e8d8187acf1265b96a371187 -size 120297 diff --git a/models/face_detection_yunet/face_detection_yunet_2021dec.onnx b/models/face_detection_yunet/face_detection_yunet_2021dec.onnx deleted file mode 100644 index 6c259a18..00000000 --- a/models/face_detection_yunet/face_detection_yunet_2021dec.onnx +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b0e63eddb7fad35ad1a23f066507b4f3d49de64ad82a3d2ec1e6bf3ba25815f3 -size 345535 diff --git a/models/face_detection_yunet/face_detection_yunet_2022mar-act_int8-wt_int8-quantized.onnx b/models/face_detection_yunet/face_detection_yunet_2022mar-act_int8-wt_int8-quantized.onnx new file mode 100644 index 00000000..55cc5d28 --- /dev/null +++ b/models/face_detection_yunet/face_detection_yunet_2022mar-act_int8-wt_int8-quantized.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:176794409ae5e9d44b268297b1c480ba7f6df9f793a81d22eac4520aaf331594 +size 119815 diff --git a/models/face_detection_yunet/face_detection_yunet_2022mar.onnx b/models/face_detection_yunet/face_detection_yunet_2022mar.onnx new file mode 100644 index 00000000..1376fbe4 --- /dev/null +++ b/models/face_detection_yunet/face_detection_yunet_2022mar.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50ef07f702a31741ca46a4c0d947773b64143b9362780237bf0d427d6c79bab7 +size 345478 diff --git a/tools/quantize/quantize.py b/tools/quantize/quantize.py index 4ef60c1e..71851d60 100644 --- a/tools/quantize/quantize.py +++ b/tools/quantize/quantize.py @@ -78,8 +78,9 @@ def run(self): models=dict( - yunet=Quantize(model_path='../../models/face_detection_yunet/face_detection_yunet_2021dec.onnx', - calibration_image_dir='../../benchmark/data/face_detection'), + yunet=Quantize(model_path='../../models/face_detection_yunet/face_detection_yunet_2022mar.onnx', + calibration_image_dir='../../benchmark/data/face_detection', + transforms=Compose([Resize(size=(160, 120))])), sface=Quantize(model_path='../../models/face_recognition_sface/face_recognition_sface_2021dec.onnx', calibration_image_dir='../../benchmark/data/face_recognition', transforms=Compose([Resize(size=(112, 112))])),