Base class for detecting the position,score and landmark 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_retinaface.jpg");
auto network = vitis::ai::RetinaFace::create
(
"retinaface",
true);
auto result = network->run(image);
for (auto i = 0u; i < result.bboxes.size(); ++i) {
auto score = result.bboxes[i].score;
auto x = result.bboxes[i].x * image.cols;
auto y = result.bboxes[i].y * image.rows;
auto width = result.bboxes[i].width * image.cols;
auto height = result.bboxes[i].height * image.rows;
auto landmark = results.landmarks[i];
for (auto j = 0; j < 5; ++j) {
auto px = landmark[j].first * image.cols;
auto py = landmark[j].second * image.rows;
}
}
Display of the model results:
Figure 1. result image
Quick Function Reference
The following table lists all the functions defined in the vitis::ai::RetinaFace
class:
Type | Name | Arguments |
---|---|---|
std::unique_ptr< RetinaFace > |
create |
|
std::unique_ptr< RetinaFace > |
create |
|
RetinaFaceResult
|
run |
|
std::vector< RetinaFaceResult > |
run |
|
std::vector< RetinaFaceResult > |
run |
|