Skip to content

Commit

Permalink
@93e277e4
Browse files Browse the repository at this point in the history
  • Loading branch information
ESP-YHY committed Nov 19, 2021
1 parent 859f32a commit a95b00e
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 21 deletions.
8 changes: 8 additions & 0 deletions include/model_zoo/face_recognition_tool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <algorithm>
#include <math.h>
#include <string>
#include "esp_partition.h"

/**
* @brief struct of face similarity
Expand Down Expand Up @@ -45,6 +46,13 @@ class FaceID
*/
FaceID(int id, dl::Tensor<feature_t> &id_emb, std::string name = "");

/**
* @brief Construct a new Face ID which is same as input face_id
*
* @param face_id input face_id
*/
FaceID(FaceID<feature_t> &face_id);

/**
* @brief Destroy the Face ID object
*
Expand Down
43 changes: 35 additions & 8 deletions include/model_zoo/face_recognizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class FaceRecognizer
* @param name name of the face id.
* @return int the face id index of the enrolled embedding.
*/
int enroll_id(uint16_t *image_input, std::vector<int> shape, std::vector<int> &landmarks, std::string name="");
int enroll_id(uint16_t *image_input, std::vector<int> shape, std::vector<int> &landmarks, std::string name="", bool update_flash = false);

/**
* @brief enroll face id
Expand All @@ -160,7 +160,7 @@ class FaceRecognizer
* @param name name of the face id.
* @return int the face id index of the enrolled embedding.
*/
int enroll_id(uint16_t *image_input, std::vector<int> shape, Tensor<uint8_t> &aligned_face, std::vector<int> &landmarks, std::string name="");
int enroll_id(uint16_t *image_input, std::vector<int> shape, Tensor<uint8_t> &aligned_face, std::vector<int> &landmarks, std::string name="", bool update_flash = false);

/**
* @brief enroll face id
Expand All @@ -170,7 +170,7 @@ class FaceRecognizer
* @param name name of the face id.
* @return int the face id index of the enrolled embedding.
*/
int enroll_id(Tensor<uint8_t> &image_input, std::vector<int> &landmarks, std::string name="");
int enroll_id(Tensor<uint8_t> &image_input, std::vector<int> &landmarks, std::string name="", bool update_flash = false);

/**
* @brief enroll face id
Expand All @@ -181,7 +181,7 @@ class FaceRecognizer
* @param name name of the face id.
* @return int the face id index of the enrolled embedding.
*/
int enroll_id(Tensor<uint8_t> &image_input, Tensor<uint8_t> &aligned_face, std::vector<int> &landmarks, std::string name="");
int enroll_id(Tensor<uint8_t> &image_input, Tensor<uint8_t> &aligned_face, std::vector<int> &landmarks, std::string name="", bool update_flash = false);

/**
* @brief enroll face id
Expand All @@ -190,7 +190,7 @@ class FaceRecognizer
* @param name name of the face id.
* @return int the face id index of the enrolled embedding.
*/
int enroll_id(Tensor<uint8_t> &aligned_face, std::string name="");
int enroll_id(Tensor<uint8_t> &aligned_face, std::string name="", bool update_flash = false);

/**
* @brief enroll the normalzied face embedding.
Expand All @@ -199,15 +199,15 @@ class FaceRecognizer
* @param name name of the face id.
* @return int the face id index of the enrolled embedding.
*/
int enroll_id(Tensor<float> &emb, std::string name="");
int enroll_id(Tensor<float> &emb, std::string name="", bool update_flash = false);

/**
* @brief delete the last enrolled face id.
*
* @return int the number of remained face ids.
* if the face ids list is empty, return -1
*/
int delete_id();
int delete_id(bool update_flash = false);

/**
* @brief delete the face id with id index.
Expand All @@ -216,5 +216,32 @@ class FaceRecognizer
* @return int the number of remained face ids.
* if there is no matched id return -1
*/
int delete_id(int id);
int delete_id(int id, bool update_flash = false);

int set_ids(std::vector<FaceID<float> *> &ids, bool update_flash = false);

int set_ids_from_flash();

int write_ids_to_flash();

std::vector<face_info_t> get_enrolled_ids_with_name(std::string name);

int check_partition();

/**
* @brief delete all the enrolled face ids.
*
*/
void clear_id(bool update_flash = false);

/**
* @brief Set the partition for saving face ids to flash or reading face ids from flash.
*
* @param type esp_partition_type
* @param subtype esp_partition_subtype
* @param label the partition label
* @return int the result of setting.
*/
int set_partition(esp_partition_type_t type, esp_partition_subtype_t subtype, const char *label);

};
Loading

0 comments on commit a95b00e

Please sign in to comment.