Tracker process class.
Definition at line 31 of file nvtracker_proc.h.
Data Structures | |
struct | ClassInfo |
Object class information. More... | |
struct | DispatchInfo |
Info corresponding to each sub-batch thread. More... | |
struct | DispatchReq |
Per-sub-batch dispatch to low-level tracker lib. More... | |
struct | ProcParams |
Tracker data submitted for proceeding. More... | |
struct | SourceRemoveInfo |
Source remove info. More... | |
struct | UpdateDynamicConfigInfo |
Update dynamic config info. More... | |
Public Member Functions | |
NvTrackerProc () | |
virtual | ~NvTrackerProc () |
virtual bool | init (const TrackerConfig &config) |
virtual void | deInit () |
virtual bool | addSource (uint32_t sourceId) |
Tracker actions when a source is added to the pipeline. More... | |
virtual bool | removeSource (uint32_t sourceId, bool removeObjectIdMapping=true) |
Tracker actions when a source is removed to the pipeline. More... | |
virtual bool | resetSource (uint32_t sourceId) |
Tracker actions when a source is reset. More... | |
virtual bool | submitInput (const InputParams &inputParams) |
Submit an input batch to tracker process queue. More... | |
virtual CompletionStatus | waitForCompletion (InputParams &inputParams) |
Wait until a batch's process is done. More... | |
virtual bool | flushReqs () |
Flush the request to send the batch downstream. More... | |
virtual bool | updateDynamicConfig (const std::string &configStr, uint32_t sourceId) |
Update the low-level tracker lib's config dynamically during runtime. More... | |
Protected Types | |
typedef uint32_t | BatchId |
Current batch ID. More... | |
typedef uint64_t | SurfaceStreamId |
Composition of unique ID for each surface from each source Some sources (e.g. More... | |
typedef uint32_t | StreamId |
Source stream ID. More... | |
typedef uint32_t | SurfaceId |
Surface type ID. More... | |
typedef uint32_t | SubBatchId |
sub-batch ID. More... | |
typedef uint32_t | SeqIndex |
Sequence index in a sub-batch. More... | |
Protected Member Functions | |
void | processSubBatch (DispatchInfo *pDispatchInfo) |
Function to pop sub-batch from queue, call low level lib to process and update meta data with tracking results for the sub-batch. More... | |
bool | dispatchSubBatches (ProcParams procParams) |
Function to create sub-batches from a batch and submit to corresponding sub-batch queues. More... | |
bool | mapStreamToSubBatch (SurfaceStreamId ssId, uint32_t pad_index, bool dynamicSubBatching) |
Fuction to map a stream with a specific (SurfaceStreamId, pad_index) to a sub-batch. More... | |
NvMOTContextHandle | initTrackerContext (uint32_t sbId=0) |
Internal initializing and release function. More... | |
bool | initConvBufPool () |
Initialize surface transform buffer pool. More... | |
void | deInitConvBufPool () |
Deinitialize surface transform buffer pool. More... | |
bool | initMiscDataPool () |
Initialize misc data (user meta) buffer pool. More... | |
void | deInitMiscDataPool () |
Deinitialize misc data (user meta) buffer pool. More... | |
bool | initTrackerLib () |
Initialize low-level tracker lib. More... | |
void | deInitTrackerLib () |
Deinitialize low-level tracker lib. More... | |
bool | initTrackerQuery (const std::vector< NvMOTContextHandle > &contextHandleList) |
Initialize parameter query from low-level tracker lib. More... | |
bool | initTrackerQuery (const NvMOTContextHandle &contextHandleList, uint32_t sbId) |
Initialize parameter query from low-level tracker lib for a single sub-batch. More... | |
void | allocateProcessMemory (NvMOTProcessParams &procInput, NvMOTTrackedObjBatch &procResult) |
Allocate memory for low level library input. More... | |
void | allocateProcessMemory (NvMOTProcessParams &procInput, NvMOTTrackedObjBatch &procResult, uint32_t batchSize) |
void | releaseProcessMemory (NvMOTProcessParams &procInput, NvMOTTrackedObjBatch &procResult) |
Release input memory. More... | |
void | releaseProcessMemory (NvMOTProcessParams &procInput, NvMOTTrackedObjBatch &procResult, uint32_t batchSize) |
void | allocateConvexHullMemory (NvMOTTrackedObj *list, const uint32_t numAllocated) |
void | releaseConvexHullMemory (NvMOTTrackedObj *list, const uint32_t numAllocated) |
void | allocateMaskMemory (NvMOTTrackedObj *list, const uint32_t numAllocated) |
void | releaseMaskMemory (NvMOTTrackedObj *list, const uint32_t numAllocated) |
void | queueFrames (const NvDsBatchMeta &batchMeta, std::vector< std::map< SurfaceStreamId, NvDsFrameMeta * >> &batchList) |
Functions to process a batch. More... | |
void | fillMOTFrame (SurfaceStreamId ssId, const ProcParams &procParams, const NvDsFrameMeta &frameMeta, NvMOTFrame &motFrame, NvMOTTrackedObjList &trackedObjList) |
Fill input to low-level tracker lib. More... | |
void | updateBatchMeta (const NvMOTTrackedObjBatch &procResult, const ProcParams &procParams, std::map< SurfaceStreamId, NvDsFrameMeta * > &frameMap) |
Update batch meta with tracking results. More... | |
void | updateFrameMeta (NvDsFrameMeta *pFrameMeta, const NvMOTTrackedObjList &objList, const ProcParams &procParams) |
Update each stream's frame meta with tracking results. More... | |
void | updatePastFrameMeta (const std::vector< std::map< SurfaceStreamId, NvDsFrameMeta * >> &batchList, GstNvTrackerMiscDataObject *pGstObj, ProcParams &procParams) |
Update past frame data. More... | |
void | updateUserMeta (const std::vector< std::map< SurfaceStreamId, NvDsFrameMeta * >> &batchList, ProcParams &procParams, NvTrackerMiscDataBuffer *pMiscDataBuf) |
Update tracker user meta. More... | |
void | updateUserMeta (const std::vector< std::map< SurfaceStreamId, NvDsFrameMeta * >> &batchList, ProcParams &procParams, NvTrackerMiscDataBuffer *pMiscDataBuf, TrackerMiscDataManager &miscDataMgr) |
void | updateObjMaskMeta (NvDsObjectMeta *pObjectMeta, NvMOTTrackedObj *pTrackedObj) |
Update segmentation mask meta. More... | |
void | updateObjectReidMeta (NvDsObjectMeta *pObjectMeta, NvMOTTrackedObj *pTrackedObj, NvDsBatchMeta *pBatchMeta) |
Update each object's reid meta. More... | |
void | updateBatchReidMeta (GstNvTrackerMiscDataObject *pGstObj, ProcParams &procParams) |
Update batch reid meta. More... | |
void | updateObjectProjectionMeta (NvDsObjectMeta *pObjectMeta, NvMOTTrackedObj *pTrackedObj, NvDsBatchMeta *pBatchMeta, float scaleWidth, float scaleHeight, NvDsFrameMeta *pFrameMeta) |
Update each object's model projection meta. More... | |
void | updateTerminatedTrackMeta (GstNvTrackerMiscDataObject *pGstObj, ProcParams &procParams) |
void | updateShadowTrackMeta (GstNvTrackerMiscDataObject *pGstObj, ProcParams &procParams) |
void | processBatch () |
Function to pop batch from input queue, call low level lib to process and update meta data with tracking results. More... | |
SurfaceStreamId | getSurfaceStreamId (StreamId streamId, SurfaceId surfaceId) |
Getter. More... | |
StreamId | getStreamId (SurfaceStreamId ssId) |
SurfaceId | getSurfaceId (SurfaceStreamId ssId) |
guint64 | objectIdMapping (const guint64 &objectId, const SurfaceStreamId &ssId) |
Object ID mapper to ensure ID starts from 0 after reset. More... | |
void | removeUntrackedObjects (NvDsFrameMeta *pFrameMeta) |
Remove objects that don't need an ID. More... | |
bool | clipBBox (uint32_t frameWidth, uint32_t frameHeight, float &left, float &top, float &width, float &height) |
Clip the bbox to be within the frame. More... | |
NvDsTargetMiscDataBatch * | allocatePastFrameMemory () |
Protected Attributes | |
std::map< int, ClassInfo > | m_ClassInfoMap |
Info mapped per class. More... | |
std::shared_mutex | m_ClassInfoMapLock |
TrackerConfig | m_Config |
Tracker processing config. More... | |
bool | m_Running = false |
Tracker lib is running. More... | |
std::atomic< bool > | m_TrackerLibError |
Tracker lib encounters an error. More... | |
ConvBufManager | m_ConvBufMgr |
Buffer manager for surface transformation. More... | |
TrackerMiscDataManager | m_MiscDataMgr |
Buffer manager for misc data (user meta). More... | |
std::queue< ProcParams > | m_ProcQueue |
Input queue waiting for tracker proceeding. More... | |
std::mutex | m_ProcQueueLock |
std::condition_variable | m_ProcQueueCond |
std::condition_variable | m_BufQueueCond |
std::map< BatchId, std::vector< SubBatchId > > | m_PendingBatch |
Stores batches not finishing tracker proceeding. More... | |
BatchId | m_BatchId = 0 |
std::mutex | m_PendingBatchLock |
std::map< BatchId, bool > | m_ConvBufComplete |
Stores status of pending batches for buffer conversion. More... | |
std::mutex | m_ConvBufLock |
bool | m_SourceRemoved = false |
Variable to check if a source is removed from low level tracker lib. More... | |
std::mutex | m_SourceRemoveLock |
std::condition_variable | m_SourceRemoveCond |
NvMOTContextHandle | m_BatchContextHandle = nullptr |
Batch dispatch to low-level tracker lib. More... | |
std::thread | m_ProcessBatchThread |
std::map< SubBatchId, DispatchInfo > | m_DispatchMap |
Mapping from sub-batch id to corresponding thread info. More... | |
std::mutex | m_DispatchMapLock |
std::map< SurfaceStreamId, SubBatchId > | m_SsidSubBatchMap |
Mapping for SurfaceStreamId => SubBatchId. More... | |
std::map< uint32_t, SeqIndex > | m_PadIndexSeqIndexMap |
Pad index(Source id) mapping: {Pad index(source id): sequence index in the sub-batch}. More... | |
std::map< SubBatchId, std::map< SeqIndex, std::pair< SurfaceStreamId, uint32_t > > > | m_SubBatchAllocationMap |
For dynamic/run-time mapping of source id(pad index) to sub-batches; maintain and update a map of allocations. More... | |
std::shared_mutex | m_SubBatchMapLock |
Lock for critical code for variables m_SubBatchAllocationMap, m_PadIndexSeqIndexMap, m_PadIndexSsidMap, m_SsidSubBatchMap. More... | |
uint32_t | m_MaxSubBatchSize = 0 |
Max sub-batch size. More... | |
std::queue< InputParams > | m_CompletionQueue |
Completions. More... | |
std::mutex | m_CompletionQueueLock |
std::condition_variable | m_CompletionQueueCond |
std::map< SurfaceStreamId, guint64 > | m_ObjectIdOffsetMap |
Object id mapping: {surface stream ID: object id offset}. More... | |
std::mutex | m_ObjectIdOffsetMapLock |
std::map< uint32_t, SurfaceStreamId > | m_PadIndexSsidMap |
Pad index to surface stream ID mapping. More... | |
void * | m_TrackerLibHandle |
Low-level tracker lib API and support functions. More... | |
NvMOTStatus(* | m_TrackerLibInit )(NvMOTConfig *pConfigIn, NvMOTContextHandle *pContextHandle, NvMOTConfigResponse *pConfigResponse) |
Tracker low level library functions. More... | |
void(* | m_TrackerLibDeInit )(NvMOTContextHandle contextHandle) |
Low level lib deinit. More... | |
NvMOTStatus(* | m_TrackerLibProcess )(NvMOTContextHandle contextHandle, NvMOTProcessParams *pParams, NvMOTTrackedObjBatch *pTrackedObjectsBatch) |
Low level lib process. More... | |
NvMOTStatus(* | m_TrackerLibRetrieveMiscData )(NvMOTContextHandle contextHandle, NvMOTProcessParams *pParams, NvMOTTrackerMiscData *pTrackerMiscData) |
Low level lib process past frame. More... | |
NvMOTStatus(* | m_TrackerLibQuery )(uint16_t customConfigFilePathSize, char *pCustomConfigFilePath, NvMOTQuery *pQuery) |
Low level lib query. More... | |
NvMOTStatus(* | m_TrackerLibRemoveStreams )(NvMOTContextHandle contextHandle, NvMOTStreamId streamIdMask) |
Low level lib remove streams. More... | |
NvMOTStatus(* | m_TrackerLibUpdateParams )(NvMOTContextHandle contextHandle, const std::string &configStr) |
Low level lib update parameters. More... | |
|
protected |
Current batch ID.
Definition at line 71 of file nvtracker_proc.h.
|
protected |
Sequence index in a sub-batch.
i.e. "seq_index" in "NvMOTFrame"
Definition at line 84 of file nvtracker_proc.h.
|
protected |
Source stream ID.
Definition at line 78 of file nvtracker_proc.h.
|
protected |
sub-batch ID.
Definition at line 82 of file nvtracker_proc.h.
|
protected |
Surface type ID.
Definition at line 80 of file nvtracker_proc.h.
|
protected |
Composition of unique ID for each surface from each source Some sources (e.g.
360d) produce multiple surfaces per frame due to dewarping etc.
Definition at line 76 of file nvtracker_proc.h.
NvTrackerProc::NvTrackerProc | ( | ) |
|
virtual |
|
virtual |
Tracker actions when a source is added to the pipeline.
Implements INvTrackerProc.
|
protected |
|
protected |
|
protected |
|
protected |
Allocate memory for low level library input.
|
protected |
|
protected |
Clip the bbox to be within the frame.
If the bbox is entirely outside, or shrinks to 0 in either dimension, then return false so it can be removed from the object list.
|
virtual |
Implements INvTrackerProc.
|
protected |
Deinitialize surface transform buffer pool.
|
protected |
Deinitialize misc data (user meta) buffer pool.
|
protected |
Deinitialize low-level tracker lib.
|
protected |
Function to create sub-batches from a batch and submit to corresponding sub-batch queues.
|
protected |
Fill input to low-level tracker lib.
|
virtual |
Flush the request to send the batch downstream.
Implements INvTrackerProc.
|
inlineprotected |
Definition at line 325 of file nvtracker_proc.h.
|
inlineprotected |
Definition at line 326 of file nvtracker_proc.h.
|
inlineprotected |
Getter.
Definition at line 323 of file nvtracker_proc.h.
|
virtual |
Implements INvTrackerProc.
|
protected |
Initialize surface transform buffer pool.
|
protected |
Initialize misc data (user meta) buffer pool.
|
protected |
Internal initializing and release function.
initialize the batch context with low-level tracker lib.
|
protected |
Initialize low-level tracker lib.
|
protected |
Initialize parameter query from low-level tracker lib for a single sub-batch.
Required when reinitializing a sub-batch
|
protected |
Initialize parameter query from low-level tracker lib.
|
protected |
Fuction to map a stream with a specific (SurfaceStreamId, pad_index) to a sub-batch.
The mapping happens only the first time when a stream arrives and is stored in m_SsidSubBatchMap
|
protected |
Object ID mapper to ensure ID starts from 0 after reset.
|
protected |
Function to pop batch from input queue, call low level lib to process and update meta data with tracking results.
|
protected |
Function to pop sub-batch from queue, call low level lib to process and update meta data with tracking results for the sub-batch.
|
protected |
Functions to process a batch.
In case the batch contains two frames with the same ssId, sort the frames based on frameNum in ascending order.
|
protected |
|
protected |
|
protected |
Release input memory.
|
protected |
|
virtual |
Tracker actions when a source is removed to the pipeline.
Implements INvTrackerProc.
|
protected |
Remove objects that don't need an ID.
|
virtual |
Tracker actions when a source is reset.
Implements INvTrackerProc.
|
virtual |
Submit an input batch to tracker process queue.
Implements INvTrackerProc.
|
protected |
Update batch meta with tracking results.
|
protected |
Update batch reid meta.
|
virtual |
Update the low-level tracker lib's config dynamically during runtime.
Implements INvTrackerProc.
|
protected |
Update each stream's frame meta with tracking results.
|
protected |
Update each object's model projection meta.
|
protected |
Update each object's reid meta.
|
protected |
Update segmentation mask meta.
|
protected |
Update past frame data.
|
protected |
|
protected |
|
protected |
Update tracker user meta.
|
protected |
|
virtual |
Wait until a batch's process is done.
Implements INvTrackerProc.
|
protected |
Batch dispatch to low-level tracker lib.
Definition at line 145 of file nvtracker_proc.h.
|
protected |
Definition at line 132 of file nvtracker_proc.h.
|
protected |
Definition at line 128 of file nvtracker_proc.h.
|
protected |
|
protected |
Definition at line 68 of file nvtracker_proc.h.
|
protected |
Completions.
Definition at line 215 of file nvtracker_proc.h.
|
protected |
Definition at line 217 of file nvtracker_proc.h.
|
protected |
Definition at line 216 of file nvtracker_proc.h.
|
protected |
Tracker processing config.
Definition at line 86 of file nvtracker_proc.h.
|
protected |
Stores status of pending batches for buffer conversion.
Definition at line 136 of file nvtracker_proc.h.
|
protected |
Definition at line 137 of file nvtracker_proc.h.
|
protected |
Buffer manager for surface transformation.
Definition at line 93 of file nvtracker_proc.h.
|
protected |
Mapping from sub-batch id to corresponding thread info.
Definition at line 180 of file nvtracker_proc.h.
|
protected |
Definition at line 181 of file nvtracker_proc.h.
|
protected |
Max sub-batch size.
Definition at line 200 of file nvtracker_proc.h.
|
protected |
Buffer manager for misc data (user meta).
Definition at line 96 of file nvtracker_proc.h.
|
protected |
Object id mapping: {surface stream ID: object id offset}.
Definition at line 220 of file nvtracker_proc.h.
|
protected |
Definition at line 221 of file nvtracker_proc.h.
|
protected |
Pad index(Source id) mapping: {Pad index(source id): sequence index in the sub-batch}.
Usage : This mapping is used for every input frame to fill "seq_index" value in "NvMOTFrame" before being passed to the low level tracker for processing
Definition at line 189 of file nvtracker_proc.h.
|
protected |
Pad index to surface stream ID mapping.
Used in source removal
Definition at line 223 of file nvtracker_proc.h.
|
protected |
Stores batches not finishing tracker proceeding.
Definition at line 131 of file nvtracker_proc.h.
|
protected |
Definition at line 133 of file nvtracker_proc.h.
|
protected |
Definition at line 146 of file nvtracker_proc.h.
|
protected |
Input queue waiting for tracker proceeding.
Definition at line 125 of file nvtracker_proc.h.
|
protected |
Definition at line 127 of file nvtracker_proc.h.
|
protected |
Definition at line 126 of file nvtracker_proc.h.
|
protected |
Tracker lib is running.
Definition at line 88 of file nvtracker_proc.h.
|
protected |
Definition at line 142 of file nvtracker_proc.h.
|
protected |
Variable to check if a source is removed from low level tracker lib.
Definition at line 140 of file nvtracker_proc.h.
|
protected |
Definition at line 141 of file nvtracker_proc.h.
|
protected |
Mapping for SurfaceStreamId => SubBatchId.
Usage : Everytime a new batch arrives, this mapping is used to find the SubBatchId that should be used to process each frame in the batch based on the SurfaceStreamId of the frame
Definition at line 185 of file nvtracker_proc.h.
|
protected |
For dynamic/run-time mapping of source id(pad index) to sub-batches; maintain and update a map of allocations.
map <sub-batch id, map <seq index, pair <SurfaceStreamId, pad index > >> Usage : Keeps a track of used <SubBatchId, SeqIndex> slot Whenever a new source is added, it is assigned to a <SubBatchId, SeqIndex> pair and accordingly m_SubBatchAllocationMap is updated Similarly, when a source is removed, the corresponding entry is deleted from m_SubBatchAllocationMap
Definition at line 196 of file nvtracker_proc.h.
|
protected |
Lock for critical code for variables m_SubBatchAllocationMap, m_PadIndexSeqIndexMap, m_PadIndexSsidMap, m_SsidSubBatchMap.
Definition at line 198 of file nvtracker_proc.h.
|
protected |
Low level lib deinit.
Definition at line 344 of file nvtracker_proc.h.
|
protected |
Tracker lib encounters an error.
Definition at line 90 of file nvtracker_proc.h.
|
protected |
Low-level tracker lib API and support functions.
Definition at line 227 of file nvtracker_proc.h.
|
protected |
Tracker low level library functions.
Low level lib init.
Definition at line 340 of file nvtracker_proc.h.
|
protected |
Low level lib process.
Definition at line 346 of file nvtracker_proc.h.
|
protected |
Low level lib query.
Definition at line 354 of file nvtracker_proc.h.
|
protected |
Low level lib remove streams.
Definition at line 358 of file nvtracker_proc.h.
|
protected |
Low level lib process past frame.
Definition at line 350 of file nvtracker_proc.h.
|
protected |
Low level lib update parameters.
Definition at line 361 of file nvtracker_proc.h.