vitis::ai::FaceLandmark - 1.4 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2021-07-22
Version
1.4 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 functions 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
Image sample_facelandmark_result.jpg

Quick Function Reference

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

Table 1. Quick Function Reference
Type Name Arguments
std::unique_ptr< FaceLandmark > create
  • const std::string & model_name
  • bool need_preprocess
std::unique_ptr< FaceLandmark > create
  • void
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