NVIDIA DeepStream SDK API Reference

8.0 Release
nvdsinfer.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2017-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
29 #ifndef _NVDSINFER_H_
30 #define _NVDSINFER_H_
31 
32 #include <stdint.h>
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 #define NVDSINFER_MAX_DIMS 8
40 
41 #define _DS_DEPRECATED_(STR) __attribute__ ((deprecated (STR)))
42 
46 typedef struct
47 {
49  unsigned int numDims;
51  unsigned int d[NVDSINFER_MAX_DIMS];
53  unsigned int numElements;
55 
59 typedef struct
60 {
62  unsigned int c;
64  unsigned int h;
66  unsigned int w;
68 
72 typedef enum
73 {
75  FLOAT = 0,
77  HALF = 1,
79  INT8 = 2,
81  INT32 = 3,
83  INT64 = 4,
85  UINT8 = 5
87 
91 typedef struct
92 {
96  union {
98  NvDsInferDims dims _DS_DEPRECATED_("dims is deprecated. Use inferDims instead");
99  };
103  const char* layerName;
105  void *buffer;
108  int isInput;
110 
114 typedef struct
115 {
117  unsigned int width;
119  unsigned int height;
121  unsigned int channels;
123 
128 #define getDimsCHWFromDims(dimsCHW,dims) \
129  do { \
130  (dimsCHW).c = (dims).d[0]; \
131  (dimsCHW).h = (dims).d[1]; \
132  (dimsCHW).w = (dims).d[2]; \
133  } while (0)
134 
135 #define getDimsHWCFromDims(dimsCHW,dims) \
136  do { \
137  (dimsCHW).h = (dims).d[0]; \
138  (dimsCHW).w = (dims).d[1]; \
139  (dimsCHW).c = (dims).d[2]; \
140  } while (0)
141 
145 typedef struct
146 {
148  unsigned int classId;
149 
151  float left;
153  float top;
155  float width;
157  float height;
158 
163 
168 
172 typedef struct
173 {
175  unsigned int classId;
176 
178  float left;
180  float top;
182  float width;
184  float height;
185 
189 
191  float *mask;
193  unsigned int mask_width;
195  unsigned int mask_height;
197  unsigned int mask_size;
199 
203 typedef struct
204 {
208  unsigned int attributeIndex;
210  unsigned int attributeValue;
218 
222 typedef enum {
249 
253 typedef enum {
259 
267 const char* NvDsInferStatus2Str(NvDsInferStatus status);
268 
269 #ifdef __cplusplus
270 }
271 #endif
272 
273 /* C++ data types */
274 #ifdef __cplusplus
275 
280 typedef enum
281 {
282  kSELECTOR_MIN = 0,
283  kSELECTOR_OPT,
284  kSELECTOR_MAX,
285  kSELECTOR_SIZE
286 } NvDsInferProfileSelector;
287 
291 typedef struct
292 {
293  int batchSize = 0;
294  NvDsInferDims dims = {0};
295 } NvDsInferBatchDims;
296 
301 struct NvDsInferBatchDimsLayerInfo : NvDsInferLayerInfo
302 {
303  NvDsInferBatchDims profileDims[kSELECTOR_SIZE];
304 };
305 
306 #endif
307 
308 #endif
309 
NvDsInferAttribute::attributeLabel
char * attributeLabel
Holds a pointer to a string containing the attribute's label.
Definition: nvdsinfer.h:216
NvDsInferDimsCHW::w
unsigned int w
Holds the width of the layer.
Definition: nvdsinfer.h:66
NvDsInferInstanceMaskInfo::left
float left
Holds the horizontal offset of the bounding box shape for the object.
Definition: nvdsinfer.h:178
UINT8
@ UINT8
Specifies UINT8 format.
Definition: nvdsinfer.h:85
NvDsInferInstanceMaskInfo::width
float width
Holds the width of the object's bounding box.
Definition: nvdsinfer.h:182
NvDsInferAttribute::attributeIndex
unsigned int attributeIndex
Holds the index of the attribute's label.
Definition: nvdsinfer.h:208
NvDsInferInstanceMaskInfo::classId
unsigned int classId
Holds the ID of the class to which the object belongs.
Definition: nvdsinfer.h:175
NvDsInferObjectDetectionInfo::width
float width
Holds the width of the object's bounding box.
Definition: nvdsinfer.h:155
NvDsInferDims::numElements
unsigned int numElements
Holds the number of elements in the layer, including all dimensions.
Definition: nvdsinfer.h:53
NvDsInferObjectDetectionInfo::left
float left
Holds the horizontal offset of the bounding box shape for the object.
Definition: nvdsinfer.h:151
NVDSINFER_TRTIS_ERROR
@ NVDSINFER_TRTIS_ERROR
[deprecated]TRT-IS error was encountered
Definition: nvdsinfer.h:243
NVDSINFER_LOG_ERROR
@ NVDSINFER_LOG_ERROR
Definition: nvdsinfer.h:254
NvDsInferDims
Holds the dimensions of a layer.
Definition: nvdsinfer.h:46
NVDSINFER_SUCCESS
@ NVDSINFER_SUCCESS
NvDsInferContext operation succeeded.
Definition: nvdsinfer.h:224
NvDsInferDimsCHW::h
unsigned int h
Holds the height of the layer.
Definition: nvdsinfer.h:64
NvDsInferLogLevel
NvDsInferLogLevel
Enum for the log levels of NvDsInferContext.
Definition: nvdsinfer.h:253
NvDsInferLayerInfo::bindingIndex
int bindingIndex
Holds the TensorRT binding index of the layer.
Definition: nvdsinfer.h:101
NVDSINFER_TENSORRT_ERROR
@ NVDSINFER_TENSORRT_ERROR
TensorRT interface failed.
Definition: nvdsinfer.h:237
NVDSINFER_LOG_INFO
@ NVDSINFER_LOG_INFO
Definition: nvdsinfer.h:256
NvDsInferDataType
NvDsInferDataType
Specifies the data type of a layer.
Definition: nvdsinfer.h:72
NvDsInferInstanceMaskInfo
Holds information about one parsed object and instance mask from a detector's output.
Definition: nvdsinfer.h:172
NvDsInferInstanceMaskInfo::detectionConfidence
float detectionConfidence
Holds the object detection confidence level; must in the range [0.0,1.0].
Definition: nvdsinfer.h:188
NvDsInferStatus2Str
const char * NvDsInferStatus2Str(NvDsInferStatus status)
Get the string name for the status.
NvDsInferInstanceMaskInfo::mask_size
unsigned int mask_size
Holds size of mask in bytes.
Definition: nvdsinfer.h:197
NVDSINFER_UNKNOWN_ERROR
@ NVDSINFER_UNKNOWN_ERROR
Unknown error was encountered.
Definition: nvdsinfer.h:247
NvDsInferObjectDetectionInfo::classId
unsigned int classId
Holds the ID of the class to which the object belongs.
Definition: nvdsinfer.h:148
NvDsInferNetworkInfo::height
unsigned int height
Holds the input height for the model.
Definition: nvdsinfer.h:119
NVDSINFER_TRITON_ERROR
@ NVDSINFER_TRITON_ERROR
Triton error was encountered.
Definition: nvdsinfer.h:241
NvDsInferObjectDetectionInfo
Holds information about one parsed object from a detector's output.
Definition: nvdsinfer.h:145
FLOAT
@ FLOAT
Specifies FP32 format.
Definition: nvdsinfer.h:75
NVDSINFER_LOG_WARNING
@ NVDSINFER_LOG_WARNING
Definition: nvdsinfer.h:255
NVDSINFER_OUTPUT_PARSING_FAILED
@ NVDSINFER_OUTPUT_PARSING_FAILED
Output parsing failed.
Definition: nvdsinfer.h:233
NVDSINFER_MAX_DIMS
#define NVDSINFER_MAX_DIMS
Definition: nvdsinfer.h:39
NvDsInferNetworkInfo
Holds information about the model network.
Definition: nvdsinfer.h:114
NvDsInferLayerInfo
Holds information about one layer in the model.
Definition: nvdsinfer.h:91
NvDsInferNetworkInfo::channels
unsigned int channels
Holds the number of input channels for the model.
Definition: nvdsinfer.h:121
HALF
@ HALF
Specifies FP16 format.
Definition: nvdsinfer.h:77
INT32
@ INT32
Specifies INT32 format.
Definition: nvdsinfer.h:81
NvDsInferLayerInfo::buffer
void * buffer
Holds a pointer to the buffer for the layer data.
Definition: nvdsinfer.h:105
NvDsInferInstanceMaskInfo::mask_height
unsigned int mask_height
Holds height of mask.
Definition: nvdsinfer.h:195
NvDsInferObjectDetectionInfo::top
float top
Holds the vertical offset of the object's bounding box.
Definition: nvdsinfer.h:153
NvDsInferLayerInfo::inferDims
NvDsInferDims inferDims
Definition: nvdsinfer.h:97
NvDsInferInstanceMaskInfo::top
float top
Holds the vertical offset of the object's bounding box.
Definition: nvdsinfer.h:180
INT8
@ INT8
Specifies INT8 format.
Definition: nvdsinfer.h:79
NvDsInferInstanceMaskInfo::mask
float * mask
Holds object segment mask.
Definition: nvdsinfer.h:191
NVDSINFER_CUDA_ERROR
@ NVDSINFER_CUDA_ERROR
CUDA error was encountered.
Definition: nvdsinfer.h:235
NvDsInferLayerInfo::dataType
NvDsInferDataType dataType
Holds the data type of the layer.
Definition: nvdsinfer.h:94
NvDsInferParseObjectInfo
NvDsInferObjectDetectionInfo NvDsInferParseObjectInfo
A typedef defined to maintain backward compatibility.
Definition: nvdsinfer.h:167
NvDsInferNetworkInfo::width
unsigned int width
Holds the input width for the model.
Definition: nvdsinfer.h:117
NVDSINFER_CONFIG_FAILED
@ NVDSINFER_CONFIG_FAILED
Failed to configure the NvDsInferContext instance possibly due to an erroneous initialization propert...
Definition: nvdsinfer.h:227
NvDsInferInstanceMaskInfo::height
float height
Holds the height of the object's bounding box.
Definition: nvdsinfer.h:184
NvDsInferDimsCHW
Holds the dimensions of a three-dimensional layer.
Definition: nvdsinfer.h:59
NvDsInferLayerInfo::isInput
int isInput
Holds a Boolean; true if the layer is an input layer, or false if an output layer.
Definition: nvdsinfer.h:108
NvDsInferDims::numDims
unsigned int numDims
Holds the number of dimesions in the layer.
Definition: nvdsinfer.h:49
NVDSINFER_INVALID_PARAMS
@ NVDSINFER_INVALID_PARAMS
Invalid parameters were supplied.
Definition: nvdsinfer.h:231
NvDsInferAttribute::attributeConfidence
float attributeConfidence
Holds the attribute's confidence level.
Definition: nvdsinfer.h:212
NvDsInferLayerInfo::layerName
const char * layerName
Holds the name of the layer.
Definition: nvdsinfer.h:103
INT64
@ INT64
Specifies INT64 format.
Definition: nvdsinfer.h:83
NvDsInferObjectDetectionInfo::height
float height
Holds the height of the object's bounding box.
Definition: nvdsinfer.h:157
NvDsInferAttribute::attributeValue
unsigned int attributeValue
Holds the the attribute's output value.
Definition: nvdsinfer.h:210
NVDSINFER_LOG_DEBUG
@ NVDSINFER_LOG_DEBUG
Definition: nvdsinfer.h:257
_DS_DEPRECATED_
#define _DS_DEPRECATED_(STR)
Definition: nvdsinfer.h:41
NvDsInferInstanceMaskInfo::mask_width
unsigned int mask_width
Holds width of mask.
Definition: nvdsinfer.h:193
NvDsInferAttribute
Holds information about one classified attribute.
Definition: nvdsinfer.h:203
NVDSINFER_RESOURCE_ERROR
@ NVDSINFER_RESOURCE_ERROR
Resource error was encountered.
Definition: nvdsinfer.h:239
NVDSINFER_CUSTOM_LIB_FAILED
@ NVDSINFER_CUSTOM_LIB_FAILED
Custom Library interface implementation failed.
Definition: nvdsinfer.h:229
NvDsInferObjectDetectionInfo::detectionConfidence
float detectionConfidence
Holds the object detection confidence level; must in the range [0.0,1.0].
Definition: nvdsinfer.h:161
NVDSINFER_MEM_ERROR
@ NVDSINFER_MEM_ERROR
Cuda Memory error was encountered.
Definition: nvdsinfer.h:245
NvDsInferDimsCHW::c
unsigned int c
Holds the channel count of the layer.
Definition: nvdsinfer.h:62
NvDsInferStatus
NvDsInferStatus
Enum for the status codes returned by NvDsInferContext.
Definition: nvdsinfer.h:222