You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
face_detection_yunet_2023mar_int8.onnx model from zoo detects nothing with 5.x #28798
OpenCV version: 5.x-pre, commit 53d9a67
dnn/face_detect.py works well with both fp32 model and in8bq models, but does not detect face with the original int8 model from model zoo
Hi everyone,
I have investigated this issue and found the root cause. The problem occurs in modules/objdetect/src/face_detect.cpp during the postProcess step.
When using the INT8 quantized model, the output tensors are of type CV_8S. Directly casting these 1-byte integer arrays to float* causes memory misinterpretation (garbage values). This drops the bounding box scores near zero, causing them to be filtered out by the scoreThreshold.
I have fixed this by safely casting the tensors to CV_32F using cv::Mat::convertTo() before applying the float pointers. I have tested it locally and it successfully detects faces with the INT8 model now.
I have submitted a Pull Request with the fix here: #28806
Please take a look. Thank you!
Activity
asmorkalov commentedon Apr 13, 2026
@abhishek-gola Could you take a look?
asmorkalov commentedon Apr 13, 2026
The same behaviour with 4.x branch.
Muhammad-Kamran-Khan commentedon Apr 13, 2026
Hi everyone,
I have investigated this issue and found the root cause. The problem occurs in modules/objdetect/src/face_detect.cpp during the postProcess step.
When using the INT8 quantized model, the output tensors are of type CV_8S. Directly casting these 1-byte integer arrays to float* causes memory misinterpretation (garbage values). This drops the bounding box scores near zero, causing them to be filtered out by the scoreThreshold.
I have fixed this by safely casting the tensors to CV_32F using cv::Mat::convertTo() before applying the float pointers. I have tested it locally and it successfully detects faces with the INT8 model now.
I have submitted a Pull Request with the fix here: #28806
Please take a look. Thank you!
5usu commentedon May 2, 2026
I'll be opening a good PR for this in the next couple of days @asmorkalov
5usu commentedon May 2, 2026
check this out #28920 @asmorkalov @abhishek-gola
Merge pull request #28920 from 5usu:fix/28798-yunet-int8-objbranch
Merge pull request opencv#28920 from 5usu:fix/28798-yunet-int8-objbranch