NVIDIA DeepStream SDK API Reference

9.1 Release
sources/includes/nvdsinfer.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2017-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 
34 #ifndef _NVDSINFER_H_
35 #define _NVDSINFER_H_
36 
37 #include <stdint.h>
38 
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #endif
43 
44 #define NVDSINFER_MAX_DIMS 8
45 
46 #define _DS_DEPRECATED_(STR) __attribute__ ((deprecated (STR)))
47 
51 typedef struct
52 {
54  unsigned int numDims;
56  unsigned int d[NVDSINFER_MAX_DIMS];
58  unsigned int numElements;
60 
64 typedef struct
65 {
67  unsigned int c;
69  unsigned int h;
71  unsigned int w;
73 
77 typedef enum
78 {
80  FLOAT = 0,
82  HALF = 1,
84  INT8 = 2,
86  INT32 = 3,
88  INT64 = 4,
90  UINT8 = 5
92 
96 typedef struct
97 {
101  union {
103  NvDsInferDims dims _DS_DEPRECATED_("dims is deprecated. Use inferDims instead");
104  };
108  const char* layerName;
110  void *buffer;
113  int isInput;
115 
119 typedef struct
120 {
122  unsigned int width;
124  unsigned int height;
126  unsigned int channels;
128 
133 #define getDimsCHWFromDims(dimsCHW,dims) \
134  do { \
135  (dimsCHW).c = (dims).d[0]; \
136  (dimsCHW).h = (dims).d[1]; \
137  (dimsCHW).w = (dims).d[2]; \
138  } while (0)
139 
140 #define getDimsHWCFromDims(dimsCHW,dims) \
141  do { \
142  (dimsCHW).h = (dims).d[0]; \
143  (dimsCHW).w = (dims).d[1]; \
144  (dimsCHW).c = (dims).d[2]; \
145  } while (0)
146 
150 typedef struct
151 {
153  unsigned int classId;
154 
156  float left;
158  float top;
160  float width;
162  float height;
163 
167 
172 
177 
181 typedef struct
182 {
184  unsigned int classId;
185 
187  float left;
189  float top;
191  float width;
193  float height;
194 
198 
200  float *mask;
202  unsigned int mask_width;
204  unsigned int mask_height;
206  unsigned int mask_size;
208 
212 typedef struct
213 {
217  unsigned int attributeIndex;
219  unsigned int attributeValue;
227 
231 typedef enum {
258 
262 typedef enum {
268 
276 const char* NvDsInferStatus2Str(NvDsInferStatus status);
277 
278 #ifdef __cplusplus
279 }
280 #endif
281 
282 /* C++ data types */
283 #ifdef __cplusplus
284 
289 typedef enum
290 {
291  kSELECTOR_MIN = 0,
292  kSELECTOR_OPT,
293  kSELECTOR_MAX,
294  kSELECTOR_SIZE
295 } NvDsInferProfileSelector;
296 
300 typedef struct
301 {
302  int batchSize = 0;
303  NvDsInferDims dims = {0};
304 } NvDsInferBatchDims;
305 
310 struct NvDsInferBatchDimsLayerInfo : NvDsInferLayerInfo
311 {
312  NvDsInferBatchDims profileDims[kSELECTOR_SIZE];
313 };
314 
315 #endif
316 
317 #endif
318 
NvDsInferStatus2Str
const char * NvDsInferStatus2Str(NvDsInferStatus status)
Get the string name for the status.
NvDsInferDimsCHW::w
unsigned int w
Holds the width of the layer.
Definition: sources/includes/nvdsinfer.h:71
NvDsInferInstanceMaskInfo::left
float left
Holds the horizontal offset of the bounding box shape for the object.
Definition: sources/includes/nvdsinfer.h:187
UINT8
@ UINT8
Specifies UINT8 format.
Definition: sources/includes/nvdsinfer.h:90
NvDsInferInstanceMaskInfo::width
float width
Holds the width of the object's bounding box.
Definition: sources/includes/nvdsinfer.h:191
NvDsInferLayerInfo::buffer
void * buffer
Holds a pointer to the buffer for the layer data.
Definition: sources/includes/nvdsinfer.h:110
NvDsInferAttribute::attributeIndex
unsigned int attributeIndex
Holds the index of the attribute's label.
Definition: sources/includes/nvdsinfer.h:217
NvDsInferInstanceMaskInfo::classId
unsigned int classId
Holds the ID of the class to which the object belongs.
Definition: sources/includes/nvdsinfer.h:184
NvDsInferObjectDetectionInfo::width
float width
Holds the width of the object's bounding box.
Definition: sources/includes/nvdsinfer.h:160
NvDsInferDims::numElements
unsigned int numElements
Holds the number of elements in the layer, including all dimensions.
Definition: sources/includes/nvdsinfer.h:58
NvDsInferObjectDetectionInfo::rotation_angle
float rotation_angle
Holds the rotation angle in radians for oriented bounding boxes (OBB).
Definition: sources/includes/nvdsinfer.h:170
NvDsInferObjectDetectionInfo::left
float left
Holds the horizontal offset of the bounding box shape for the object.
Definition: sources/includes/nvdsinfer.h:156
NVDSINFER_TRTIS_ERROR
@ NVDSINFER_TRTIS_ERROR
[deprecated]TRT-IS error was encountered
Definition: sources/includes/nvdsinfer.h:252
NVDSINFER_LOG_ERROR
@ NVDSINFER_LOG_ERROR
Definition: sources/includes/nvdsinfer.h:263
NvDsInferDims
Holds the dimensions of a layer.
Definition: sources/includes/nvdsinfer.h:51
NVDSINFER_SUCCESS
@ NVDSINFER_SUCCESS
NvDsInferContext operation succeeded.
Definition: sources/includes/nvdsinfer.h:233
NvDsInferDimsCHW::h
unsigned int h
Holds the height of the layer.
Definition: sources/includes/nvdsinfer.h:69
NvDsInferLayerInfo::layerName
const char * layerName
Holds the name of the layer.
Definition: sources/includes/nvdsinfer.h:108
NvDsInferLogLevel
NvDsInferLogLevel
Enum for the log levels of NvDsInferContext.
Definition: sources/includes/nvdsinfer.h:262
NvDsInferLayerInfo::bindingIndex
int bindingIndex
Holds the TensorRT binding index of the layer.
Definition: sources/includes/nvdsinfer.h:106
NVDSINFER_TENSORRT_ERROR
@ NVDSINFER_TENSORRT_ERROR
TensorRT interface failed.
Definition: sources/includes/nvdsinfer.h:246
NVDSINFER_LOG_INFO
@ NVDSINFER_LOG_INFO
Definition: sources/includes/nvdsinfer.h:265
NvDsInferDataType
NvDsInferDataType
Specifies the data type of a layer.
Definition: sources/includes/nvdsinfer.h:77
NvDsInferInstanceMaskInfo
Holds information about one parsed object and instance mask from a detector's output.
Definition: sources/includes/nvdsinfer.h:181
NvDsInferInstanceMaskInfo::detectionConfidence
float detectionConfidence
Holds the object detection confidence level; must in the range [0.0,1.0].
Definition: sources/includes/nvdsinfer.h:197
NvDsInferInstanceMaskInfo::mask_size
unsigned int mask_size
Holds size of mask in bytes.
Definition: sources/includes/nvdsinfer.h:206
NVDSINFER_UNKNOWN_ERROR
@ NVDSINFER_UNKNOWN_ERROR
Unknown error was encountered.
Definition: sources/includes/nvdsinfer.h:256
NvDsInferObjectDetectionInfo::classId
unsigned int classId
Holds the ID of the class to which the object belongs.
Definition: sources/includes/nvdsinfer.h:153
NvDsInferNetworkInfo::height
unsigned int height
Holds the input height for the model.
Definition: sources/includes/nvdsinfer.h:124
NVDSINFER_TRITON_ERROR
@ NVDSINFER_TRITON_ERROR
Triton error was encountered.
Definition: sources/includes/nvdsinfer.h:250
NvDsInferObjectDetectionInfo
Holds information about one parsed object from a detector's output.
Definition: sources/includes/nvdsinfer.h:150
FLOAT
@ FLOAT
Specifies FP32 format.
Definition: sources/includes/nvdsinfer.h:80
NVDSINFER_LOG_WARNING
@ NVDSINFER_LOG_WARNING
Definition: sources/includes/nvdsinfer.h:264
NVDSINFER_OUTPUT_PARSING_FAILED
@ NVDSINFER_OUTPUT_PARSING_FAILED
Output parsing failed.
Definition: sources/includes/nvdsinfer.h:242
NVDSINFER_MAX_DIMS
#define NVDSINFER_MAX_DIMS
Definition: sources/includes/nvdsinfer.h:44
NvDsInferNetworkInfo
Holds information about the model network.
Definition: sources/includes/nvdsinfer.h:119
NvDsInferLayerInfo
Holds information about one layer in the model.
Definition: sources/includes/nvdsinfer.h:96
NvDsInferNetworkInfo::channels
unsigned int channels
Holds the number of input channels for the model.
Definition: sources/includes/nvdsinfer.h:126
HALF
@ HALF
Specifies FP16 format.
Definition: sources/includes/nvdsinfer.h:82
INT32
@ INT32
Specifies INT32 format.
Definition: sources/includes/nvdsinfer.h:86
NvDsInferInstanceMaskInfo::mask_height
unsigned int mask_height
Holds height of mask.
Definition: sources/includes/nvdsinfer.h:204
NvDsInferObjectDetectionInfo::top
float top
Holds the vertical offset of the object's bounding box.
Definition: sources/includes/nvdsinfer.h:158
NvDsInferLayerInfo::inferDims
NvDsInferDims inferDims
Definition: sources/includes/nvdsinfer.h:102
NvDsInferInstanceMaskInfo::top
float top
Holds the vertical offset of the object's bounding box.
Definition: sources/includes/nvdsinfer.h:189
INT8
@ INT8
Specifies INT8 format.
Definition: sources/includes/nvdsinfer.h:84
NVDSINFER_CUDA_ERROR
@ NVDSINFER_CUDA_ERROR
CUDA error was encountered.
Definition: sources/includes/nvdsinfer.h:244
NvDsInferLayerInfo::dataType
NvDsInferDataType dataType
Holds the data type of the layer.
Definition: sources/includes/nvdsinfer.h:99
NvDsInferParseObjectInfo
NvDsInferObjectDetectionInfo NvDsInferParseObjectInfo
A typedef defined to maintain backward compatibility.
Definition: sources/includes/nvdsinfer.h:176
NvDsInferNetworkInfo::width
unsigned int width
Holds the input width for the model.
Definition: sources/includes/nvdsinfer.h:122
NvDsInferInstanceMaskInfo::mask
float * mask
Holds object segment mask.
Definition: sources/includes/nvdsinfer.h:200
NVDSINFER_CONFIG_FAILED
@ NVDSINFER_CONFIG_FAILED
Failed to configure the NvDsInferContext instance possibly due to an erroneous initialization propert...
Definition: sources/includes/nvdsinfer.h:236
NvDsInferInstanceMaskInfo::height
float height
Holds the height of the object's bounding box.
Definition: sources/includes/nvdsinfer.h:193
NvDsInferDimsCHW
Holds the dimensions of a three-dimensional layer.
Definition: sources/includes/nvdsinfer.h:64
NvDsInferLayerInfo::isInput
int isInput
Holds a Boolean; true if the layer is an input layer, or false if an output layer.
Definition: sources/includes/nvdsinfer.h:113
NvDsInferDims::numDims
unsigned int numDims
Holds the number of dimesions in the layer.
Definition: sources/includes/nvdsinfer.h:54
NVDSINFER_INVALID_PARAMS
@ NVDSINFER_INVALID_PARAMS
Invalid parameters were supplied.
Definition: sources/includes/nvdsinfer.h:240
NvDsInferAttribute::attributeConfidence
float attributeConfidence
Holds the attribute's confidence level.
Definition: sources/includes/nvdsinfer.h:221
INT64
@ INT64
Specifies INT64 format.
Definition: sources/includes/nvdsinfer.h:88
NvDsInferObjectDetectionInfo::height
float height
Holds the height of the object's bounding box.
Definition: sources/includes/nvdsinfer.h:162
NvDsInferAttribute::attributeValue
unsigned int attributeValue
Holds the the attribute's output value.
Definition: sources/includes/nvdsinfer.h:219
NVDSINFER_LOG_DEBUG
@ NVDSINFER_LOG_DEBUG
Definition: sources/includes/nvdsinfer.h:266
_DS_DEPRECATED_
#define _DS_DEPRECATED_(STR)
Definition: sources/includes/nvdsinfer.h:46
NvDsInferInstanceMaskInfo::mask_width
unsigned int mask_width
Holds width of mask.
Definition: sources/includes/nvdsinfer.h:202
NvDsInferAttribute
Holds information about one classified attribute.
Definition: sources/includes/nvdsinfer.h:212
NVDSINFER_RESOURCE_ERROR
@ NVDSINFER_RESOURCE_ERROR
Resource error was encountered.
Definition: sources/includes/nvdsinfer.h:248
NVDSINFER_CUSTOM_LIB_FAILED
@ NVDSINFER_CUSTOM_LIB_FAILED
Custom Library interface implementation failed.
Definition: sources/includes/nvdsinfer.h:238
NvDsInferAttribute::attributeLabel
char * attributeLabel
Holds a pointer to a string containing the attribute's label.
Definition: sources/includes/nvdsinfer.h:225
NvDsInferObjectDetectionInfo::detectionConfidence
float detectionConfidence
Holds the object detection confidence level; must in the range [0.0,1.0].
Definition: sources/includes/nvdsinfer.h:166
NVDSINFER_MEM_ERROR
@ NVDSINFER_MEM_ERROR
Cuda Memory error was encountered.
Definition: sources/includes/nvdsinfer.h:254
NvDsInferDimsCHW::c
unsigned int c
Holds the channel count of the layer.
Definition: sources/includes/nvdsinfer.h:67
NvDsInferStatus
NvDsInferStatus
Enum for the status codes returned by NvDsInferContext.
Definition: sources/includes/nvdsinfer.h:231