vitis::ai::FaceQuality5pt
Input is a face image (cv::Mat).
Output is the quality and five key points coordinate of a face in the input image.
Sample code :
Display of the FaceQuality5pt
model results:
cv:Mat image = cv::imread("sample_facequality5pt.jpg");
auto network =
vitis::ai::FaceQuality5pt::create("face-quality", true);
auto result = network->run(image);
auto quality = result.score;
auto points = result.points;
for(int i = 0; i< 5 ; ++i){
auto x = points[i].frist * image.cols;
auto y = points[j].second * image.rows;
}
network->setMode(vitis::ai::FaceQuality5pt::Mode::NIGHT);
Quick Function Reference
The following table lists all the functions defined in the vitis::ai::FaceQuality5pt
class:
Type | Name | Arguments |
---|---|---|
std::unique_ptr< FaceQuality5pt > | create |
|
int | getInputWidth |
|
int | getInputHeight |
|
size_t | get_input_batch |
|
Mode | getMode |
|
void | setMode |
|
FaceQuality5ptResult | run |
|
std::vector< FaceQuality5ptResult > | run |
|
create
Factory function to get an instance of derived classes of class FaceQuality5pt
.
Prototype
std::unique_ptr< FaceQuality5pt
> create(const std::string &model_name, bool need_preprocess=true);
Parameters
The following table lists the create
function arguments.
Type | Name | Description |
---|---|---|
const std::string & | model_name | Model name |
bool | need_preprocess | Normalize with mean/scale or not, default value is true. |
Returns
An instance ofFaceQuality5pt
class. getInputWidth
Function to get InputWidth of the facequality5pt network (input image columns).
Prototype
int getInputWidth() const =0;
Returns
InputWidth of the facequality5pt network.getInputHeight
Function to get InputHeight of the facequality5pt network (input image rows).
Prototype
int getInputHeight() const =0;
Returns
InputHeight of facequality5pt network.get_input_batch
Function to get the number of images processed by the DPU at one time.
Prototype
size_t get_input_batch() const =0;
Returns
Batch size.getMode
Function to get Mode.
Prototype
Mode
getMode()=0;
setMode
Function to set Mode.
Prototype
void setMode(Mode mode)=0;
Parameters
The following table lists the setMode
function arguments.
Type | Name | Description |
---|---|---|
Mode
|
mode | Type::Mode |
Returns
moderun
Function of get running result of the facequality5pt network.
Prototype
FaceQuality5ptResult
run(const cv::Mat &img)=0;
Parameters
The following table lists the run
function arguments.
Type | Name | Description |
---|---|---|
const cv::Mat & | img | Input data of input image (cv::Mat) of detected counterpart and resized to InputWidth and InputHeight required by the network. |
Returns
The result of the facequality5pt network.run
Function of get running results of the facequality5pt network in batch mode.
Prototype
std::vector< FaceQuality5ptResult
> run(const std::vector< cv::Mat > &images)=0;
Parameters
The following table lists the run
function arguments.
Type | Name | Description |
---|---|---|
const std::vector< cv::Mat > & | images | Input data of input images (std::vector<cv::Mat>). The size of input images equals batch size obtained by get_input_batch. The input images need to be resized to InputWidth and InputHeight required by the network. |
Returns
The vector of theFaceQuality5ptResult
. Enumeration Mode
Value | Description |
---|---|
DAY | Use DAY when the background of the image is daytime. |
NIGHT | Use NIGHT when the background of the image is night. |