VART-X  0.3.0
vart::PostProcess Class Reference

Interface class for post-processing inference results. More...

#include <vart_postprocess.hpp>

Public Member Functions

 PostProcess ()=delete
 
 PostProcess (PostProcessType postprocess_type, std::string &json_data, std::shared_ptr< Device > device)
 PostProcess() - Constructor for using existing post-process implementations. More...
 
 PostProcess (std::shared_ptr< PostProcessImplBase > ptr)
 PostProcess() - Constructor for using user defined implementation (Legacy) More...
 
 ~PostProcess ()
 
const std::shared_ptr< PostProcessImplBase > & get_pimpl_handle () const
 get_pimpl_handle() - Gives pointer to implementation class. More...
 
void set_config (std::vector< TensorInfo > &info, uint32_t batch_size)
 set_config() - Set PostProcessInfo config data before start doing the post-process. More...
 
std::vector< std::vector< std::shared_ptr< InferResult > > > process (std::vector< int8_t * > data, uint32_t current_batch_size)
 process() - Process/parse tensors data from ML network output to create infer results. More...
 
std::vector< std::vector< std::shared_ptr< InferResult > > > process (std::vector< std::vector< std::shared_ptr< vart::Memory >>> tensor_memory, uint32_t current_batch_size)
 process() - Process/parse tensors data from ML network output to create infer results. More...
 

Detailed Description

Interface class for post-processing inference results.

This module performs additional computations on output tensor data from NPU to generate more meaningful interpretation.

The framework supports two modes of operation:

  1. Legacy Mode: Supports YOLOv2, ResNet50, SSD-ResNet34 via PostProcessImplBase.
  2. Modular Framework: Supports a wide range of algorithms (Softmax, TopK, NMS, etc.) via PostProcessFunctionBase.

Users can integrate custom post-processing algorithms by inheriting from vart::PostProcessFunctionBase and selecting them through the modular PostProcessType dispatch performed inside the constructor (no external registration step is required at the public API level).

Please check API documentation on usage and additional information.

See also
PostProcessImplBase

Constructor & Destructor Documentation

◆ PostProcess() [1/3]

vart::PostProcess::PostProcess ( )
delete

◆ PostProcess() [2/3]

vart::PostProcess::PostProcess ( PostProcessType  postprocess_type,
std::string &  json_data,
std::shared_ptr< Device device 
)

PostProcess() - Constructor for using existing post-process implementations.

Parameters
[in]postprocess_type
See also
vart::PostProcessType for full list of supported legacy and modular types.
Parameters
[in]json_dataJSON config string based on the implementation class
[in]deviceDevice handle. Required by legacy backends as described above. May be null only when the selected postprocess_type does not need a device. See vart::Device for more details.

◆ PostProcess() [3/3]

vart::PostProcess::PostProcess ( std::shared_ptr< PostProcessImplBase ptr)

PostProcess() - Constructor for using user defined implementation (Legacy)

Parameters
[in]ptrPointer to user's implementation instance

◆ ~PostProcess()

vart::PostProcess::~PostProcess ( )

~PostProcess() - Destructor

Member Function Documentation

◆ get_pimpl_handle()

const std::shared_ptr<PostProcessImplBase>& vart::PostProcess::get_pimpl_handle ( ) const

get_pimpl_handle() - Gives pointer to implementation class.

Returns
Constant reference to the pimpl. Non-null only for legacy backends (RESNET50, YOLOV2, SSDRESNET34). For every modular PostProcessType value the returned pointer is empty (nullptr).

◆ process() [1/2]

std::vector<std::vector<std::shared_ptr<InferResult> > > vart::PostProcess::process ( std::vector< int8_t * >  data,
uint32_t  current_batch_size 
)

process() - Process/parse tensors data from ML network output to create infer results.

Parameters
[in]dataVector of tensors data. Each tensor will have the data for the entire batch of images.
[in]current_batch_sizeNumber of inputs in the current batch.
Returns
Vector of inference result objects for every image in the batch.
Note
If neither the legacy pimpl nor the modular backend is set (e.g. a null shared_ptr was injected via the pimpl constructor), this call silently returns an empty vector rather than throwing.
Pointer validity: each entry in data must point to a buffer large enough for the configured model, and data.size() must be at least current_batch_size (legacy paths) or current_batch_size * num_output_tensors (modular paths).

◆ process() [2/2]

std::vector<std::vector<std::shared_ptr<InferResult> > > vart::PostProcess::process ( std::vector< std::vector< std::shared_ptr< vart::Memory >>>  tensor_memory,
uint32_t  current_batch_size 
)

process() - Process/parse tensors data from ML network output to create infer results.

Parameters
[in]tensor_memoryOuter vector indexed by batch element, inner vector listing the output tensor buffers for that element. Must be non-empty, must contain at least current_batch_size rows, and every inner row must have the same length as tensor_memory[0] — the implementation indexes tensor_memory[0] for layout and does not re-validate per row.
[in]current_batch_sizeNumber of inputs in the current batch.
Returns
Vector of inference result objects for every image in the batch.
Note
If neither the legacy pimpl nor the modular backend is set, this call returns an empty vector rather than throwing. Legacy backends expect each Memory to be backed by MemoryImplVvas; modular backends call map() / unmap() on the public interface and emit a printPostProcessResult() log after execution.

◆ set_config()

void vart::PostProcess::set_config ( std::vector< TensorInfo > &  info,
uint32_t  batch_size 
)

set_config() - Set PostProcessInfo config data before start doing the post-process.

Parameters
[in]infoTensorInfo to be set.
[in]batch_sizeSupported batch size.

Use this method to set batch size per tensor and tensor information required to parse/process the ML network output. Call this method before the first call to "process" method.


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