Skip to content

Commit 8a872fb

Browse files
authored
Update ONNX opset version of YuNet to 11 for quantization (#34)
* update ONNX opset version of YuNet to 11 for quantization * fix corruption when face detection results is none
1 parent 270be2b commit 8a872fb

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

benchmark/config/face_detection_yunet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Benchmark:
1616

1717
Model:
1818
name: "YuNet"
19-
modelPath: "models/face_detection_yunet/face_detection_yunet_2021sep.onnx"
19+
modelPath: "models/face_detection_yunet/face_detection_yunet_2021dec.onnx"
2020
confThreshold: 0.6
2121
nmsThreshold: 0.3
2222
topK: 5000

models/face_detection_yunet/demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def str2bool(v):
2121

2222
parser = argparse.ArgumentParser(description='YuNet: A Fast and Accurate CNN-based Face Detector (https://github.com/ShiqiYu/libfacedetection).')
2323
parser.add_argument('--input', '-i', type=str, help='Path to the input image. Omit for using default camera.')
24-
parser.add_argument('--model', '-m', type=str, default='face_detection_yunet_2021sep.onnx', help='Path to the model.')
24+
parser.add_argument('--model', '-m', type=str, default='face_detection_yunet_2021dec.onnx', help='Path to the model.')
2525
parser.add_argument('--conf_threshold', type=float, default=0.9, help='Filter out faces of confidence < conf_threshold.')
2626
parser.add_argument('--nms_threshold', type=float, default=0.3, help='Suppress bounding boxes of iou >= nms_threshold.')
2727
parser.add_argument('--top_k', type=int, default=5000, help='Keep top_k bounding boxes before NMS.')
@@ -42,7 +42,7 @@ def visualize(image, results, box_color=(0, 255, 0), text_color=(0, 0, 255), fps
4242
if fps is not None:
4343
cv.putText(output, 'FPS: {:.2f}'.format(fps), (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, text_color)
4444

45-
for det in results:
45+
for det in (results if results is not None else []):
4646
bbox = det[0:4].astype(np.int32)
4747
cv.rectangle(output, (bbox[0], bbox[1]), (bbox[0]+bbox[2], bbox[1]+bbox[3]), box_color, 2)
4848

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:b0e63eddb7fad35ad1a23f066507b4f3d49de64ad82a3d2ec1e6bf3ba25815f3
3+
size 345535

models/face_detection_yunet/face_detection_yunet_2021sep.onnx

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)