Skip to content

Commit

Permalink
Use YuNet of fixed input shape to avoid 'parseShape' error (#45)
Browse files Browse the repository at this point in the history
* replace with yunet of fixed input shape

* update quantized yunet

* update yunet filename used in scripts

* add a note message for #44
  • Loading branch information
fengyuentau authored Apr 1, 2022
1 parent dc92bbe commit 4563a91
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions benchmark/config/face_detection_yunet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
topK: 5000

1 change: 1 addition & 0 deletions models/face_detection_yunet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion models/face_detection_yunet/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down

This file was deleted.

3 changes: 0 additions & 3 deletions models/face_detection_yunet/face_detection_yunet_2021dec.onnx

This file was deleted.

Git LFS file not shown
3 changes: 3 additions & 0 deletions models/face_detection_yunet/face_detection_yunet_2022mar.onnx
Git LFS file not shown
5 changes: 3 additions & 2 deletions tools/quantize/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))])),
Expand Down

0 comments on commit 4563a91

Please sign in to comment.