plugin  0.1.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AsyncPipeline Class Reference

#include <async_pipeline.h>

Collaboration diagram for AsyncPipeline:
Collaboration graph
[legend]

Public Member Functions

 AsyncPipeline (std::unique_ptr< ModelBase > &&modelInstance, const ModelConfig &config, ov::Core &core)
 
void waitForData (bool shouldKeepOrder=true)
 
bool isReadyToProcess ()
 
void waitForTotalCompletion ()
 
virtual int64_t submitData (const InputData &inputData, const std::shared_ptr< MetaData > &metaData)
 
virtual std::unique_ptr< ResultBasegetResult (bool shouldKeepOrder=true)
 
PerformanceMetrics getInferenceMetircs ()
 
PerformanceMetrics getPreprocessMetrics ()
 
PerformanceMetrics getPostprocessMetrics ()
 

Protected Member Functions

virtual InferenceResult getInferenceResult (bool shouldKeepOrder)
 

Protected Attributes

std::unique_ptr< RequestsPoolrequestsPool
 
std::unordered_map< int64_t, InferenceResultcompletedInferenceResults
 
ov::CompiledModel compiledModel
 
std::mutex mtx
 
std::condition_variable condVar
 
int64_t inputFrameId = 0
 
int64_t outputFrameId = 0
 
std::exception_ptr callbackException = nullptr
 
std::unique_ptr< ModelBasemodel
 
PerformanceMetrics inferenceMetrics
 
PerformanceMetrics preprocessMetrics
 
PerformanceMetrics postprocessMetrics
 

Detailed Description

This is base class for asynchronous pipeline Derived classes should add functions for data submission and output processing

Constructor & Destructor Documentation

◆ AsyncPipeline()

AsyncPipeline::AsyncPipeline ( std::unique_ptr< ModelBase > &&  modelInstance,
const ModelConfig config,
ov::Core &  core 
)

Loads model and performs required initialization

Parameters
modelInstancepointer to model object. Object it points to should not be destroyed manually after passing pointer to this function.
config- fine tuning configuration for model
core- reference to ov::Core instance to use. If it is omitted, new instance of ov::Core will be created inside.

Member Function Documentation

◆ getInferenceResult()

InferenceResult AsyncPipeline::getInferenceResult ( bool  shouldKeepOrder)
protectedvirtual

Returns processed result, if available

Parameters
shouldKeepOrderif true, function will return processed data sequentially, keeping original frames order (as they were submitted). Otherwise, function will return processed data in random order.
Returns
InferenceResult with processed information or empty InferenceResult (with negative frameID) if there's no any results yet.

◆ getResult()

std::unique_ptr< ResultBase > AsyncPipeline::getResult ( bool  shouldKeepOrder = true)
virtual

Gets available data from the queue

Parameters
shouldKeepOrderif true, function will treat results as ready only if next sequential result (frame) is ready (so results can be extracted in the same order as they were submitted). Otherwise, function will return if any result is ready.

◆ isReadyToProcess()

bool AsyncPipeline::isReadyToProcess ( )
inline
Returns
true if there's available infer requests in the pool and next frame can be submitted for processing, false otherwise.

◆ submitData()

int64_t AsyncPipeline::submitData ( const InputData inputData,
const std::shared_ptr< MetaData > &  metaData 
)
virtual

Submits data to the model for inference

Parameters
inputData- input data to be submitted
metaData- shared pointer to metadata container. Might be null. This pointer will be passed through pipeline and put to the final result structure.
Returns
-1 if image cannot be scheduled for processing (there's no free InferRequest available). Otherwise returns unique sequential frame ID for this particular request. Same frame ID will be written in the result structure.

◆ waitForData()

void AsyncPipeline::waitForData ( bool  shouldKeepOrder = true)

Waits until either output data becomes available or pipeline allows to submit more input data.

Parameters
shouldKeepOrderif true, function will treat results as ready only if next sequential result (frame) is ready (so results can be extracted in the same order as they were submitted). Otherwise, function will return if any result is ready.

◆ waitForTotalCompletion()

void AsyncPipeline::waitForTotalCompletion ( )
inline

Waits for all currently submitted requests to be completed.


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