Jetson Inference
DNN Vision Library
detectNet.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __DETECT_NET_H__
24 #define __DETECT_NET_H__
25 
26 
27 #include "tensorNet.h"
28 
29 
34 #define DETECTNET_DEFAULT_INPUT "data"
35 
40 #define DETECTNET_DEFAULT_COVERAGE "coverage"
41 
46 #define DETECTNET_DEFAULT_BBOX "bboxes"
47 
52 #define DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD 0.5f
53 
58 #define DETECTNET_DEFAULT_CLUSTERING_THRESHOLD 0.75f
59 
65 #define DETECTNET_DEFAULT_THRESHOLD DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD
66 
71 #define DETECTNET_DEFAULT_ALPHA 120
72 
77 #define DETECTNET_MODEL_TYPE "detection"
78 
83 #define DETECTNET_USAGE_STRING "detectNet arguments: \n" \
84  " --network=NETWORK pre-trained model to load, one of the following:\n" \
85  " * ssd-mobilenet-v1\n" \
86  " * ssd-mobilenet-v2 (default)\n" \
87  " * ssd-inception-v2\n" \
88  " * peoplenet\n" \
89  " * peoplenet-pruned\n" \
90  " * dashcamnet\n" \
91  " * trafficcamnet\n" \
92  " * facedetect\n" \
93  " --model=MODEL path to custom model to load (caffemodel, uff, or onnx)\n" \
94  " --prototxt=PROTOTXT path to custom prototxt to load (for .caffemodel only)\n" \
95  " --labels=LABELS path to text file containing the labels for each class\n" \
96  " --input-blob=INPUT name of the input layer (default is '" DETECTNET_DEFAULT_INPUT "')\n" \
97  " --output-cvg=COVERAGE name of the coverage/confidence output layer (default is '" DETECTNET_DEFAULT_COVERAGE "')\n" \
98  " --output-bbox=BOXES name of the bounding output layer (default is '" DETECTNET_DEFAULT_BBOX "')\n" \
99  " --mean-pixel=PIXEL mean pixel value to subtract from input (default is 0.0)\n" \
100  " --confidence=CONF minimum confidence threshold for detection (default is 0.5)\n" \
101  " --clustering=CLUSTER minimum overlapping area threshold for clustering (default is 0.75)\n" \
102  " --alpha=ALPHA overlay alpha blending value, range 0-255 (default: 120)\n" \
103  " --overlay=OVERLAY detection overlay flags (e.g. --overlay=box,labels,conf)\n" \
104  " valid combinations are: 'box', 'lines', 'labels', 'conf', 'none'\n" \
105  " --profile enable layer profiling in TensorRT\n\n" \
106 
107 
108 // forward declarations
109 class objectTracker;
110 
111 
116 class detectNet : public tensorNet
117 {
118 public:
122  struct Detection
123  {
124  // Detection Info
125  uint32_t ClassID;
126  float Confidence;
128  // Tracking Info
129  int TrackID;
132  int TrackLost;
134  // Bounding Box Coordinates
135  float Left;
136  float Right;
137  float Top;
138  float Bottom;
141  inline float Width() const { return Right - Left; }
142 
144  inline float Height() const { return Bottom - Top; }
145 
147  inline float Area() const { return Width() * Height(); }
148 
150  static inline float Width( float x1, float x2 ) { return x2 - x1; }
151 
153  static inline float Height( float y1, float y2 ) { return y2 - y1; }
154 
156  static inline float Area( float x1, float y1, float x2, float y2 ) { return Width(x1,x2) * Height(y1,y2); }
157 
159  inline void Center( float* x, float* y ) const { if(x) *x = Left + Width() * 0.5f; if(y) *y = Top + Height() * 0.5f; }
160 
162  inline bool Contains( float x, float y ) const { return x >= Left && x <= Right && y >= Top && y <= Bottom; }
163 
165  inline bool Intersects( const Detection& det, float areaThreshold=0.0f ) const { return (IntersectionArea(det) / fmaxf(Area(), det.Area()) > areaThreshold); }
166 
168  inline bool Intersects( float x1, float y1, float x2, float y2, float areaThreshold=0.0f ) const { return (IntersectionArea(x1,y1,x2,y2) / fmaxf(Area(), Area(x1,y1,x2,y2)) > areaThreshold); }
169 
171  inline float IntersectionArea( const Detection& det ) const { return IntersectionArea(det.Left, det.Top, det.Right, det.Bottom); }
172 
174  inline float IntersectionArea( float x1, float y1, float x2, float y2 ) const { if(!Overlaps(x1,y1,x2,y2)) return 0.0f; return (fminf(Right, x2) - fmaxf(Left, x1)) * (fminf(Bottom, y2) - fmaxf(Top, y1)); }
175 
177  inline float IOU( const Detection& det ) const { return IOU(det.Left, det.Top, det.Right, det.Bottom); }
178 
180  inline float IOU( float x1, float y1, float x2, float y2 ) const;
181 
183  inline bool Overlaps( const Detection& det ) const { return !(det.Left > Right || det.Right < Left || det.Top > Bottom || det.Bottom < Top); }
184 
186  inline bool Overlaps( float x1, float y1, float x2, float y2 ) const { return !(x1 > Right || x2 < Left || y1 > Bottom || y2 < Top); }
187 
189  inline bool Expand( float x1, float y1, float x2, float y2 ) { if(!Overlaps(x1, y1, x2, y2)) return false; Left = fminf(x1, Left); Top = fminf(y1, Top); Right = fmaxf(x2, Right); Bottom = fmaxf(y2, Bottom); return true; }
190 
192  inline bool Expand( const Detection& det ) { if(!Overlaps(det)) return false; Left = fminf(det.Left, Left); Top = fminf(det.Top, Top); Right = fmaxf(det.Right, Right); Bottom = fmaxf(det.Bottom, Bottom); return true; }
193 
195  inline void Reset() { ClassID = 0; Confidence = 0; TrackID = -1; TrackStatus = -1; TrackFrames = 0; TrackLost = 0; Left = 0; Right = 0; Top = 0; Bottom = 0; }
196 
198  inline Detection() { Reset(); }
199  };
200 
205  {
207  OVERLAY_BOX = (1 << 0),
208  OVERLAY_LABEL = (1 << 1),
209  OVERLAY_CONFIDENCE = (1 << 2),
210  OVERLAY_TRACKING = (1 << 3),
211  OVERLAY_LINES = (1 << 4),
213  };
214 
221  static uint32_t OverlayFlagsFromStr( const char* flags );
222 
229  static detectNet* Create( const char* network="ssd-mobilenet-v2", float threshold=DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD,
230  uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST,
231  deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
232 
245  static detectNet* Create( const char* prototxt_path, const char* model_path, float mean_pixel=0.0f,
246  const char* class_labels=NULL, float threshold=DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD,
247  const char* input = DETECTNET_DEFAULT_INPUT,
248  const char* coverage = DETECTNET_DEFAULT_COVERAGE,
249  const char* bboxes = DETECTNET_DEFAULT_BBOX,
250  uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE,
251  precisionType precision=TYPE_FASTEST,
252  deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
253 
267  static detectNet* Create( const char* prototxt_path, const char* model_path, float mean_pixel,
268  const char* class_labels, const char* class_colors,
270  const char* input = DETECTNET_DEFAULT_INPUT,
271  const char* coverage = DETECTNET_DEFAULT_COVERAGE,
272  const char* bboxes = DETECTNET_DEFAULT_BBOX,
273  uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE,
274  precisionType precision=TYPE_FASTEST,
275  deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
276 
288  static detectNet* Create( const char* model_path, const char* class_labels, float threshold,
289  const char* input, const Dims3& inputDims,
290  const char* output, const char* numDetections,
291  uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE,
292  precisionType precision=TYPE_FASTEST,
293  deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
294 
298  static detectNet* Create( int argc, char** argv );
299 
303  static detectNet* Create( const commandLine& cmdLine );
304 
308  static inline const char* Usage() { return DETECTNET_USAGE_STRING; }
309 
313  virtual ~detectNet();
314 
324  template<typename T> int Detect( T* image, uint32_t width, uint32_t height, Detection** detections, uint32_t overlay=OVERLAY_DEFAULT ) { return Detect((void*)image, width, height, imageFormatFromType<T>(), detections, overlay); }
325 
336  template<typename T> int Detect( T* image, uint32_t width, uint32_t height, Detection* detections, uint32_t overlay=OVERLAY_DEFAULT ) { return Detect((void*)image, width, height, imageFormatFromType<T>(), detections, overlay); }
337 
347  int Detect( void* input, uint32_t width, uint32_t height, imageFormat format, Detection** detections, uint32_t overlay=OVERLAY_DEFAULT );
348 
359  int Detect( void* input, uint32_t width, uint32_t height, imageFormat format, Detection* detections, uint32_t overlay=OVERLAY_DEFAULT );
360 
371  int Detect( float* input, uint32_t width, uint32_t height, Detection** detections, uint32_t overlay=OVERLAY_DEFAULT );
372 
384  int Detect( float* input, uint32_t width, uint32_t height, Detection* detections, uint32_t overlay=OVERLAY_DEFAULT );
385 
393  template<typename T> bool Overlay( T* input, T* output, uint32_t width, uint32_t height, Detection* detections, uint32_t numDetections, uint32_t flags=OVERLAY_DEFAULT ) { return Overlay(input, output, width, height, imageFormatFromType<T>(), detections, numDetections, flags); }
394 
402  bool Overlay( void* input, void* output, uint32_t width, uint32_t height, imageFormat format, Detection* detections, uint32_t numDetections, uint32_t flags=OVERLAY_DEFAULT );
403 
408  inline float GetThreshold() const { return mConfidenceThreshold; }
409 
414  inline void SetThreshold( float threshold ) { mConfidenceThreshold = threshold; }
415 
419  inline float GetConfidenceThreshold() const { return mConfidenceThreshold; }
420 
424  inline void SetConfidenceThreshold( float threshold ) { mConfidenceThreshold = threshold; }
425 
429  inline float GetClusteringThreshold() const { return mClusteringThreshold; }
430 
434  inline void SetClusteringThreshold( float threshold ) { mClusteringThreshold = threshold; }
435 
439  inline objectTracker* GetTracker() const { return mTracker; }
440 
444  inline void SetTracker( objectTracker* tracker ) { mTracker = tracker; }
445 
450  inline uint32_t GetMaxDetections() const { return mMaxDetections; }
451 
455  inline uint32_t GetNumClasses() const { return mNumClasses; }
456 
460  inline const char* GetClassLabel( uint32_t index ) const { return GetClassDesc(index); }
461 
465  inline const char* GetClassDesc( uint32_t index ) const { if(index >= mClassDesc.size()) { printf("invalid class %u\n", index); return "Invalid"; } return mClassDesc[index].c_str(); }
466 
470  inline const char* GetClassSynset( uint32_t index ) const { return mClassSynset[index].c_str(); }
471 
475  inline const char* GetClassPath() const { return mClassPath.c_str(); }
476 
480  inline float4 GetClassColor( uint32_t classIndex ) const { return mClassColors[classIndex]; }
481 
485  inline void SetClassColor( uint32_t classIndex, const float4& color ) { mClassColors[classIndex] = color; }
486 
490  inline void SetClassColor( uint32_t classIndex, float r, float g, float b, float a=255.0f ) { mClassColors[classIndex] = make_float4(r,g,b,a); }
491 
495  inline float GetLineWidth() const { return mLineWidth; }
496 
500  inline void SetLineWidth( float width ) { mLineWidth = width; }
501 
505  inline float GetOverlayAlpha() const { return mOverlayAlpha; }
506 
510  void SetOverlayAlpha( float alpha );
511 
512 protected:
513 
514  // constructor
515  detectNet( float meanPixel=0.0f );
516 
517  bool allocDetections();
518 
519  bool loadClassInfo( const char* filename );
520  bool loadClassColors( const char* filename );
521 
522  bool init( const char* prototxt_path, const char* model_path, const char* class_labels, const char* class_colors,
523  float threshold, const char* input, const char* coverage, const char* bboxes, uint32_t maxBatchSize,
524  precisionType precision, deviceType device, bool allowGPUFallback );
525 
526  bool preProcess( void* input, uint32_t width, uint32_t height, imageFormat format );
527  int postProcess( void* input, uint32_t width, uint32_t height, imageFormat format, Detection* detections );
528 
529  int postProcessSSD_UFF( Detection* detections, uint32_t width, uint32_t height );
530  int postProcessSSD_ONNX( Detection* detections, uint32_t width, uint32_t height );
531  int postProcessDetectNet( Detection* detections, uint32_t width, uint32_t height );
532  int postProcessDetectNet_v2( Detection* detections, uint32_t width, uint32_t height );
533 
534  int clusterDetections( Detection* detections, int n );
535  void sortDetections( Detection* detections, int numDetections );
536 
538 
539  float mConfidenceThreshold; // TODO change this to per-class
540  float mClusteringThreshold; // TODO change this to per-class
541 
542  float mMeanPixel;
543  float mLineWidth;
545 
546  float4* mClassColors;
547 
548  std::vector<std::string> mClassDesc;
549  std::vector<std::string> mClassSynset;
550 
551  std::string mClassPath;
552  uint32_t mNumClasses;
553 
554  Detection* mDetectionSets; // list of detections, mNumDetectionSets * mMaxDetections
555  uint32_t mDetectionSet; // index of next detection set to use
556  uint32_t mMaxDetections; // number of raw detections in the grid
557 
558  static const uint32_t mNumDetectionSets = 16; // size of detection ringbuffer
559 };
560 
561 
562 // bounding box IOU
563 inline float detectNet::Detection::IOU( float x1, float y1, float x2, float y2 ) const
564 {
565  const float overlap_x0 = fmaxf(Left, x1);
566  const float overlap_y0 = fmaxf(Top, y1);
567  const float overlap_x1 = fminf(Right, x2);
568  const float overlap_y1 = fminf(Bottom, y2);
569 
570  // check if there is an overlap
571  if( (overlap_x1 - overlap_x0 <= 0) || (overlap_y1 - overlap_y0 <= 0) )
572  return 0;
573 
574  // calculate the ratio of the overlap to each ROI size and the unified size
575  const float size_1 = Area();
576  const float size_2 = Area(x1, y1, x2, y2);
577 
578  const float size_intersection = (overlap_x1 - overlap_x0) * (overlap_y1 - overlap_y0);
579  const float size_union = size_1 + size_2 - size_intersection;
580 
581  return size_intersection / size_union;
582 }
583 
584 
585 #endif
detectNet::GetClassPath
const char * GetClassPath() const
Retrieve the path to the file containing the class descriptions.
Definition: detectNet.h:475
detectNet::Detection::Confidence
float Confidence
Confidence value of the detected object.
Definition: detectNet.h:126
detectNet::OVERLAY_NONE
@ OVERLAY_NONE
No overlay.
Definition: detectNet.h:206
detectNet::Detection::Left
float Left
Left bounding box coordinate (in pixels)
Definition: detectNet.h:135
detectNet::SetConfidenceThreshold
void SetConfidenceThreshold(float threshold)
Set the minimum threshold for detection.
Definition: detectNet.h:424
detectNet::OVERLAY_DEFAULT
@ OVERLAY_DEFAULT
The default choice of overlay.
Definition: detectNet.h:212
detectNet::postProcessDetectNet
int postProcessDetectNet(Detection *detections, uint32_t width, uint32_t height)
detectNet::GetOverlayAlpha
float GetOverlayAlpha() const
Retrieve the overlay alpha blending value for classes that don't have it explicitly set (between 0-25...
Definition: detectNet.h:505
DETECTNET_DEFAULT_COVERAGE
#define DETECTNET_DEFAULT_COVERAGE
Name of default output blob of the coverage map for DetectNet caffe model.
Definition: detectNet.h:40
detectNet::Detection::TrackStatus
int TrackStatus
-1 for dropped, 0 for initializing, 1 for active/valid
Definition: detectNet.h:130
detectNet::Detection::IOU
float IOU(float x1, float y1, float x2, float y2) const
Return true if the bounding boxes overlap.
Definition: detectNet.h:563
detectNet::GetThreshold
float GetThreshold() const
Retrieve the minimum threshold for detection.
Definition: detectNet.h:408
detectNet::GetConfidenceThreshold
float GetConfidenceThreshold() const
Retrieve the minimum threshold for detection.
Definition: detectNet.h:419
detectNet::preProcess
bool preProcess(void *input, uint32_t width, uint32_t height, imageFormat format)
color
uchar3 color
The RGB color of the point.
Definition: cudaPointCloud.h:11
detectNet::SetClusteringThreshold
void SetClusteringThreshold(float threshold)
Set the overlapping area % threshold for clustering.
Definition: detectNet.h:434
detectNet::mClassPath
std::string mClassPath
Definition: detectNet.h:551
detectNet::Detection::Detection
Detection()
Definition: detectNet.h:198
detectNet::mClusteringThreshold
float mClusteringThreshold
Definition: detectNet.h:540
detectNet::OVERLAY_CONFIDENCE
@ OVERLAY_CONFIDENCE
Overlay the detection confidence values.
Definition: detectNet.h:209
detectNet::Detect
int Detect(T *image, uint32_t width, uint32_t height, Detection *detections, uint32_t overlay=OVERLAY_DEFAULT)
Detect object locations in an image, into an array of the results allocated by the user.
Definition: detectNet.h:336
DETECTNET_DEFAULT_INPUT
#define DETECTNET_DEFAULT_INPUT
Name of default input blob for DetectNet caffe model.
Definition: detectNet.h:34
detectNet
Object recognition and localization networks with TensorRT support.
Definition: detectNet.h:116
detectNet::mTracker
objectTracker * mTracker
Definition: detectNet.h:537
detectNet::sortDetections
void sortDetections(Detection *detections, int numDetections)
detectNet::Detection
Object Detection result.
Definition: detectNet.h:122
detectNet::mMeanPixel
float mMeanPixel
Definition: detectNet.h:542
DEVICE_GPU
@ DEVICE_GPU
GPU (if multiple GPUs are present, a specific GPU can be selected with cudaSetDevice()
Definition: tensorNet.h:131
detectNet::mNumClasses
uint32_t mNumClasses
Definition: detectNet.h:552
detectNet::mClassColors
float4 * mClassColors
Definition: detectNet.h:546
detectNet::GetClassLabel
const char * GetClassLabel(uint32_t index) const
Retrieve the description of a particular class.
Definition: detectNet.h:460
Dims3
nvinfer1::Dims3 Dims3
Definition: tensorNet.h:58
detectNet::OverlayFlagsFromStr
static uint32_t OverlayFlagsFromStr(const char *flags)
Parse a string sequence into OverlayFlags enum.
detectNet::SetClassColor
void SetClassColor(uint32_t classIndex, float r, float g, float b, float a=255.0f)
Set the visualization color of a particular class of object.
Definition: detectNet.h:490
deviceType
deviceType
Enumeration for indicating the desired device that the network should run on, if available in hardwar...
Definition: tensorNet.h:129
detectNet::Detection::ClassID
uint32_t ClassID
Class index of the detected object.
Definition: detectNet.h:125
detectNet::SetLineWidth
void SetLineWidth(float width)
Set the line width used during overlay when OVERLAY_LINES is used.
Definition: detectNet.h:500
tensorNet.h
TYPE_FASTEST
@ TYPE_FASTEST
The fastest detected precision should be use (i.e.
Definition: tensorNet.h:105
detectNet::SetClassColor
void SetClassColor(uint32_t classIndex, const float4 &color)
Set the visualization color of a particular class of object.
Definition: detectNet.h:485
detectNet::postProcess
int postProcess(void *input, uint32_t width, uint32_t height, imageFormat format, Detection *detections)
detectNet::clusterDetections
int clusterDetections(Detection *detections, int n)
detectNet::OverlayFlags
OverlayFlags
Overlay flags (can be OR'd together).
Definition: detectNet.h:204
fminf
float fminf(float a, float b)
Definition: cudaMath.h:51
detectNet::loadClassColors
bool loadClassColors(const char *filename)
detectNet::SetOverlayAlpha
void SetOverlayAlpha(float alpha)
Set overlay alpha blending value for all classes (between 0-255).
precisionType
precisionType
Enumeration for indicating the desired precision that the network should run in, if available in hard...
Definition: tensorNet.h:102
detectNet::mClassSynset
std::vector< std::string > mClassSynset
Definition: detectNet.h:549
detectNet::mOverlayAlpha
float mOverlayAlpha
Definition: detectNet.h:544
detectNet::~detectNet
virtual ~detectNet()
Destory.
detectNet::mDetectionSet
uint32_t mDetectionSet
Definition: detectNet.h:555
objectTracker
Object tracker interface.
Definition: objectTracker.h:52
detectNet::GetTracker
objectTracker * GetTracker() const
Get the object tracker being used.
Definition: detectNet.h:439
detectNet::postProcessSSD_UFF
int postProcessSSD_UFF(Detection *detections, uint32_t width, uint32_t height)
detectNet::GetMaxDetections
uint32_t GetMaxDetections() const
Retrieve the maximum number of simultaneous detections the network supports.
Definition: detectNet.h:450
detectNet::OVERLAY_LABEL
@ OVERLAY_LABEL
Overlay the class description labels.
Definition: detectNet.h:208
detectNet::Detection::TrackLost
int TrackLost
The number of consecutive frames tracking has been lost for.
Definition: detectNet.h:132
detectNet::GetClassDesc
const char * GetClassDesc(uint32_t index) const
Retrieve the description of a particular class.
Definition: detectNet.h:465
detectNet::Create
static detectNet * Create(const char *network="ssd-mobilenet-v2", float threshold=DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD, uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE, precisionType precision=TYPE_FASTEST, deviceType device=DEVICE_GPU, bool allowGPUFallback=true)
Load a pre-trained model.
tensorNet
Abstract class for loading a tensor network with TensorRT.
Definition: tensorNet.h:218
detectNet::init
bool init(const char *prototxt_path, const char *model_path, const char *class_labels, const char *class_colors, float threshold, const char *input, const char *coverage, const char *bboxes, uint32_t maxBatchSize, precisionType precision, deviceType device, bool allowGPUFallback)
detectNet::mNumDetectionSets
static const uint32_t mNumDetectionSets
Definition: detectNet.h:558
detectNet::OVERLAY_BOX
@ OVERLAY_BOX
Overlay the object bounding boxes (filled)
Definition: detectNet.h:207
detectNet::SetThreshold
void SetThreshold(float threshold)
Set the minimum threshold for detection.
Definition: detectNet.h:414
detectNet::mConfidenceThreshold
float mConfidenceThreshold
Definition: detectNet.h:539
detectNet::Detection::TrackID
int TrackID
Unique tracking ID (or -1 if untracked)
Definition: detectNet.h:129
make_float4
__host__ __device__ float4 make_float4(float s)
Definition: cudaMath.h:248
detectNet::Detection::Right
float Right
Right bounding box coordinate (in pixels)
Definition: detectNet.h:136
detectNet::mDetectionSets
Detection * mDetectionSets
Definition: detectNet.h:554
detectNet::Overlay
bool Overlay(T *input, T *output, uint32_t width, uint32_t height, Detection *detections, uint32_t numDetections, uint32_t flags=OVERLAY_DEFAULT)
Draw the detected bounding boxes overlayed on an RGBA image.
Definition: detectNet.h:393
detectNet::loadClassInfo
bool loadClassInfo(const char *filename)
detectNet::mMaxDetections
uint32_t mMaxDetections
Definition: detectNet.h:556
detectNet::GetNumClasses
uint32_t GetNumClasses() const
Retrieve the number of object classes supported in the detector.
Definition: detectNet.h:455
detectNet::Detection::Bottom
float Bottom
Bottom bounding box coordinate (in pixels)
Definition: detectNet.h:138
DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD
#define DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD
Default value of the minimum detection threshold.
Definition: detectNet.h:52
detectNet::GetClassColor
float4 GetClassColor(uint32_t classIndex) const
Retrieve the RGBA visualization color a particular class.
Definition: detectNet.h:480
detectNet::mClassDesc
std::vector< std::string > mClassDesc
Definition: detectNet.h:548
detectNet::OVERLAY_TRACKING
@ OVERLAY_TRACKING
Overlay tracking information (like track ID)
Definition: detectNet.h:210
detectNet::GetLineWidth
float GetLineWidth() const
Retrieve the line width used during overlay when OVERLAY_LINES is used.
Definition: detectNet.h:495
DEFAULT_MAX_BATCH_SIZE
#define DEFAULT_MAX_BATCH_SIZE
Default maximum batch size.
Definition: tensorNet.h:88
detectNet::allocDetections
bool allocDetections()
detectNet::detectNet
detectNet(float meanPixel=0.0f)
detectNet::GetClassSynset
const char * GetClassSynset(uint32_t index) const
Retrieve the class synset category of a particular class.
Definition: detectNet.h:470
detectNet::Detection::TrackFrames
int TrackFrames
The number of frames the object has been re-identified for.
Definition: detectNet.h:131
detectNet::Detect
int Detect(T *image, uint32_t width, uint32_t height, Detection **detections, uint32_t overlay=OVERLAY_DEFAULT)
Detect object locations from an image, returning an array containing the detection results.
Definition: detectNet.h:324
detectNet::SetTracker
void SetTracker(objectTracker *tracker)
Set the object tracker to be used.
Definition: detectNet.h:444
detectNet::Detection::Top
float Top
Top bounding box cooridnate (in pixels)
Definition: detectNet.h:137
detectNet::mLineWidth
float mLineWidth
Definition: detectNet.h:543
fmaxf
float fmaxf(float a, float b)
Definition: cudaMath.h:56
commandLine
Command line parser for extracting flags, values, and strings.
Definition: commandLine.h:35
detectNet::Usage
static const char * Usage()
Usage string for command line arguments to Create()
Definition: detectNet.h:308
DETECTNET_DEFAULT_BBOX
#define DETECTNET_DEFAULT_BBOX
Name of default output blob of the grid of bounding boxes for DetectNet caffe model.
Definition: detectNet.h:46
detectNet::OVERLAY_LINES
@ OVERLAY_LINES
Overlay the bounding box lines (unfilled)
Definition: detectNet.h:211
detectNet::postProcessDetectNet_v2
int postProcessDetectNet_v2(Detection *detections, uint32_t width, uint32_t height)
DETECTNET_USAGE_STRING
#define DETECTNET_USAGE_STRING
Standard command-line options able to be passed to detectNet::Create()
Definition: detectNet.h:83
imageFormat
imageFormat
The imageFormat enum is used to identify the pixel format and colorspace of an image.
Definition: imageFormat.h:49
detectNet::GetClusteringThreshold
float GetClusteringThreshold() const
Retrieve the overlapping area % threshold for clustering.
Definition: detectNet.h:429
alpha
__device__ cudaVectorTypeInfo< T >::Base alpha(T vec, typename cudaVectorTypeInfo< T >::Base default_alpha=255)
Definition: cudaVector.h:98
detectNet::postProcessSSD_ONNX
int postProcessSSD_ONNX(Detection *detections, uint32_t width, uint32_t height)