YuNet Face Detection β 2023mar
Unmodified redistribution of face_detection_yunet_2023mar.onnx from the
OpenCV Zoo.
YuNet is a light-weight, fast and accurate face detection model (WIDER Face: 0.834 AP_easy / 0.824 AP_medium / 0.708 AP_hard) that detects faces of roughly 10Γ10 to 300Γ300 px. This is the fixed-input-shape variant: OpenCV 4.x's DNN reshapes it to the input frame, while OpenCV 5.x's ONNX Runtime engine needs the dynamic 2026may variant.
Input
input β float32 tensor [1, 3, 640, 640] (fixed): a BGR image, NCHW layout, no normalization.
Output
12 per-stride detection heads for strides s β {8, 16, 32}, each shaped [1, A, C]
with A = (640/s)Β² = 6400 / 1600 / 400 anchors:
| tensor | shape | meaning |
|---|---|---|
cls_{s} |
[1, A, 1] |
classification score |
obj_{s} |
[1, A, 1] |
objectness score |
bbox_{s} |
[1, A, 4] |
bounding-box regression |
kps_{s} |
[1, A, 10] |
5 landmarks β right eye, left eye, nose, right/left mouth corner β as (x, y) |
cv2.FaceDetectorYN decodes these heads into an N Γ 15 array per face:
[x, y, w, h, 5 Γ (x, y), score].
License
MIT, following the upstream OpenCV Zoo.
@article{wu2023yunet,
title={YuNet: A Tiny Millisecond-level Face Detector},
author={Wu, Wei and Peng, Hanyang and Yu, Shiqi},
journal={Machine Intelligence Research},
volume={20}, number={5}, pages={656--665}, year={2023}, publisher={Springer}
}