Tracker process class.
Definition at line 30 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... | |
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... | |
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 | 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 | 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) |
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... | |
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 |
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... | |
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::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... | |
|
protected |
Current batch ID.
Definition at line 67 of file nvtracker_proc.h.
|
protected |
Sequence index in a sub-batch.
i.e. "seq_index" in "NvMOTFrame"
Definition at line 80 of file nvtracker_proc.h.
|
protected |
Source stream ID.
Definition at line 74 of file nvtracker_proc.h.
|
protected |
sub-batch ID.
Definition at line 78 of file nvtracker_proc.h.
|
protected |
Surface type ID.
Definition at line 76 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 72 of file nvtracker_proc.h.
NvTrackerProc::NvTrackerProc | ( | ) |
|
virtual |
|
virtual |
Tracker actions when a source is added to the pipeline.
Implements INvTrackerProc.
|
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 297 of file nvtracker_proc.h.
|
inlineprotected |
Definition at line 298 of file nvtracker_proc.h.
|
inlineprotected |
Getter.
Definition at line 295 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 |
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.
|
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 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 120 of file nvtracker_proc.h.
|
protected |
Definition at line 112 of file nvtracker_proc.h.
|
protected |
Definition at line 108 of file nvtracker_proc.h.
|
protected |
|
protected |
Completions.
Definition at line 193 of file nvtracker_proc.h.
|
protected |
Definition at line 195 of file nvtracker_proc.h.
|
protected |
Definition at line 194 of file nvtracker_proc.h.
|
protected |
Tracker processing config.
Definition at line 82 of file nvtracker_proc.h.
|
protected |
Stores status of pending batches for buffer conversion.
Definition at line 116 of file nvtracker_proc.h.
|
protected |
Definition at line 117 of file nvtracker_proc.h.
|
protected |
Buffer manager for surface transformation.
Definition at line 89 of file nvtracker_proc.h.
|
protected |
Mapping from sub-batch id to corresponding thread info.
Definition at line 160 of file nvtracker_proc.h.
|
protected |
Definition at line 161 of file nvtracker_proc.h.
|
protected |
Max sub-batch size.
Definition at line 178 of file nvtracker_proc.h.
|
protected |
Buffer manager for misc data (user meta).
Definition at line 92 of file nvtracker_proc.h.
|
protected |
Object id mapping: {surface stream ID: object id offset}.
Definition at line 198 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 169 of file nvtracker_proc.h.
|
protected |
Pad index to surface stream ID mapping.
Used in source removal
Definition at line 200 of file nvtracker_proc.h.
|
protected |
Stores batches not finishing tracker proceeding.
Definition at line 111 of file nvtracker_proc.h.
|
protected |
Definition at line 113 of file nvtracker_proc.h.
|
protected |
Definition at line 121 of file nvtracker_proc.h.
|
protected |
Input queue waiting for tracker proceeding.
Definition at line 105 of file nvtracker_proc.h.
|
protected |
Definition at line 107 of file nvtracker_proc.h.
|
protected |
Definition at line 106 of file nvtracker_proc.h.
|
protected |
Tracker lib is running.
Definition at line 84 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 165 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 176 of file nvtracker_proc.h.
|
protected |
Low level lib deinit.
Definition at line 316 of file nvtracker_proc.h.
|
protected |
Tracker lib encounters an error.
Definition at line 86 of file nvtracker_proc.h.
|
protected |
Low-level tracker lib API and support functions.
Definition at line 204 of file nvtracker_proc.h.
|
protected |
Tracker low level library functions.
Low level lib init.
Definition at line 312 of file nvtracker_proc.h.
|
protected |
Low level lib process.
Definition at line 318 of file nvtracker_proc.h.
|
protected |
Low level lib query.
Definition at line 326 of file nvtracker_proc.h.
|
protected |
Low level lib remove streams.
Definition at line 330 of file nvtracker_proc.h.
|
protected |
Low level lib process past frame.
Definition at line 322 of file nvtracker_proc.h.