NVIDIA DeepStream SDK API Reference

6.4 Release
gstnvinferserver Namespace Reference

Data Structures

class  GstNvInferServerImpl
 Class of the nvinferserver element implementation. More...
 
struct  GstNvInferServerObjectHistory
 Holds the inference information/history for one object based on its tracking ID. More...
 
struct  GstNvInferServerProperties
 Holds the configuration information from the nvinferserver element properties. More...
 
struct  GstNvInferServerSourceInfo
 Holds information about the detected objects in the specific input source. More...
 

Typedefs

using SharedObjHistory = std::shared_ptr< GstNvInferServerObjectHistory >
 
using WeakObjHistory = std::weak_ptr< GstNvInferServerObjectHistory >
 
typedef std::unordered_map< uint64_t, SharedObjHistoryGstNvInferServerObjectHistoryMap
 Map for maintaining inference history for objects based on their tracking ids: Object ID : Object History. More...
 
using RawOutputCallback = std::function< void(void *, NvDsInferNetworkInfo &, NvDsInferLayerInfo *, uint32_t, uint32_t)>
 Function for raw output callback . More...
 

Functions

void attachDetectionMetadata (NvDsFrameMeta *frameMeta, NvDsObjectMeta *parentObj, const NvDsInferDetectionOutput &detection_output, float scaleX, float scaleY, uint32_t offsetLeft, uint32_t offsetTop, uint32_t roiLeft, uint32_t roiTop, uint32_t roiWidth, uint32_t roiHeight, uint32_t imageWidth, uint32_t imageHeight, uint32_t uniqueId, const ic::PluginControl &config)
 Attach detection metadata for the objects in a frame. More...
 
void attachClassificationMetadata (NvDsObjectMeta *objMeta, NvDsFrameMeta *frameMeta, NvDsRoiMeta *roiMeta, const InferClassificationOutput &objInfo, uint32_t uniqueId, const std::string &classifierType, uint32_t imageWidth, uint32_t imageHeight)
 Attach the classification output as NvDsClassifierMeta. More...
 
void mergeClassificationOutput (InferClassificationOutput &cache, const InferClassificationOutput &newRes)
 Merge the object history with the new classification result. More...
 
void attachSegmentationMetadata (NvDsObjectMeta *objMeta, NvDsFrameMeta *frameMeta, NvDsRoiMeta *roiMeta, const NvDsInferSegmentationOutput &segmentation_output, dsis::SharedIBatchBuffer &buf)
 Attach the segmentation output as user metadata. More...
 
void attachTensorOutputMeta (NvDsObjectMeta *objMeta, NvDsFrameMeta *frameMeta, NvDsRoiMeta *roiMeta, uint32_t uniqueId, const std::vector< dsis::SharedIBatchBuffer > &tensors, uint32_t batchIdx, const NvDsInferNetworkInfo &inputInfo, bool maintainAspectRatio)
 Attaches the raw tensor output to the GstBuffer as metadata. More...
 
void attachFullTensorOutputMeta (NvDsBatchMeta *batchMeta, uint32_t uniqueId, const std::vector< dsis::SharedIBatchBuffer > &tensors, const NvDsInferNetworkInfo &inputInfo)
 Attach the full inference output tensors to the batch metadata. More...
 

Typedef Documentation

◆ GstNvInferServerObjectHistoryMap

Map for maintaining inference history for objects based on their tracking ids: Object ID : Object History.

Definition at line 97 of file gstnvinferserver_impl.h.

◆ RawOutputCallback

using gstnvinferserver::RawOutputCallback = typedef std::function<void(void *, NvDsInferNetworkInfo&, NvDsInferLayerInfo*, uint32_t, uint32_t)>

Function for raw output callback .

Function for raw output callback (void *gstBuf, NvDsInferNetworkInfo *network_info, NvDsInferLayerInfo *layers_info, uint32_t num_layers, uint32_t batch_size)

Definition at line 135 of file gstnvinferserver_impl.h.

◆ SharedObjHistory

Definition at line 90 of file gstnvinferserver_impl.h.

◆ WeakObjHistory

Definition at line 91 of file gstnvinferserver_impl.h.

Function Documentation

◆ attachClassificationMetadata()

void gstnvinferserver::attachClassificationMetadata ( NvDsObjectMeta objMeta,
NvDsFrameMeta frameMeta,
NvDsRoiMeta roiMeta,
const InferClassificationOutput &  objInfo,
uint32_t  uniqueId,
const std::string &  classifierType,
uint32_t  imageWidth,
uint32_t  imageHeight 
)

Attach the classification output as NvDsClassifierMeta.

This functions creates a new metadata of the type NvDsClassifierMeta and attaches it to the object metadata or ROI metadata. If processing on full frames, a new object metadata is created and attached. The display text for the object metadata is updated base on the label in the classification result.

Parameters
[in,out]objMetaPointer to the object metadata of the inference input.
[in,out]frameMetaPointer to the frame metadata of the inference input.
[in,out]roiMetaPointer to the ROI metadata for the inference input.
[in]objInfoThe classification output from the inference context.
[in]uniqueIdUnique ID of the GIE instance.
[in]classifierTypeThe classifier type of the nvinferserver element.
[in]imageWidthThe frame width used as bounding box size when inferencing on full frames.
[in]imageHeightThe frame height used as bounding box size when inferencing on full frames.

◆ attachDetectionMetadata()

void gstnvinferserver::attachDetectionMetadata ( NvDsFrameMeta frameMeta,
NvDsObjectMeta parentObj,
const NvDsInferDetectionOutput detection_output,
float  scaleX,
float  scaleY,
uint32_t  offsetLeft,
uint32_t  offsetTop,
uint32_t  roiLeft,
uint32_t  roiTop,
uint32_t  roiWidth,
uint32_t  roiHeight,
uint32_t  imageWidth,
uint32_t  imageHeight,
uint32_t  uniqueId,
const ic::PluginControl &  config 
)

Attach detection metadata for the objects in a frame.

This function attaches metadata for the objects detected in a frame. It adds a new object metadata, NvDsObjectMeta, to the metadata of the input frame. The bounding box parameters of the detected objects are scaled and shifted as per the actual frame dimensions using the provided scale and offset values.

Parameters
[in,out]frameMetaPointer to the NvDSFrameMeta structure for the frame.
[in]parentObjPointer to the NvDsObjMeta structure for the parent object under inference. It is NULL in case of primary detector.
[in]detection_outputThe detection output from the inference context.
[in]scaleXHorizontal scaling ratio that was applied to the input to get network input dimensions.
[in]scaleYvertical scaling ratio that was applied to the input to get network input dimensions.
[in]offsetLeftLeft offset corresponding to the left padding applied to the scaled input.
[in]offsetTopTop offset corresponding to the top padding added to the scaled input.
[in]roiLeftLeft pixel coordinate of the input ROI in the parent frame.
[in]roiTopTop pixel coordinate of the input ROI in the parent frame.
[in]roiWidthWidth of the ROI in the parent frame.
[in]roiHeightHeight of the ROI in the parent frame.
[in]imageWidthWidth of the frames in the input batch buffer.
[in]imageHeightHeight of the frames in the input batch buffer.
[in]uniqueIdUnique ID of the GIE instance.
[in]configThe configuration settings used for the GStreamer element.

◆ attachFullTensorOutputMeta()

void gstnvinferserver::attachFullTensorOutputMeta ( NvDsBatchMeta batchMeta,
uint32_t  uniqueId,
const std::vector< dsis::SharedIBatchBuffer > &  tensors,
const NvDsInferNetworkInfo inputInfo 
)

Attach the full inference output tensors to the batch metadata.

This functions attaches the output tensors for the entire batch as a user metadata of type NVDSINFER_TENSOR_OUTPUT_META.

Parameters
[in,out]batchMetaPointer to the bach metadata of the inference input.
[in]uniqueIdUnique ID of the GIE instance.
[in]tensorsThe batch buffer array of the output tensors.
[in]inputInfoDimensions of the input layer for the network.

◆ attachSegmentationMetadata()

void gstnvinferserver::attachSegmentationMetadata ( NvDsObjectMeta objMeta,
NvDsFrameMeta frameMeta,
NvDsRoiMeta roiMeta,
const NvDsInferSegmentationOutput segmentation_output,
dsis::SharedIBatchBuffer buf 
)

Attach the segmentation output as user metadata.

This function adds the segmentation output as user metadata of the input buffer. The function adds the user metadata to the ROI metadata if present. Otherwise, if object metadata is present, the user data is added to object metadata. Otherwise it is added to the frame metadata.

Parameters
[in,out]objMetaPointer to the object metadata of the inference input.
[in,out]frameMetaPointer to the frame metadata of the inference input.
[in,out]roiMetaPointer to the ROI metadata for the inference input.
[in]segmentation_outputThe segmentation output from the inference context.
[in]bufPointer to the batch buffer containing the segmentation output. This is saved as the priv_data in the user metadata.

◆ attachTensorOutputMeta()

void gstnvinferserver::attachTensorOutputMeta ( NvDsObjectMeta objMeta,
NvDsFrameMeta frameMeta,
NvDsRoiMeta roiMeta,
uint32_t  uniqueId,
const std::vector< dsis::SharedIBatchBuffer > &  tensors,
uint32_t  batchIdx,
const NvDsInferNetworkInfo inputInfo,
bool  maintainAspectRatio 
)

Attaches the raw tensor output to the GstBuffer as metadata.

This function attaches the output tensors for each frame in the input batch to the correspoinding ROI metadata or or object metadata or frame metadata.

Parameters
[in,out]objMetaPointer to the object metadata of the inference input.
[in,out]frameMetaPointer to the frame metadata of the inference input.
[in,out]roiMetaPointer to the ROI metadata for the inference input.
[in]uniqueIdUnique ID of the GIE instance.
[in]tensorsThe batch buffer array of the output tensors.
[in]batchIdxIndex of the frame within the inference batch.
[in]inputInfoDimensions of the input layer for the network.
[in]maintainAspectRatiomaintain_aspect_ratio configuration setting value.

◆ mergeClassificationOutput()

void gstnvinferserver::mergeClassificationOutput ( InferClassificationOutput &  cache,
const InferClassificationOutput &  newRes 
)

Merge the object history with the new classification result.

Given an object history, merge the new classification results with the previous cached results. This can be used to improve the results of classification when re-inferencing over time. Currently, the function just uses the latest results.

Parameters
[in,out]cacheThe cached classification output in the object history.
[in]newResNew classification output for the object.