vitis::ai::Reid
Base class for getting feat from an image (cv::Mat).
Input is an image (cv::Mat).
Output image reid feat.
Sample code:
if(argc < 3){
cerr<<"need two images"<<endl;
return -1;
}
Mat imgx = imread(argv[1]);
if(imgx.empty()){
cerr<<"can't load image! "<<argv[1]<<endl;
return -1;
}
Mat imgy = imread(argv[2]);
if(imgy.empty()){
cerr<<"can't load image! "<<argv[2]<<endl;
return -1;
}
auto det = vitis::ai::Reid::create("reid");
Mat featx = det->run(imgx).feat;
Mat featy = det->run(imgy).feat;
double dismat= cosine_distance(featx, featy);
printf("dismat : %.3lf \n", dismat);
Quick Function Reference
The following table lists all the functions defined in the vitis::ai::Reid
class:
Type | Name | Arguments |
---|---|---|
std::unique_ptr< Reid > | create |
|
ReidResult | run |
|
std::vector< ReidResult > | run |
|
std::vector< ReidResult > | run |
|
create
Factory function to get an instance of derived classes of class Reid
.
Prototype
std::unique_ptr< Reid
> 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 ofReid
class. run
Function to get running result of the ReID neuron network.
Prototype
ReidResult
run(const cv::Mat &image)=0;
Parameters
The following table lists the run
function arguments.
Type | Name | Description |
---|---|---|
const cv::Mat & | image | Input data of input image (cv::Mat). |
Returns
ReidResult
. run
Function to get running result of the ReID neuron network in batch mode.
Prototype
std::vector< ReidResult
> 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 (vector<cv::Mat>). |
Returns
vector ofReidResult
. run
Function to get running results of the reid neuron network in batch mode , used to receive user's xrt_bo to support zero copy.
Prototype
std::vector< ReidResult
> run(const std::vector< vart::xrt_bo_t > &input_bos)=0;
Parameters
The following table lists the run
function arguments.
Type | Name | Description |
---|---|---|
const std::vector< vart::xrt_bo_t > & | input_bos | The vector of vart::xrt_bo_t. |
Returns
The vector ofReidResult
.