Skip to content

Simple FaceDetectorYN speedup by pre-culling face bboxes? #25056

@wingman-jr-addon

Description

@wingman-jr-addon

Describe the feature and motivation

While reviewing FaceDetectorYNImpl::postProcess to see how it worked, I noticed that the scoreThreshold is only used to cull faces in the non-maximum suppression call late in the function. I think an opportunity exists to just not add the box unless it meets the scoreThreshold around this line of code as dnn::NMSBoxes does that anyways later:

float score = std::sqrt(cls_score * obj_score);

If I understand correctly, this would be a helpful advantage because there are typically many 1000's of raw face boxes but after thresholding on the score it could often drop to well below 100, which would help with a few things: dynamic memory allocation up front, reduced copies to faceBoxes, and reduced input to dnn::NMSBoxes.

Does this seem reasonable or am I missing something important about how it works?

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions