vitis::ai::FaceLandmark - 3.5 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2023-06-29
Version
3.5 English
Base class for detecting five key points, and the score from a face image (cv::Mat).

Input a face image (cv::Mat).

Output score, five key points of the face.

Sample code:

Note: Usually the input image contains only one face. When it contains multiple faces, the function returns the highest score.
cv:Mat image = cv::imread("sample_facelandmark.jpg");
auto landmark  = vitis::ai::FaceLandmark::create("face_landmark");
auto result = landmark->run(image);
float score = result.score;
auto points = result.points;
for(int i = 0; i< 5 ; ++i){
    auto x = points[i].frist  * image.cols;
    auto y = points[i].second * image.rows;
}

Display of the model results:

Figure 1. result image
result image

Quick Function Reference

The following table lists all the functions defined in the vitis::ai::FaceLandmark class:

Table 1. Quick Function Reference
Type Member Arguments
std::unique_ptr< FaceLandmark > create
  • const std::string & model_name
  • bool need_preprocess
std::unique_ptr< FaceLandmark > create
  • const std::string & model_name
  • xir::Attrs * attrs
  • bool need_preprocess
int getInputWidth
  • void
int getInputHeight
  • void
size_t get_input_batch
  • void
FaceLandmarkResult run
  • const cv::Mat & input_image
std::vector< FaceLandmarkResult > run
  • const std::vector< cv::Mat > & input_images