NVIDIA DeepStream SDK API Reference

4.0.2 Release

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvdsinfer_context.h
Go to the documentation of this file.
1 
65 #ifndef __NVDSINFER_CONTEXT_H__
66 #define __NVDSINFER_CONTEXT_H__
67 
68 #include "nvdsinfer.h"
69 
78 #define _PATH_MAX 4096
79 
81 #define _MAX_CHANNELS 4
82 
84 #define _MAX_STR_LENGTH 1024
85 
87 #define NVDSINFER_MAX_BATCH_SIZE 1024
88 
90 #define NVDSINFER_MIN_OUTPUT_BUFFERPOOL_SIZE 2
91 
95 typedef enum
96 {
101 
105 typedef enum
106 {
120 
124 typedef enum
125 {
138 
142 typedef enum
143 {
148 
152 typedef struct
153 {
155  float threshold;
158  float eps;
161  int minBoxes;
166 
167 
171 typedef enum
172 {
191 
195 typedef enum
196 {
202 
207 {
210  unsigned int uniqueID;
211 
214 
225 
228 
235 
238 
243 
247  unsigned int maxBatchSize;
248 
254 
259 
262 
265 
271  unsigned int numOffsets;
272 
275 
279 
281  unsigned int numDetectedClasses;
282 
286 
289 
291 
294  unsigned int numOutputLayers;
295 
304 
308 
310  unsigned int gpuID;
311 
313  int useDLA;
315  int dlaCore;
316 
318  unsigned int outputBufferPoolSize;
319 
324 
332 typedef void (* NvDsInferContextReturnInputAsyncFunc) (void *data);
333 
337 typedef struct
338 {
341  void** inputFrames;
343  unsigned int numInputFrames;
347  unsigned int inputPitch;
354 
358 typedef struct
359 {
361  unsigned int left;
363  unsigned int top;
365  unsigned int width;
367  unsigned int height;
368  /* Index for the object class. */
370  /* String label for the detected object. */
371  char *label;
373 
378 typedef struct
379 {
383  unsigned int numObjects;
385 
390 typedef struct
391 {
396  unsigned int numAttributes;
398  char *label;
400 
405 typedef struct
406 {
408  unsigned int width;
410  unsigned int height;
412  unsigned int classes;
415  int *class_map;
420 
424 typedef struct
425 {
431  union
432  {
439  };
441 
446 typedef struct
447 {
450  unsigned int numFrames;
451 
455 
457  void **hostBuffers;
458  unsigned int numHostBuffers;
459 
461  unsigned int outputBatchID;
463 
465 typedef struct INvDsInferContext * NvDsInferContextHandle;
466 
480  unsigned int uniqueID, NvDsInferLogLevel logLevel, const char *funcName,
481  const char * logMessage, void *userCtx);
482 
483 
484 #ifdef __cplusplus
485 extern "C" {
486 #endif
487 
493 
501 const char * NvDsInferContext_GetStatusName (NvDsInferStatus status);
502 
503 
504 #ifdef __cplusplus
505 }
506 #endif
507 
515 #ifdef __cplusplus
516 
517 #include <string>
518 #include <vector>
519 
523 struct INvDsInferContext
524 {
525 public:
541  virtual NvDsInferStatus queueInputBatch(NvDsInferContextBatchInput &batchInput) = 0;
542 
553  virtual NvDsInferStatus dequeueOutputBatch(NvDsInferContextBatchOutput &batchOutput) = 0;
554 
562  virtual void releaseBatchOutput(NvDsInferContextBatchOutput &batchOutput) = 0;
563 
571  virtual void fillLayersInfo(std::vector<NvDsInferLayerInfo> &layersInfo) = 0;
572 
578  virtual void getNetworkInfo(NvDsInferNetworkInfo &networkInfo) = 0;
579 
588  virtual const std::vector< std::vector<std::string> >& getLabels() = 0;
589 
593  virtual void destroy() = 0;
594 protected:
595  virtual ~INvDsInferContext() {}
596 };
597 
609 NvDsInferStatus createNvDsInferContext(NvDsInferContextHandle *handle,
610  NvDsInferContextInitParams &initParams,
611  void *userCtx = nullptr,
612  NvDsInferContextLoggingFunc logFunc = nullptr);
613 
614 #endif
615 
624 #ifdef __cplusplus
625 extern "C" {
626 #endif
627 
628 
640  NvDsInferContextInitParams *initParams, void *userCtx,
642 
648 
660  NvDsInferContextBatchInput *batchInput);
661 
673  NvDsInferContextBatchOutput *batchOutput);
674 
684  NvDsInferContextBatchOutput *batchOutput);
685 
693  NvDsInferNetworkInfo *networkInfo);
694 
703 
714  NvDsInferLayerInfo *layersInfo);
715 
727  unsigned int id, unsigned int value);
728 
731 #ifdef __cplusplus
732 }
733 #endif
734 
735 #endif
unsigned int maxBatchSize
Max number of frames that will be inferred together in a batch.
Failed to configure the NvDsInferContext instance possibly due to an erroneous initialization propert...
Holds the detection and bounding box grouping parameters.
char modelEngineFilePath[_PATH_MAX]
Path to the serialized model engine file.
#define _MAX_CHANNELS
Maximum number of channels supported by the API for image input layers.
NvDsInferNetworkMode networkMode
Internal data format to be used by the inference engine.
TensorRT interface failed.
char uffInputBlobName[_MAX_STR_LENGTH]
Name of the input layer for the UFF model.
Holds the initialization parameters required for the NvDsInferContext interface.
unsigned int gpuID
ID of the GPU to run the inference on.
NvDsInferContext operation succeeded.
Holds information about one classified attribute.
Definition: nvdsinfer.h:144
int copyInputToHostBuffers
Boolean indicating if input layer contents should be copied to host memories for access in the applic...
NvDsInferDimsCHW uffDimsCHW
Input dimensions for the UFF model.
NvDsInferStatus NvDsInferContext_QueueInputBatch(NvDsInferContextHandle handle, NvDsInferContextBatchInput *batchInput)
Queue a batch of input frames for pre-processing and inferencing.
unsigned int numDetectedClasses
Number of classes detected by a detector network.
unsigned int width
Object width.
32-bit interleaved B-G-R-x
void ** inputFrames
Array of pointers to buffers for input frames.
unsigned int NvDsInferContext_GetNumLayersInfo(NvDsInferContextHandle handle)
Get the number of the bound layers of the inference engine in the NvDsInferContext instance...
unsigned int numInputFrames
Number of input frames i.e.
A batch is an array of frames.
NvDsInferDetectionParams * perClassDetectionParams
Per class detection parameters.
char meanImageFilePath[_PATH_MAX]
Path to the mean image file (PPM format).
NvDsInferLogLevel
Enum for the log levels of NvDsInferContext.
unsigned int uniqueID
Unique identifier for the instance.
int dlaCore
DLA Core to use.
unsigned int outputBufferPoolSize
Number of sets of output buffers (host and device) to be allocated.
char protoFilePath[_PATH_MAX]
Path to the prototxt file.
struct INvDsInferContext * NvDsInferContextHandle
An opaque pointer type to be used as an handle for the context instance.
NvDsInferNetworkType outputType
Output type indicating the valid member in the union.
void NvDsInferContext_FillLayersInfo(NvDsInferContextHandle handle, NvDsInferLayerInfo *layersInfo)
Fill the input vector with information on all the bound layers of the inference engine in the NvDsInf...
NvDsInferNetworkType networkType
Type of the network.
NvDsInferContextReturnInputAsyncFunc returnInputFunc
Callback function for returning the input buffers back to the client.
float * class_probability_map
Pointer to the raw array containing the probabilities.
float classifierThreshold
Minimum confidence threshold for classifier to consider a label valid.
char int8CalibrationFilePath[_PATH_MAX]
Path to the INT8 calibration file.
float offsets[_MAX_CHANNELS]
Per channel offsets for mean subtraction.
Other - Output layers will not be parsed by NvDsInferContext.
Copyright (c) 2017-2019, NVIDIA CORPORATION.
char tltEncodedModelFilePath[_PATH_MAX]
Path to the TLT encoded model file.
Holds the information about one batch to be inferred.
NvDsInferNetworkType
Enum for the type of the network.
char ** outputLayerNames
Array of output Layer Names.
Holds the information about one detected object.
void NvDsInferContext_ReleaseBatchOutput(NvDsInferContextHandle handle, NvDsInferContextBatchOutput *batchOutput)
Free the memory associated with the batch output and release the set of host buffers back to the cont...
NvDsInferClassificationOutput classificationOutput
Classifier output.
char onnxFilePath[_PATH_MAX]
Path to the ONNX model file.
NvDsInferUffInputOrder uffInputOrder
Original input order for the UFF model.
Holds the information on all attributes classifed by a classifier network for one frame...
unsigned int numAttributes
Size of the attributes array.
Detectors will find objects and their coordinates in the input frame along with the class of the obje...
NvDsInferDetectionOutput detectionOutput
Detector output.
NvDsInferFormat networkInputFormat
Network input format.
NvDsInferAttribute * attributes
Array of attributes.
Holds the information parsed from segmentation network output for one frame.
NvDsInferStatus NvDsInferContext_DequeueOutputBatch(NvDsInferContextHandle handle, NvDsInferContextBatchOutput *batchOutput)
Dequeue output for a batch of frames.
24-bit interleaved R-G-B
const char * NvDsInferContext_GetStatusName(NvDsInferStatus status)
Get the string name for the status.
char customNetworkConfigFilePath[_PATH_MAX]
Path to the config file for custom network creation.
unsigned int height
Height of the output.
char customBBoxParseFuncName[_MAX_STR_LENGTH]
Name of the custom bounding box function in the custom library.
NvDsInferStatus NvDsInferContext_Create(NvDsInferContextHandle *handle, NvDsInferContextInitParams *initParams, void *userCtx, NvDsInferContextLoggingFunc logFunc)
Creates a new instance of the NvDsInferContext class with the supplied initialization parameters...
Holds the information on all objects detected by a detector network in one frame. ...
void(* NvDsInferContextLoggingFunc)(NvDsInferContextHandle handle, unsigned int uniqueID, NvDsInferLogLevel logLevel, const char *funcName, const char *logMessage, void *userCtx)
Callback function type for logging the NvDsInferContext messages.
Segmentation - will classify each pixel into some finite possible classes.
unsigned int height
Object height.
unsigned int left
Offset from the left boundary of the frame.
char tltModelKey[_MAX_STR_LENGTH]
String key for decoding the TLT encoded model.
Classifiers - will classify the entire frame into some finite possible classes.
unsigned int numObjects
Number of objects in the array.
const char * NvDsInferContext_GetLabel(NvDsInferContextHandle handle, unsigned int id, unsigned int value)
Get the string label associated with the class_id for detectors and the attribute id and the attribut...
32-bit interleaved R-G-B-A
NvDsInferUffInputOrder
Enum for the UFF input layer order.
char labelsFilePath[_PATH_MAX]
Path to the labels file containing strings for the class labels.
void NvDsInferContext_GetNetworkInfo(NvDsInferContextHandle handle, NvDsInferNetworkInfo *networkInfo)
Get the network input information.
unsigned int classes
Number of classes supported by the network.
#define _MAX_STR_LENGTH
Maximum length of string parameters.
Custom Library interface implementation failed.
char uffFilePath[_PATH_MAX]
Path to the UFF model file.
unsigned int inputPitch
Pitch of the input frames, in bytes.
unsigned int width
Width of the output.
char modelFilePath[_PATH_MAX]
Path to the caffemodel file.
NvDsInferObject * objects
Array of objects.
Unknown error was encountered.
Holds the information inferred by the network on one frame.
24-bit interleaved B-G-R
unsigned int top
Offset from the top boundary of the frame.
Invalid parameters were supplied.
Holds information about the model network.
Definition: nvdsinfer.h:94
void ** hostBuffers
Array of pointers to set of host buffers for this batch.
float eps
Epsilon to control merging of overlapping boxes.
void(* NvDsInferContextReturnInputAsyncFunc)(void *data)
Callback function type for returning the input client buffers back to the NvDsInferContext client asy...
NvDsInferSegmentationOutput segmentationOutput
Classifier output.
Specifies dimensions of a layer with 3 dimensions.
Definition: nvdsinfer.h:46
struct _NvDsInferContextInitParams NvDsInferContextInitParams
Holds the initialization parameters required for the NvDsInferContext interface.
char customLibPath[_PATH_MAX]
Path to the library containing custom methods required to support the network.
#define _PATH_MAX
Maximum length of a file path parameter.
int useDLA
Boolean indicating if DLA should be used.
int useDBScan
Boolean indicating if DBScan should be used for object clustering.
NvDsInferFrameOutput * frames
Array of outputs for each frame in the batch.
NvDsInferNetworkMode
Enum for internal data format to be used by the inference engine.
void NvDsInferContext_Destroy(NvDsInferContextHandle handle)
Destroy a NvDsInferContext instance and release the associated resources.
Holds information about one layer in the model.
Definition: nvdsinfer.h:74
char * label
String label for the classified output.
float threshold
Bounding box detection threshold.
int groupThreshold
Minimum boxes in a cluster to be considered an object during grouping using OpenCV groupRectangles...
NvDsInferStatus
Enum for the status codes returned by NvDsInferContext.
int * class_map
Pointer to the array for 2D pixel class map.
NvDsInferFormat inputFormat
Format of the frame contents.
float networkScaleFactor
Normalization factor to scale the input pixels with.
void NvDsInferContext_ResetInitParams(NvDsInferContextInitParams *initParams)
Reset the members of initialization parameters to default values.
unsigned int outputBatchID
ID for the set of output buffers.
CUDA error was encountered.
void * returnFuncData
Pointer to the data to be supplied with the return NvDsInferContextReturnInputAsyncFunc callback...
NvDsInferFormat
Enum for color formats.
int minBoxes
Minimum boxes in a cluster to be considered an object during grouping using DBSCAN.
void ** outputDeviceBuffers
Array of pointers to set of output device buffers for this batch.
char customClassifierParseFuncName[_MAX_STR_LENGTH]
Name of the custom classifier attribute parsing function in the custom library.