22 #ifndef __NVDSINFERSERVER_POST_PROCESS_H__
23 #define __NVDSINFERSERVER_POST_PROCESS_H__
26 #include <condition_variable>
33 #include <cuda_runtime_api.h>
43 #include "nvdsinferserver_config.pb.h"
45 namespace ic = nvdsinferserver::config;
47 struct NvDsInferDBScan;
74 const std::vector<std::vector<std::string>>&
getLabels()
const {
85 const std::vector<int>& devIds)
override;
99 std::vector<NvDsInferLayerInfo>& outputLayers,
100 const std::vector<SharedBatchBuf> outputBufs, uint32_t batchSize,
137 std::vector<NvDsInferLayerInfo>& outputLayers,
138 const std::vector<SharedBatchBuf> outputBufs, uint32_t batchSize,
141 bool parseBoundingBox(
142 std::vector<NvDsInferLayerInfo>
const& outputLayersInfo,
145 std::vector<NvDsInferObjectDetectionInfo>& objectList);
147 void clusterAndFillDetectionOutputCV(
148 const std::vector<NvDsInferObjectDetectionInfo>& objectList,
149 std::vector<NvDsInferObject> &outputs);
150 void clusterAndFillDetectionOutputDBSCAN(
151 const std::vector<NvDsInferObjectDetectionInfo>& objectList,
152 std::vector<NvDsInferObject>& outputs);
153 void copyWithoutCluster(
154 const std::vector<NvDsInferObjectDetectionInfo>& objectList,
155 std::vector<NvDsInferObject>& outputs);
157 const std::vector<NvDsInferLayerInfo>& outputLayers,
158 std::vector<NvDsInferObject> &output);
159 void filterDetectionOutput(
161 std::vector<NvDsInferObjectDetectionInfo> &objectList);
162 void clusterAndFillDetectionOutputNMS(
163 const std::vector<NvDsInferObjectDetectionInfo>& objectList,
164 uint32_t topk, std::vector<NvDsInferObject>& outputs);
165 std::vector<int> nonMaximumSuppression(
166 const std::vector<std::pair<float, int>>& scoreIndex,
167 const std::vector<NvDsInferParseObjectInfo>& bbox,
168 const float nmsThreshold);
171 struct NvDsInferDetectionParams
189 float nmsIOUThreshold;
193 std::shared_ptr<NvDsInferDBScan> m_DBScanHandle;
195 uint32_t m_NumDetectedClasses = 0;
198 std::vector<NvDsInferDetectionParams> m_PerClassDetectionParams;
202 ic::DetectionParams m_DetectConfig;
215 std::vector<NvDsInferLayerInfo>& outputLayers,
216 const std::vector<SharedBatchBuf> outputBufs, uint32_t batchSize,
220 const std::vector<NvDsInferLayerInfo>& outputLayers,
221 InferClassificationOutput& output);
223 bool parseAttributesFromSoftmaxLayers(
224 std::vector<NvDsInferLayerInfo>
const& outputLayersInfo,
226 std::vector<NvDsInferAttribute>& attrList, std::string& attrString);
229 float m_ClassifierThreshold = 0;
232 ic::ClassificationParams m_Config;
245 std::vector<NvDsInferLayerInfo>& outputLayers,
246 const std::vector<SharedBatchBuf> outputBufs, uint32_t batchSize,
250 const std::vector<NvDsInferLayerInfo>& outputLayers,
253 bool parseSemanticSegmentationOutput(
254 std::vector<NvDsInferLayerInfo>
const& outputLayersInfo,
256 float segmentationThreshold,
unsigned int numClasses,
257 int* classificationMap,
float*& classProbabilityMap);
260 float m_SegmentationThreshold = 0.0f;
262 m_CustomSemSegmentationParseFunc =
nullptr;
263 unsigned int m_NumSegmentationClasses = 0;
264 ic::SegmentationParams m_Config;
276 std::vector<NvDsInferLayerInfo>& outputLayers,
277 const std::vector<SharedBatchBuf> outputBufs, uint32_t batchSize,
284 ic::OtherNetworkParams m_Config;
299 std::vector<NvDsInferLayerInfo>& outputLayers,
300 const std::vector<SharedBatchBuf> outputBufs, uint32_t batchSize,
305 "TrtIsClassifer(uid:%d) should not reach here, check error",
311 ic::TritonClassifyParams m_Config;