Yuantao Feng
commited on
Commit
·
8ac861c
1
Parent(s):
f134c2e
Update ONNX opset version of YuNet to 11 for quantization (#34)
Browse files* update ONNX opset version of YuNet to 11 for quantization
* fix corruption when face detection results is none
benchmark/config/face_detection_yunet.yaml
CHANGED
|
@@ -16,7 +16,7 @@ Benchmark:
|
|
| 16 |
|
| 17 |
Model:
|
| 18 |
name: "YuNet"
|
| 19 |
-
modelPath: "models/face_detection_yunet/
|
| 20 |
confThreshold: 0.6
|
| 21 |
nmsThreshold: 0.3
|
| 22 |
topK: 5000
|
|
|
|
| 16 |
|
| 17 |
Model:
|
| 18 |
name: "YuNet"
|
| 19 |
+
modelPath: "models/face_detection_yunet/face_detection_yunet_2021dec.onnx"
|
| 20 |
confThreshold: 0.6
|
| 21 |
nmsThreshold: 0.3
|
| 22 |
topK: 5000
|
models/face_detection_yunet/demo.py
CHANGED
|
@@ -21,7 +21,7 @@ def str2bool(v):
|
|
| 21 |
|
| 22 |
parser = argparse.ArgumentParser(description='YuNet: A Fast and Accurate CNN-based Face Detector (https://github.com/ShiqiYu/libfacedetection).')
|
| 23 |
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='
|
| 25 |
parser.add_argument('--conf_threshold', type=float, default=0.9, help='Filter out faces of confidence < conf_threshold.')
|
| 26 |
parser.add_argument('--nms_threshold', type=float, default=0.3, help='Suppress bounding boxes of iou >= nms_threshold.')
|
| 27 |
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
|
|
| 42 |
if fps is not None:
|
| 43 |
cv.putText(output, 'FPS: {:.2f}'.format(fps), (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, text_color)
|
| 44 |
|
| 45 |
-
for det in results:
|
| 46 |
bbox = det[0:4].astype(np.int32)
|
| 47 |
cv.rectangle(output, (bbox[0], bbox[1]), (bbox[0]+bbox[2], bbox[1]+bbox[3]), box_color, 2)
|
| 48 |
|
|
|
|
| 21 |
|
| 22 |
parser = argparse.ArgumentParser(description='YuNet: A Fast and Accurate CNN-based Face Detector (https://github.com/ShiqiYu/libfacedetection).')
|
| 23 |
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_2021dec.onnx', help='Path to the model.')
|
| 25 |
parser.add_argument('--conf_threshold', type=float, default=0.9, help='Filter out faces of confidence < conf_threshold.')
|
| 26 |
parser.add_argument('--nms_threshold', type=float, default=0.3, help='Suppress bounding boxes of iou >= nms_threshold.')
|
| 27 |
parser.add_argument('--top_k', type=int, default=5000, help='Keep top_k bounding boxes before NMS.')
|
|
|
|
| 42 |
if fps is not None:
|
| 43 |
cv.putText(output, 'FPS: {:.2f}'.format(fps), (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, text_color)
|
| 44 |
|
| 45 |
+
for det in (results if results is not None else []):
|
| 46 |
bbox = det[0:4].astype(np.int32)
|
| 47 |
cv.rectangle(output, (bbox[0], bbox[1]), (bbox[0]+bbox[2], bbox[1]+bbox[3]), box_color, 2)
|
| 48 |
|