NVIDIA DeepStream SDK API Reference

9.2 Release
sources/libs/nvmultiobjecttracker/include/modules/ReID/IReID.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef REIDLIB_IREID_HPP_
19 #define REIDLIB_IREID_HPP_
20 
21 #include <deque>
22 #include <map>
23 #include "modules/NvMultiObjectTracker/NvMultiObjectTracker_common.hpp"
24 #include "modules/NvMultiObjectTracker/NvTrackedObject.hpp"
25 
27 enum REID_TYPES : int
28 {
29  DUMMY_REID = 0,
30  NvDEEPSORT = 1 << 0,
31  REASSOC = 1 << 1,
32  BOTH = (1 << 0) + (1 << 1)
33 };
34 
36 class IReID
37 {
38 public:
40  virtual ~IReID() {}
41 
48  virtual void initializeRuntime(
49  const SourceFrameInfo &frameInfo, const uint maxTargetsPerStream,
50  const std::shared_ptr<NvTrackedObjectManager> &targetManager
51  ) = 0;
52 
54  virtual void initializeModel() = 0;
55 
60  virtual void queryParams(NvMOTQuery &paramsQuery) = 0;
61 
68  virtual void doInference(
69  const std::map<NvMOTStreamId, NvMOTFrame *>& inputMeta,
70  std::map<NvMOTStreamId, std::deque<DetectedObjInfo>> &detectedObjects, const bool isForReAssoc
71  ) = 0;
72 
74  virtual void update() = 0;
75 
80  virtual void removeStream(const NvMOTStreamId videoStreamId) = 0;
81 
86  virtual void outputReIDTensor(NvDsReidTensorBatch& reidTensorBatch) = 0;
87 
94  virtual int outputTargetReIDInd(NvMOTStreamId streamId, uint targetInd) = 0;
95 
103  virtual void outputTargetReIDObj(
104  NvMOTStreamId streamId, uint targetInd, NvDsReidTensorBatch& reidTensorBatch, NvDsObjReid& reidObj
105  ) = 0;
106 
108  virtual bool isModelInitialized() = 0;
109 
111  virtual bool isRuntimeInitialized() = 0;
112 
114  virtual const REID_TYPES getReIDType() = 0;
115 };
116 
117 #endif // REIDLIB_IREID_HPP_
IReID::update
virtual void update()=0
Update ReID feature gallery after data association.
IReID::queryParams
virtual void queryParams(NvMOTQuery &paramsQuery)=0
Populate the capabilities reported to the tracker.
IReID::doInference
virtual void doInference(const std::map< NvMOTStreamId, NvMOTFrame * > &inputMeta, std::map< NvMOTStreamId, std::deque< DetectedObjInfo >> &detectedObjects, const bool isForReAssoc)=0
Crop and rescale detected objects to create input batch to reid model.
IReID::initializeRuntime
virtual void initializeRuntime(const SourceFrameInfo &frameInfo, const uint maxTargetsPerStream, const std::shared_ptr< NvTrackedObjectManager > &targetManager)=0
Initialize variables and allocate memories.
REID_TYPES
REID_TYPES
Types of ReID usage.
Definition: sources/libs/nvmultiobjecttracker/include/modules/ReID/IReID.hpp:27
IReID::~IReID
virtual ~IReID()
Release resources owned by the IReID instance.
Definition: sources/libs/nvmultiobjecttracker/include/modules/ReID/IReID.hpp:40
IReID::outputTargetReIDObj
virtual void outputTargetReIDObj(NvMOTStreamId streamId, uint targetInd, NvDsReidTensorBatch &reidTensorBatch, NvDsObjReid &reidObj)=0
Output a target's ReID vector information.
_NvDsObjReid
Holds Reid Vector information for an object.
Definition: includes/nvds_tracker_meta.h:164
BOTH
@ BOTH
ReID features used for both association and re-association.
Definition: sources/libs/nvmultiobjecttracker/include/modules/ReID/IReID.hpp:32
uint
unsigned int uint
Definition: sources/libs/nvmultiobjecttracker/include/modules/cuDCFv2/helper_math.h:25
IReID::initializeModel
virtual void initializeModel()=0
Create TensorRT inference engine; if engine does not exist, serialize from model file.
DUMMY_REID
@ DUMMY_REID
No ReID feature extraction.
Definition: sources/libs/nvmultiobjecttracker/include/modules/ReID/IReID.hpp:29
NvMOTStreamId
uint64_t NvMOTStreamId
Definition: includes/nvdstracker.h:53
IReID::outputTargetReIDInd
virtual int outputTargetReIDInd(NvMOTStreamId streamId, uint targetInd)=0
Output a target's ReID vector index in the batch tensor.
NvDEEPSORT
@ NvDEEPSORT
ReID features used for the NvDeepSORT association.
Definition: sources/libs/nvmultiobjecttracker/include/modules/ReID/IReID.hpp:30
_NvMOTQuery
Holds the capabilities and requirements reported by the tracker library.
Definition: includes/nvdstracker.h:420
IReID::getReIDType
virtual const REID_TYPES getReIDType()=0
Get the configured ReID implementation type.
IReID::outputReIDTensor
virtual void outputReIDTensor(NvDsReidTensorBatch &reidTensorBatch)=0
Output the ReID tensor of a batch.
IReID
Defines the interface for extracting and managing ReID features.
Definition: sources/libs/nvmultiobjecttracker/include/modules/ReID/IReID.hpp:36
SourceFrameInfo
Information about the input source frames for the input frame batch.
Definition: sources/libs/nvmultiobjecttracker/include/modules/NvMultiObjectTracker/NvMultiObjectTracker_common.hpp:49
IReID::isRuntimeInitialized
virtual bool isRuntimeInitialized()=0
Report whether runtime resources are initialized.
IReID::removeStream
virtual void removeStream(const NvMOTStreamId videoStreamId)=0
Remove a stream's reid features.
IReID::isModelInitialized
virtual bool isModelInitialized()=0
Report whether the inference model is initialized.
_NvDsReidTensorBatch
ReID tensor of the batch.
Definition: includes/nvds_tracker_meta.h:128
REASSOC
@ REASSOC
ReID features used for re-association.
Definition: sources/libs/nvmultiobjecttracker/include/modules/ReID/IReID.hpp:31