vitis::ai::MultiTask
number of classes label: 0 name: "background" label: 1 name: "person" label: 2 name: "car" label: 3 name: "truck" label: 4 name: "bus" label: 5 name: "bike" label: 6 name: "sign" label: 7 name: "light"
Base class for ADAS MuiltTask from an image (cv::Mat).
Input an image (cv::Mat).
Output is a struct of MultiTaskResult
include segmentation results, detection results and vehicle towards;
Sample code:
auto det = vitis::ai::MultiTask::create("multi_task");
auto image = cv::imread("sample_multitask.jpg");
auto result = det->run_8UC3(image);
cv::imwrite("sample_multitask_result.jpg",result.segmentation);
Display of the model results:
Quick Function Reference
The following table lists all the functions defined in the vitis::ai::MultiTask
class:
Type | Name | Arguments |
---|---|---|
std::unique_ptr< MultiTask > | create |
|
int | getInputWidth |
|
int | getInputHeight |
|
size_t | get_input_batch |
|
MultiTaskResult | run_8UC1 |
|
std::vector< MultiTaskResult > | run_8UC1 |
|
MultiTaskResult | run_8UC3 |
|
std::vector< MultiTaskResult > | run_8UC3 |
|
create
Factory function to get an instance of derived classes of class Multitask.
Prototype
std::unique_ptr< MultiTask
> 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 of Multitask class.getInputWidth
Function to get InputWidth of the multitask network (input image columns).
Prototype
int getInputWidth() const =0;
Returns
InputWidth of the multitask network.getInputHeight
Function to get InputHeight of the multitask network (input image rows).
Prototype
int getInputHeight() const =0;
Returns
InputHeight of the multitask 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.run_8UC1
Function of get running result from the MultiTask
network.
MultiTaskResult.segmentation
. Prototype
MultiTaskResult
run_8UC1(const cv::Mat &image)=0;
Parameters
The following table lists the run_8UC1
function arguments.
Type | Name | Description |
---|---|---|
const cv::Mat & | image | Input image |
Returns
The struct ofMultiTaskResult
run_8UC1
Function to get running results of the MultiTask
neuron network in batch mode.
MultiTaskResult.segmentation
.Prototype
std::vector< MultiTaskResult
> run_8UC1(const std::vector< cv::Mat > &images)=0;
Parameters
The following table lists the run_8UC1
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. |
Returns
The vector ofMultiTaskResult
. run_8UC3
Function to get running result from the MultiTask
network.
MultiTaskResult.segmentation
. Prototype
MultiTaskResult
run_8UC3(const cv::Mat &image)=0;
Parameters
The following table lists the run_8UC3
function arguments.
Type | Name | Description |
---|---|---|
const cv::Mat & | image | Input image; |
Returns
The struct ofMultiTaskResult
run_8UC3
Function to get running results of the MultiTask
neuron network in batch mode.
MultiTaskResult.segmentation
.Prototype
std::vector< MultiTaskResult
> run_8UC3(const std::vector< cv::Mat > &images)=0;
Parameters
The following table lists the run_8UC3
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. |
Returns
The vector ofMultiTaskResult
.