Skip to content

Added buffer-based model loading to FaceRecognizerSF#26278

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
Quantizs:feature-create-face-recognizer-from-buffer
Oct 10, 2024
Merged

Added buffer-based model loading to FaceRecognizerSF#26278
asmorkalov merged 1 commit intoopencv:4.xfrom
Quantizs:feature-create-face-recognizer-from-buffer

Conversation

@Quantizs
Copy link
Copy Markdown
Contributor

@Quantizs Quantizs commented Oct 9, 2024

  • Implemented a new create method in FaceRecognizerSF to allow model and configuration loading from memory buffers (std::vector), similar to the existing functionality in FaceDetectorYN.
  • Updated face_recognize.cpp with a new constructor in FaceRecognizerSFImpl that supports buffer-based loading for both model weights and network configuration.
  • Ensured compatibility with both file-based and buffer-based model loading by maintaining consistent backend and target settings across both constructors.
  • This change improves flexibility, allowing FaceRecognizerSF to be instantiated from memory buffers, which is useful for dynamic model loading scenarios such as embedded systems or applications where models are loaded in-memory.

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

- Implemented a new `create` method in `FaceRecognizerSF` to allow model and configuration loading from memory buffers (std::vector<uchar>), similar to the existing functionality in `FaceDetectorYN`.
- Updated `face_recognize.cpp` with a new constructor in `FaceRecognizerSFImpl` that supports buffer-based loading for both model weights and network configuration.
- Ensured compatibility with both file-based and buffer-based model loading by maintaining consistent backend and target settings across both constructors.
- This change improves flexibility, allowing FaceRecognizerSF to be instantiated from memory buffers, which is useful for dynamic model loading scenarios such as embedded systems or applications where models are loaded in-memory.
@asmorkalov asmorkalov self-requested a review October 10, 2024 14:11
@asmorkalov asmorkalov added this to the 4.11.0 milestone Oct 10, 2024
@asmorkalov asmorkalov merged commit 0f23420 into opencv:4.x Oct 10, 2024
@asmorkalov asmorkalov self-assigned this Oct 10, 2024
@asmorkalov asmorkalov mentioned this pull request Oct 23, 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.

2 participants