vitis::ai::Rcan

Base class for detecting rcan from an image (cv::Mat).

Input is an image (cv::Mat).

Output is the enlarged image.

Sample code:

Note: The input image size is 640x360
if (argc < 2) {
  cerr << "usage: " << argv[0] << "  modelname  image_file_url " << endl;
  abort();
}
Mat input_img = imread(argv[2]);
if (input_img.empty()) {
  cerr << "can't load image! " << argv[2] << endl;
  return -1;
}
auto det = vitis::ai::Rcan::create(argv[1]);
Mat ret_img = det->run(input_img).feat;
imwrite("sample_rcan_result.png", ret_img);

Display of the model results:

Figure 1: result image

Image sample_rcan_result.png

Quick Function Reference

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

Table 1. Quick Function Reference
TypeNameArguments
std::unique_ptr< Rcan >create
  • const std::string & model_name
  • bool need_preprocess
RcanResultrun
  • const cv::Mat & image
std::vector< RcanResult >run
  • const std::vector< cv::Mat > & images
std::vector< RcanResult >run
  • const std::vector< vart::xrt_bo_t > & input_bos

create

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

Prototype

std::unique_ptr< Rcan > 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 Rcan class.

run

Function to get running result of the RCAN neuron network.

Prototype


            RcanResult 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

RcanResult.

run

Function to get running result of the RCAN neuron network in batch mode.

Prototype

std::vector< RcanResult > 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 (vector<cv::Mat>).

Returns

vector of RcanResult.

run

Function to get running results of the rcan neuron network in batch mode , used to receive user's xrt_bo to support zero copy.

Prototype

std::vector< RcanResult > run(const std::vector< vart::xrt_bo_t > &input_bos)=0;

Parameters

The following table lists the run function arguments.

Table 5. run Arguments
Type Name Description
const std::vector< vart::xrt_bo_t > & input_bos The vector of vart::xrt_bo_t.

Returns

The vector of RcanResult.