Yunet Model gaves an unexpected output sometimes

In the context of creating an application to extract Face Rectangles coords of a great number of faces, in a file path, in the same size dimensions, I got an issue with Yunet.
Code example:

for( ... ) // iterates in all images of the filepat
...
FaceDetector->setInputSize(image.size());
cv::Mat faces(1, 15, CV_32FC1, cv::Scalar(0));
FaceDetector->detect(image, faces);
...

In docs of Yunet usage, it says the expected output for this model is a [num_faces, 15]. But in some random cases, I have only one face and the model gaves me [2 x 15] with infinitely large numbers at the first 15 positions and the expected 15 numbers after these.

Unexpected output for example: [-inf, -inf, inf, inf, -7.3996823e+29, 8.3138902e+29, -6.9410597e+29, 9.5680955e+29, -3.6332516e+29, 6.361716e+29, -5.7762872e+29, 8.271784e+29, -4.8886777e+29, 9.2385431e+29, 1;
8.0682755, 1.9483109, 89.627586, 123.62176, 34.569054, 43.413845, 74.630112, 48.56892, 48.431858, 69.483932, 30.405964, 89.4823, 65.017296, 93.899574, 0.99998468]

In someway, it looks kinda the model find a true face in the infinity (a position completely out of my image).
Note: all my images have the same dimension, an image contains exactly one person and the face it’s totally in the expected range of Yunet input’s " faces of pixels between around 10x10 to 300x30". This bug occurs for different images in different executions. Example: in my first execution, the bug appeared for the image10, the next execution my image10 gaves me the correct [1x15] and then the bug appeared in image94. Maybe it could be a garbage initialization issue, but I always initialize my cv::Mat faces with zero, so I don’t know if the reason could still be related to this way… Any idea?

which exact opencv version and yunet model ?

unlikely the cause of your problem, but please don’t pre-allocate this:

it’s going to be overwritten anyway and you’re fooling yourself believing something about type, shape or content like this

My model version was deprecated. Thanks for answering. It seems the new model version fixed it.

I’m seeing the same thing with the face_detection_yunet_2023mar.onnx model from the model zoo… Any pointer on what it could be? Is there a newer model than this one available?