Skip to content

face_detection_yunet_2023mar_int8.onnx model from zoo detects nothing with 5.x #28798

Closed

Description

@asmorkalov

System Information

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

Detailed description

Model file: https://github.com/opencv/opencv_zoo/blob/main/models/face_detection_yunet/face_detection_yunet_2023mar_int8.onnx

Steps to reproduce

python3 ./face_detect.py --face_detection_model ./face_detection_yunet_2023mar_int8.onnx

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Activity

  1. asmorkalov commented on Apr 13, 2026

    @asmorkalov
    ContributorAuthor

    @abhishek-gola Could you take a look?

  2. added this to the 5.0-release milestone on Apr 13, 2026
  3. asmorkalov commented on Apr 13, 2026

    @asmorkalov
    ContributorAuthor

    The same behaviour with 4.x branch.

  4. Muhammad-Kamran-Khan commented on Apr 13, 2026

    @Muhammad-Kamran-Khan

    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!

  5. 5usu commented on May 2, 2026

    @5usu
    Contributor

    I'll be opening a good PR for this in the next couple of days @asmorkalov

  6. 5usu commented on May 2, 2026

    @5usu
    Contributor
  7. added a commit that references this issue on May 25, 2026
  8. added a commit that references this issue on Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions