DNN-based Face Detection And Recognition | OpenCV Tutorials
cv::FaceDetectorYN Class Reference | OpenCV Online Documentation
2023/06/27 OpenCV DNN based Face Detection API/Model will update to YuNet v2 from OpenCV 4.8.0. If you want more detail, Please refer to Pull Request.
There is a model at https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet.
i.e face_detection_yunet_2022mar.onnx
This model is NOT compatible with your sample project.
That is an updated model that has bugs listed in
ShiqiYu/libfacedetection#294
But if you can get your project working with the new ONNX model let me know.
As far as I know it just doesn't work correctly.