vitis::ai::PoseDetect

Base class for detecting a pose from an input image (cv::Mat).

Input an image (cv::Mat).

Note: Support detect a single pose.

Output is a struct of PoseDetectResult, include 14 point.

Sample code:

auto det = vitis::ai::PoseDetect::create("sp_net");
auto image = cv::imread("sample_posedetect.jpg");
auto results = det->run(image);
for(auto result: results.pose14pt) {
    std::cout << result << std::endl;
}

Display of the posedetect model results:

Figure 1: pose detect image

Image sample_posedetect_result.jpg

Quick Function Reference

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

Table 1. Quick Function Reference
TypeNameArguments
std::unique_ptr< PoseDetect >create
  • const std::string & model_name
  • bool need_preprocess
intgetInputWidth
  • void
intgetInputHeight
  • void
size_tget_input_batch
  • void
PoseDetectResultrun
  • const cv::Mat & image
std::vector< PoseDetectResult >run
  • const std::vector< cv::Mat > & images

create

Factory function to get an instance of derived classes of class PoseDetect.

Prototype

std::unique_ptr< PoseDetect > create(const std::string &model_name, bool need_preprocess=true);

Parameters

The following table lists the create function arguments.

Table 2. create 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 of PoseDetect class.

getInputWidth

Function to get InputWidth of the PoseDetect network (input image columns).

Prototype

int getInputWidth() const =0;

Returns

InputWidth of the PoseDetect network.

getInputHeight

Function to get InputHeight of the PoseDetect network (input image rows).

Prototype

int getInputHeight() const =0;

Returns

InputHeight of the PoseDetect network.

get_input_batch

Function to get the number of images processed by the DPU at one time.

Note: Different DPU core the batch size may be different. This depends on the IP used.

Prototype

size_t get_input_batch() const =0;

Returns

Batch size.

run

Function to get running results of the posedetect neuron network.

Prototype


            PoseDetectResult run(const cv::Mat &image)=0;

Parameters

The following table lists the run function arguments.

Table 3. run Arguments
Type Name Description
const cv::Mat & image Input data of input image (cv::Mat).

Returns

PoseDetectResult.

run

Function to get running results of the posedetect neuron network in batch mode.

Prototype

std::vector< PoseDetectResult > run(const std::vector< cv::Mat > &images)=0;

Parameters

The following table lists the run function arguments.

Table 4. run 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.

Returns

The vector of PoseDetectResult.