vitis::ai::FaceDetect - 2.0 English

Vitis AI Library User Guide (UG1354)

Document ID
UG1354
Release Date
2022-01-20
Version
2.0 English
Base class for detecting the position of faces in the input image (cv::Mat).

Input is an image (cv::Mat).

Output is a vector of position and score for faces in the input image.

Sample code:

auto image = cv::imread("sample_facedetect.jpg");
auto network = vitis::ai::FaceDetect::create(
               "densebox_640_360",
               true);
auto result = network->run(image);
for (const auto &r : result.rects) {
   auto score = r.score;
   auto x = r.x * image.cols;
   auto y = r.y * image.rows;
   auto width = r.width * image.cols;
   auto height = r.height * image.rows;
}

Display of the model results: width=\textwidth

Figure 1. result image
Image sample_facedetect_result.jpg

Quick Function Reference

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

Table 1. Quick Function Reference
Type Name Arguments
std::unique_ptr< FaceDetect > create
  • const std::string & model_name
  • bool need_preprocess
std::unique_ptr< FaceDetect > create
  • void
float getThreshold
  • void
void setThreshold
  • float threshold
FaceDetectResult run
  • const cv::Mat & img
std::vector< FaceDetectResult > run
  • const std::vector< cv::Mat > & imgs
std::vector< FaceDetectResult > run
  • const std::vector< vart::xrt_bo_t > & input_bos