Skip to content

Migrate Android Face Detection sample to DNN.#24599

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov:as/android_face_detect_dnn
Nov 30, 2023
Merged

Migrate Android Face Detection sample to DNN.#24599
asmorkalov merged 1 commit intoopencv:4.xfrom
asmorkalov:as/android_face_detect_dnn

Conversation

@asmorkalov
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov commented Nov 27, 2023

The PR replaces cascade-based face detector to DNN-based FaceDetectorYN.
Also the PR fixes/adds:

  • onnx model type handling in readNect with in-memory ONNX network;
  • Adds new FaceDetectorYN factory to use in-memory model;
  • Download face detector model with CMake during build.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov asmorkalov force-pushed the as/android_face_detect_dnn branch from ffd0ffd to feb5054 Compare November 27, 2023 12:51
@asmorkalov asmorkalov added this to the 4.9.0 milestone Nov 27, 2023
@asmorkalov asmorkalov requested review from alexlyulkov and fengyuentau and removed request for alexlyulkov November 28, 2023 07:09
@asmorkalov asmorkalov force-pushed the as/android_face_detect_dnn branch from feb5054 to 6929647 Compare November 28, 2023 07:12
Copy link
Copy Markdown
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dnn part looks good to me. Just a question.

@fengyuentau
Copy link
Copy Markdown
Member

There is a warning on doc:

/build/precommit_docs/4.x/opencv/modules/objdetect/include/opencv2/objdetect/face.hpp:99: warning: The following parameters of cv::FaceDetectorYN::create(const String &framework, const std::vector< uchar > &bufferModel, const std::vector< uchar > &bufferConfig, const Size &input_size, float score_threshold=0.9f, float nms_threshold=0.3f, int top_k=5000, int backend_id=0, int target_id=0) are not documented:

@asmorkalov asmorkalov force-pushed the as/android_face_detect_dnn branch from 6929647 to ce8400c Compare November 28, 2023 10:39
@asmorkalov asmorkalov requested a review from mshabunin November 28, 2023 10:40
@asmorkalov asmorkalov force-pushed the as/android_face_detect_dnn branch 3 times, most recently from 8686d11 to d3c93e2 Compare November 28, 2023 13:21
@asmorkalov asmorkalov force-pushed the as/android_face_detect_dnn branch from d3c93e2 to 7b1a5fb Compare November 29, 2023 08:03
inputW = input_size.width;
inputH = input_size.height;

padW = (int((inputW - 1) / divisor) + 1) * divisor;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

padW and padH names are confusing. Maybe rename them to paddedW or alignedW?

Copy link
Copy Markdown
Contributor

@AleksandrPanov AleksandrPanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything works 👍
image

@asmorkalov asmorkalov merged commit 21d5a41 into opencv:4.x Nov 30, 2023
@asmorkalov asmorkalov mentioned this pull request Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants