NVIDIA DeepStream SDK API Reference

4.0.1 Release

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
nvdsinfer_custom_impl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA Corporation and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA Corporation is strictly prohibited.
9  *
10  */
11 
110 #ifndef _NVDSINFER_CUSTOM_IMPL_H_
111 #define _NVDSINFER_CUSTOM_IMPL_H_
112 
113 #include <string>
114 #include <vector>
115 #include "NvCaffeParser.h"
116 #include "NvUffParser.h"
117 
118 #include "nvdsinfer.h"
119 
120 #ifdef __cplusplus
121 extern "C"
122 {
123 #endif
124 
128 typedef struct
129 {
132  unsigned int numClassesConfigured;
135  std::vector<float> perClassThreshold;
137 
148 typedef bool (* NvDsInferParseCustomFunc) (
149  std::vector<NvDsInferLayerInfo> const &outputLayersInfo,
150  NvDsInferNetworkInfo const &networkInfo,
151  NvDsInferParseDetectionParams const &detectionParams,
152  std::vector<NvDsInferObjectDetectionInfo> &objectList);
153 
158 #define CHECK_CUSTOM_PARSE_FUNC_PROTOTYPE(customParseFunc) \
159  static void checkFunc_ ## customParseFunc (NvDsInferParseCustomFunc func = customParseFunc) \
160  { checkFunc_ ## customParseFunc (); }; \
161  extern "C" bool customParseFunc (std::vector<NvDsInferLayerInfo> const &outputLayersInfo, \
162  NvDsInferNetworkInfo const &networkInfo, \
163  NvDsInferParseDetectionParams const &detectionParams, \
164  std::vector<NvDsInferObjectDetectionInfo> &objectList);
165 
179  std::vector<NvDsInferLayerInfo> const &outputLayersInfo,
180  NvDsInferNetworkInfo const &networkInfo,
181  float classifierThreshold,
182  std::vector<NvDsInferAttribute> &attrList,
183  std::string &descString);
184 
189 #define CHECK_CUSTOM_CLASSIFIER_PARSE_FUNC_PROTOTYPE(customParseFunc) \
190  static void checkFunc_ ## customParseFunc (NvDsInferClassiferParseCustomFunc func = customParseFunc) \
191  { checkFunc_ ## customParseFunc (); }; \
192  extern "C" bool customParseFunc (std::vector<NvDsInferLayerInfo> const &outputLayersInfo, \
193  NvDsInferNetworkInfo const &networkInfo, \
194  float classifierThreshold, \
195  std::vector<NvDsInferAttribute> &attrList, \
196  std::string &descString);
197 
201 typedef enum
202 {
210 
215 typedef union
216 {
217  nvcaffeparser1::IPluginFactory *pluginFactory;
218  nvcaffeparser1::IPluginFactoryExt *pluginFactoryExt;
219  nvcaffeparser1::IPluginFactoryV2 *pluginFactoryV2;
221 
226 typedef union
227 {
228  nvuffparser::IPluginFactory *pluginFactory;
229  nvuffparser::IPluginFactoryExt *pluginFactoryExt;
231 
249 
258 
275 
284 
295 bool NvDsInferPluginFactoryRuntimeGet (nvinfer1::IPluginFactory *& pluginFactory);
296 
303 void NvDsInferPluginFactoryRuntimeDestroy (nvinfer1::IPluginFactory * pluginFactory);
304 
318 bool NvDsInferInitializeInputLayers (std::vector<NvDsInferLayerInfo> const &inputLayersInfo,
319  NvDsInferNetworkInfo const &networkInfo,
320  unsigned int maxBatchSize);
321 
323 
347 bool NvDsInferCudaEngineGet(nvinfer1::IBuilder *builder,
348  NvDsInferContextInitParams *initParams,
349  nvinfer1::DataType dataType,
350  nvinfer1::ICudaEngine *& cudaEngine);
351 
352 #ifdef __cplusplus
353 }
354 #endif
355 
356 #endif
357 
nvcaffeparser1::IPluginFactory * pluginFactory
Holds the initialization parameters required for the NvDsInferContext interface.
bool NvDsInferInitializeInputLayers(std::vector< NvDsInferLayerInfo > const &inputLayersInfo, NvDsInferNetworkInfo const &networkInfo, unsigned int maxBatchSize)
Initialize the input layers for inference.
Holds the detection parameters required for parsing objects.
bool NvDsInferCudaEngineGet(nvinfer1::IBuilder *builder, NvDsInferContextInitParams *initParams, nvinfer1::DataType dataType, nvinfer1::ICudaEngine *&cudaEngine)
Build and return CudaEngine for custom models.
void NvDsInferPluginFactoryUffDestroy(NvDsInferPluginFactoryUff &pluginFactory)
Destroy the Plugin Factory instance returned in NvDsInferPluginFactoryUffGet
bool NvDsInferPluginFactoryRuntimeGet(nvinfer1::IPluginFactory *&pluginFactory)
Returns an instance of a newly allocated Plugin Factory interface to be used during parsing deseriali...
std::vector< float > perClassThreshold
Per class detection confidence threshold.
NVIDIA DeepStream inference specifications
Holds the pointer to a heap allocated Plugin Factory object required during UFF model parsing...
NvDsInferPluginFactoryType
Specifies the type of the Plugin Factory.
bool(* NvDsInferParseCustomFunc)(std::vector< NvDsInferLayerInfo > const &outputLayersInfo, NvDsInferNetworkInfo const &networkInfo, NvDsInferParseDetectionParams const &detectionParams, std::vector< NvDsInferObjectDetectionInfo > &objectList)
Function definition for the custom bounding box parsing function.
void NvDsInferPluginFactoryRuntimeDestroy(nvinfer1::IPluginFactory *pluginFactory)
Destroy the PluginFactory instance returned in NvDsInferPluginFactoryRuntimeGet
Only for caffe models.
bool NvDsInferPluginFactoryUffGet(NvDsInferPluginFactoryUff &pluginFactory, NvDsInferPluginFactoryType &type)
Returns an instance of a newly allocated Plugin Factory interface to be used during parsing of UFF mo...
Holds the pointer to a heap allocated Plugin Factory object required during Caffemodel parsing...
bool(* NvDsInferClassiferParseCustomFunc)(std::vector< NvDsInferLayerInfo > const &outputLayersInfo, NvDsInferNetworkInfo const &networkInfo, float classifierThreshold, std::vector< NvDsInferAttribute > &attrList, std::string &descString)
Function definition for the custom classifier output parsing function.
unsigned int numClassesConfigured
Number of classes requested to be parsed starting with classID 0.
nvuffparser::IPluginFactoryExt * pluginFactoryExt
nvcaffeparser1::IPluginFactory / nvuffparser::IPluginFactory
bool NvDsInferPluginFactoryCaffeGet(NvDsInferPluginFactoryCaffe &pluginFactory, NvDsInferPluginFactoryType &type)
Returns an instance of a newly allocated Plugin Factory interface to be used during parsing of caffe ...
Holds information about the model network.
Definition: nvdsinfer.h:102
nvcaffeparser1::IPluginFactoryExt * pluginFactoryExt
nvuffparser::IPluginFactory * pluginFactory
nvcaffeparser1::IPluginFactoryExt / nvuffparser::IPluginFactoryExt
void NvDsInferPluginFactoryCaffeDestroy(NvDsInferPluginFactoryCaffe &pluginFactory)
Destroy the Plugin Factory instance returned in NvDsInferPluginFactoryCaffeGet
nvcaffeparser1::IPluginFactoryV2 * pluginFactoryV2