VART-X  0.3.0
vart::PreProcess Class Reference

The preprocessing module handles data preparation tasks such as normalization, scaling, and video format conversion. This module supports software-based pre-processing as well as hardware-accelerated pre-processing for optimized performance. It ensures that input data is appropriately formatted for inference. Applications can also supply a custom pre-processing implementation via the PreProcessImplBase constructor. More...

#include <vart_preprocess.hpp>

Public Member Functions

 PreProcess ()=delete
 
 PreProcess (PreProcessImplType type, std::string &json_data, std::shared_ptr< Device > device)
 PreProcess() - Constructor with implementation type and json data. More...
 
 PreProcess (std::shared_ptr< PreProcessImplBase > ptr)
 PreProcess() - Constructor for using user defined implementation. More...
 
 ~PreProcess ()=default
 
void process (std::vector< PreProcessOp > &preprocess_ops)
 process() - Perform pre-processing based on the specified parameters. More...
 
void get_input_vinfo (int32_t height, int32_t width, VideoFormat fmt, VideoInfo &vinfo)
 get_input_vinfo() - Fills the input video info from input params. More...
 
const VideoInfoget_output_vinfo ()
 get_output_vinfo() - Get the output video info. More...
 
void set_preprocess_info (PreProcessInfo &preprocess_info)
 set_preprocess_info() - Set the required Preprocess parameters. More...
 
const PreProcessInfoget_preprocess_info ()
 get_preprocess_info() - Get the preprocess info More...
 
const std::shared_ptr< PreProcessImplBase > & get_pimpl_handle () const
 get_pimpl_handle() - Returns the underlying implementation handle. More...
 

Detailed Description

The preprocessing module handles data preparation tasks such as normalization, scaling, and video format conversion. This module supports software-based pre-processing as well as hardware-accelerated pre-processing for optimized performance. It ensures that input data is appropriately formatted for inference. Applications can also supply a custom pre-processing implementation via the PreProcessImplBase constructor.

See also
PreProcessImplBase

Constructor & Destructor Documentation

◆ PreProcess() [1/3]

vart::PreProcess::PreProcess ( )
delete

◆ PreProcess() [2/3]

vart::PreProcess::PreProcess ( PreProcessImplType  type,
std::string &  json_data,
std::shared_ptr< Device device 
)

PreProcess() - Constructor with implementation type and json data.

Parameters
[in]typePreProcessImplType based on which implementation need to be used.
See also
PreProcessImplType for currently supported implementations.
Parameters
[in]json_dataJSON-formatted configuration or additional user data passed to the implementation.
[in]deviceDevice handle, must be non-null. See vart::Device for more details.

◆ PreProcess() [3/3]

vart::PreProcess::PreProcess ( std::shared_ptr< PreProcessImplBase ptr)

PreProcess() - Constructor for using user defined implementation.

Parameters
[in]ptrPointer to user's implementation instance

◆ ~PreProcess()

vart::PreProcess::~PreProcess ( )
default

Member Function Documentation

◆ get_input_vinfo()

void vart::PreProcess::get_input_vinfo ( int32_t  height,
int32_t  width,
VideoFormat  fmt,
VideoInfo vinfo 
)

get_input_vinfo() - Fills the input video info from input params.

Parameters
[in]heightHeight of the input frame.
[in]widthWidth of the input frame.
[in]fmtVideo format of the input frame.
[out]vinfoVideoInfo to be filled by this API. The filled VideoInfo can be used to construct the input VideoFrame. User must provide a valid reference.
Note
Throws std::runtime_error if:
  • height or width is outside the supported range.
  • fmt is not a supported input colour format.

◆ get_output_vinfo()

const VideoInfo& vart::PreProcess::get_output_vinfo ( )

get_output_vinfo() - Get the output video info.

Returns
The output VideoInfo describing the format and dimensions of the pre-processed output frame. Can be used to construct the output VideoFrame.

◆ get_pimpl_handle()

const std::shared_ptr<PreProcessImplBase>& vart::PreProcess::get_pimpl_handle ( ) const

get_pimpl_handle() - Returns the underlying implementation handle.

Returns
A shared pointer to the PreProcessImplBase implementation instance.

◆ get_preprocess_info()

const PreProcessInfo& vart::PreProcess::get_preprocess_info ( )

get_preprocess_info() - Get the preprocess info

Returns
Returns structure of pre-processing parameters.

◆ process()

void vart::PreProcess::process ( std::vector< PreProcessOp > &  preprocess_ops)

process() - Perform pre-processing based on the specified parameters.

Parameters
[in]preprocess_opsVector of PreProcessOp to be performed. PreProcessOp contains input/output frame and their corresponding ROI.
Note
Throws std::runtime_error if:

◆ set_preprocess_info()

void vart::PreProcess::set_preprocess_info ( PreProcessInfo preprocess_info)

set_preprocess_info() - Set the required Preprocess parameters.

Parameters
[in]preprocess_infoStructure with pre-processing parameters to validate and store.
Note
Throws std::runtime_error if any of the following constraints are violated:
  • height or width is outside the supported range.
  • colour_format is not a supported output colour format.
  • mean_r, mean_g, or mean_b is outside [0.0, 128.0].
  • scale_r, scale_g, or scale_b is outside [0.0, 1.0].

The documentation for this class was generated from the following file: