vitis::ai::PlateNum

Base class for recognizing plate from an image (cv::Mat).

Input is a plate image (cv::Mat).

Output is the number and color of plate in the input image.

sample code:

Note: Only China plate Only edge platform supported @endnote
cv::Mat image = cv::imread("plate.jpg");
auto network = vitis::ai::PlateNum::create(true);
auto r = network->run(image);
auto plate_number = r.plate_number;
auto plate_color = r.plate_color;

Quick Function Reference

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

Table 1. Quick Function Reference
TypeNameArguments
std::unique_ptr< PlateNum >create
  • bool need_mean_scale_process
std::unique_ptr< PlateNum >create
  • void
PlateNum
  • void
PlateNum
  • void
PlateNum &operator=
  • void
~PlateNum
  • void
intgetInputWidth
  • void
intgetInputHeight
  • void
size_tget_input_batch
  • void
PlateNumResultrun
  • const cv::Mat & img
std::vector< PlateNumResult >run
  • const std::vector< cv::Mat > & imgs

create

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

Prototype

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

Parameters

The following table lists the create function arguments.

Table 2. create Arguments
Type Name Description
bool need_mean_scale_process normalize with mean/scale or not, true by default.

Returns

An instance of PlateNum class.

create

Prototype

std::unique_ptr< PlateNum > create(const std::string &model_name, xir::Attrs *attrs, bool need_mean_scale_process=true);

PlateNum

Prototype

 PlateNum();

PlateNum

Prototype

 PlateNum(const PlateNum &)=delete;

operator=

Prototype


            PlateNum & operator=(const PlateNum &)=delete;

~PlateNum

Prototype

 ~PlateNum();

getInputWidth

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

Prototype

int getInputWidth() const =0;

Returns

InputWidth of the platenum network.

getInputHeight

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

Prototype

int getInputHeight() const =0;

Returns

InputHeight of the platenum 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 of get running result of platenum network.

Prototype


            PlateNumResult run(const cv::Mat &img)=0;

Parameters

The following table lists the run function arguments.

Table 3. run Arguments
Type Name Description
const cv::Mat & img Input data of input image (cv::Mat) and resized as InputWidth and IntputHeight.

Returns

The plate number and plate color.

run

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

Prototype

std::vector< PlateNumResult > run(const std::vector< cv::Mat > &imgs)=0;

Parameters

The following table lists the run function arguments.

Table 4. run Arguments
Type Name Description
const std::vector< cv::Mat > & imgs 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 PLateNumResult.