// Copyright (C) 2018-2024 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #pragma once #include #include #include #include #include "cnn.hpp" #include "detector.hpp" enum class RegistrationStatus { SUCCESS, FAILURE_LOW_QUALITY, FAILURE_NOT_DETECTED, }; struct GalleryObject { std::vector embeddings; std::string label; int id; GalleryObject(const std::vector& embeddings, const std::string& label, int id) : embeddings(embeddings), label(label), id(id) {} }; class EmbeddingsGallery { public: static const char unknown_label[]; static const int unknown_id; EmbeddingsGallery(const std::string& ids_list, double threshold, int min_size_fr, bool crop_gallery, const detection::DetectorConfig& detector_config, VectorCNN& landmarks_det, VectorCNN& image_reid, bool use_greedy_matcher=false); size_t size() const; std::vector GetIDsByEmbeddings(const std::vector& embeddings) const; std::string GetLabelByID(int id) const; std::vector GetIDToLabelMap() const; bool LabelExists(const std::string& label) const; private: RegistrationStatus RegisterIdentity(const std::string& identity_label, const cv::Mat& image, int min_size_fr, bool crop_gallery, detection::FaceDetection& detector, VectorCNN& landmarks_det, VectorCNN& image_reid, cv::Mat& embedding); std::vector idx_to_id; double reid_threshold; std::vector identities; bool use_greedy_matcher; }; void AlignFaces(std::vector* face_images, std::vector* landmarks_vec);