docs/html/detectNet_8h_source.html
| | 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:
123 {
124// Detection Info
126float Confidence;
128// Tracking Info
130int TrackStatus;
131int TrackFrames;
134// Bounding Box Coordinates
141inline float Width() const { return Right - Left; }
142
144inline float Height() const { return Bottom - Top; }
145
147inline float Area() const { return Width() * Height(); }
148
150static inline float Width( float x1, float x2 ) { return x2 - x1; }
151
153static inline float Height( float y1, float y2 ) { return y2 - y1; }
154
156static inline float Area( float x1, float y1, float x2, float y2 ) { return Width(x1,x2) * Height(y1,y2); }
157
159inline void Center( float* x, float* y ) const { if(x) *x = Left + Width() * 0.5f; if(y) *y = Top + Height() * 0.5f; }
160
162inline bool Contains( float x, float y ) const { return x >= Left && x <= Right && y >= Top && y <= Bottom; }
163
165inline bool Intersects( const Detection& det, float areaThreshold=0.0f ) const { return (IntersectionArea(det) / fmaxf(Area(), det.Area()) > areaThreshold); }
166
168inline 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
171inline float IntersectionArea( const Detection& det ) const { return IntersectionArea(det.Left, det.Top, det.Right, det.Bottom); }
172
174inline 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
177inline float IOU( const Detection& det ) const { return IOU(det.Left, det.Top, det.Right, det.Bottom); }
178
180inline float IOU( float x1, float y1, float x2, float y2 ) const;
181
183inline bool Overlaps( const Detection& det ) const { return !(det.Left > Right || det.Right < Left || det.Top > Bottom || det.Bottom < Top); }
184
186inline bool Overlaps( float x1, float y1, float x2, float y2 ) const { return !(x1 > Right || x2 < Left || y1 > Bottom || y2 < Top); }
187
189inline 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
192inline 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
195inline void Reset() { ClassID = 0; Confidence = 0; TrackID = -1; TrackStatus = -1; TrackFrames = 0; TrackLost = 0; Left = 0; Right = 0; Top = 0; Bottom = 0; }
196
198inline Detection() { Reset(); }
199 };
200
204enum OverlayFlags
205 {
206OVERLAY_NONE = 0,
207OVERLAY_BOX = (1 << 0),
208OVERLAY_LABEL = (1 << 1),
209OVERLAY_CONFIDENCE = (1 << 2),
210OVERLAY_TRACKING = (1 << 3),
211OVERLAY_LINES = (1 << 4),
212OVERLAY_DEFAULT = OVERLAY_BOX|OVERLAY_LABEL|OVERLAY_CONFIDENCE,
213 };
214
221static uint32_t OverlayFlagsFromStr( const char* flags );
222
229static 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,
231deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
232
245static detectNet* Create( const char* prototxt_path, const char* model_path, float mean_pixel=0.0f,
246const char* class_labels=NULL, float threshold=DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD,
247const char* input = DETECTNET_DEFAULT_INPUT,
248const char* coverage = DETECTNET_DEFAULT_COVERAGE,
249const char* bboxes = DETECTNET_DEFAULT_BBOX,
250 uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE,
251precisionType precision=TYPE_FASTEST,
252deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
253
267static detectNet* Create( const char* prototxt_path, const char* model_path, float mean_pixel,
268const char* class_labels, const char* class_colors,
269float threshold=DETECTNET_DEFAULT_CONFIDENCE_THRESHOLD,
270const char* input = DETECTNET_DEFAULT_INPUT,
271const char* coverage = DETECTNET_DEFAULT_COVERAGE,
272const char* bboxes = DETECTNET_DEFAULT_BBOX,
273 uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE,
274precisionType precision=TYPE_FASTEST,
275deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
276
288static detectNet* Create( const char* model_path, const char* class_labels, float threshold,
289const char* input, const Dims3& inputDims,
290const char* output, const char* numDetections,
291 uint32_t maxBatchSize=DEFAULT_MAX_BATCH_SIZE,
292precisionType precision=TYPE_FASTEST,
293deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
294
298static detectNet* Create( int argc, char** argv );
299
303static detectNet* Create( const commandLine& cmdLine );
304
308static inline const char* Usage() { return DETECTNET_USAGE_STRING; }
309
313virtual ~detectNet();
314
324template<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
336template<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
347int Detect( void* input, uint32_t width, uint32_t height, imageFormat format, Detection** detections, uint32_t overlay=OVERLAY_DEFAULT );
348
359int Detect( void* input, uint32_t width, uint32_t height, imageFormat format, Detection* detections, uint32_t overlay=OVERLAY_DEFAULT );
360
371int Detect( float* input, uint32_t width, uint32_t height, Detection** detections, uint32_t overlay=OVERLAY_DEFAULT );
372
384int Detect( float* input, uint32_t width, uint32_t height, Detection* detections, uint32_t overlay=OVERLAY_DEFAULT );
385
393template<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
402bool Overlay( void* input, void* output, uint32_t width, uint32_t height, imageFormat format, Detection* detections, uint32_t numDetections, uint32_t flags=OVERLAY_DEFAULT );
403
408inline float GetThreshold() const { return mConfidenceThreshold; }
409
414inline void SetThreshold( float threshold ) { mConfidenceThreshold = threshold; }
415
419inline float GetConfidenceThreshold() const { return mConfidenceThreshold; }
420
424inline void SetConfidenceThreshold( float threshold ) { mConfidenceThreshold = threshold; }
425
429inline float GetClusteringThreshold() const { return mClusteringThreshold; }
430
434inline void SetClusteringThreshold( float threshold ) { mClusteringThreshold = threshold; }
435
439inline objectTracker* GetTracker() const { return mTracker; }
440
444inline void SetTracker( objectTracker* tracker ) { mTracker = tracker; }
445
450inline uint32_t GetMaxDetections() const { return mMaxDetections; }
451
455inline uint32_t GetNumClasses() const { return mNumClasses; }
456
460inline const char* GetClassLabel( uint32_t index ) const { return GetClassDesc(index); }
461
465inline 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
470inline const char* GetClassSynset( uint32_t index ) const { return mClassSynset[index].c_str(); }
471
475inline const char* GetClassPath() const { return mClassPath.c_str(); }
476
480inline float4 GetClassColor( uint32_t classIndex ) const { return mClassColors[classIndex]; }
481
485inline void SetClassColor( uint32_t classIndex, const float4& color ) { mClassColors[classIndex] = color; }
486
490inline void SetClassColor( uint32_t classIndex, float r, float g, float b, float a=255.0f ) { mClassColors[classIndex] = make_float4(r,g,b,a); }
491
495inline float GetLineWidth() const { return mLineWidth; }
496
500inline void SetLineWidth( float width ) { mLineWidth = width; }
501
505inline float GetOverlayAlpha() const { return mOverlayAlpha; }
506
510void SetOverlayAlpha( float alpha );
511
512 protected:
513
514// constructor
515detectNet( float meanPixel=0.0f );
516
517bool allocDetections();
518
519bool loadClassInfo( const char* filename );
520bool loadClassColors( const char* filename );
521
522bool init( const char* prototxt_path, const char* model_path, const char* class_labels, const char* class_colors,
523float threshold, const char* input, const char* coverage, const char* bboxes, uint32_t maxBatchSize,
524precisionType precision, deviceType device, bool allowGPUFallback );
525
526bool preProcess( void* input, uint32_t width, uint32_t height, imageFormat format );
527int postProcess( void* input, uint32_t width, uint32_t height, imageFormat format, Detection* detections );
528
529int postProcessSSD_UFF( Detection* detections, uint32_t width, uint32_t height );
530int postProcessSSD_ONNX( Detection* detections, uint32_t width, uint32_t height );
531int postProcessDetectNet( Detection* detections, uint32_t width, uint32_t height );
532int postProcessDetectNet_v2( Detection* detections, uint32_t width, uint32_t height );
533
534int clusterDetections( Detection* detections, int n );
535void sortDetections( Detection* detections, int numDetections );
536
538
539float mConfidenceThreshold; // TODO change this to per-class
540float mClusteringThreshold; // TODO change this to per-class
541
542float mMeanPixel;
543float mLineWidth;
544float mOverlayAlpha;
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
554Detection* 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
558static 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 {
565const float overlap_x0 = fmaxf(Left, x1);
566const float overlap_y0 = fmaxf(Top, y1);
567const float overlap_x1 = fminf(Right, x2);
568const float overlap_y1 = fminf(Bottom, y2);
569
570// check if there is an overlap
571if( (overlap_x1 - overlap_x0 <= 0) || (overlap_y1 - overlap_y0 <= 0) )
572return 0;
573
574// calculate the ratio of the overlap to each ROI size and the unified size
575const float size_1 = Area();
576const float size_2 = Area(x1, y1, x2, y2);
577
578const float size_intersection = (overlap_x1 - overlap_x0) * (overlap_y1 - overlap_y0);
579const float size_union = size_1 + size_2 - size_intersection;
580
581return size_intersection / size_union;
582 }
583
584
585 #endif
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
@ OVERLAY_NONE
No overlay.
Definition: detectNet.h:206
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
@ OVERLAY_DEFAULT
The default choice of overlay.
Definition: detectNet.h:212
detectNet::postProcessDetectNet
int postProcessDetectNet(Detection *detections, uint32_t width, uint32_t height)
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
#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
float IOU(float x1, float y1, float x2, float y2) const
Return true if the bounding boxes overlap.
Definition: detectNet.h:563
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
bool preProcess(void *input, uint32_t width, uint32_t height, imageFormat format)
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
std::string mClassPath
Definition: detectNet.h:551
detectNet::Detection::Detection
Detection()
Definition: detectNet.h:198
detectNet::mClusteringThreshold
float mClusteringThreshold
Definition: detectNet.h:540
@ OVERLAY_CONFIDENCE
Overlay the detection confidence values.
Definition: detectNet.h:209
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
#define DETECTNET_DEFAULT_INPUT
Name of default input blob for DetectNet caffe model.
Definition: detectNet.h:34
Object recognition and localization networks with TensorRT support.
Definition: detectNet.h:116
objectTracker * mTracker
Definition: detectNet.h:537
void sortDetections(Detection *detections, int numDetections)
Object Detection result.
Definition: detectNet.h:122
float mMeanPixel
Definition: detectNet.h:542
@ DEVICE_GPU
GPU (if multiple GPUs are present, a specific GPU can be selected with cudaSetDevice()
Definition: tensorNet.h:131
uint32_t mNumClasses
Definition: detectNet.h:552
float4 * mClassColors
Definition: detectNet.h:546
const char * GetClassLabel(uint32_t index) const
Retrieve the description of a particular class.
Definition: detectNet.h:460
nvinfer1::Dims3 Dims3
Definition: tensorNet.h:58
detectNet::OverlayFlagsFromStr
static uint32_t OverlayFlagsFromStr(const char *flags)
Parse a string sequence into OverlayFlags enum.
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
Enumeration for indicating the desired device that the network should run on, if available in hardwar...
Definition: tensorNet.h:129
uint32_t ClassID
Class index of the detected object.
Definition: detectNet.h:125
void SetLineWidth(float width)
Set the line width used during overlay when OVERLAY_LINES is used.
Definition: detectNet.h:500
@ TYPE_FASTEST
The fastest detected precision should be use (i.e.
Definition: tensorNet.h:105
void SetClassColor(uint32_t classIndex, const float4 &color)
Set the visualization color of a particular class of object.
Definition: detectNet.h:485
int postProcess(void *input, uint32_t width, uint32_t height, imageFormat format, Detection *detections)
int clusterDetections(Detection *detections, int n)
OverlayFlags
Overlay flags (can be OR'd together).
Definition: detectNet.h:204
float fminf(float a, float b)
Definition: cudaMath.h:51
bool loadClassColors(const char *filename)
void SetOverlayAlpha(float alpha)
Set overlay alpha blending value for all classes (between 0-255).
precisionType
Enumeration for indicating the desired precision that the network should run in, if available in hard...
Definition: tensorNet.h:102
std::vector< std::string > mClassSynset
Definition: detectNet.h:549
float mOverlayAlpha
Definition: detectNet.h:544
virtual ~detectNet()
Destory.
uint32_t mDetectionSet
Definition: detectNet.h:555
Object tracker interface.
Definition: objectTracker.h:52
objectTracker * GetTracker() const
Get the object tracker being used.
Definition: detectNet.h:439
int postProcessSSD_UFF(Detection *detections, uint32_t width, uint32_t height)
uint32_t GetMaxDetections() const
Retrieve the maximum number of simultaneous detections the network supports.
Definition: detectNet.h:450
@ 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
const char * GetClassDesc(uint32_t index) const
Retrieve the description of a particular class.
Definition: detectNet.h:465
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.
Abstract class for loading a tensor network with TensorRT.
Definition: tensorNet.h:218
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)
static const uint32_t mNumDetectionSets
Definition: detectNet.h:558
@ OVERLAY_BOX
Overlay the object bounding boxes (filled)
Definition: detectNet.h:207
void SetThreshold(float threshold)
Set the minimum threshold for detection.
Definition: detectNet.h:414
detectNet::mConfidenceThreshold
float mConfidenceThreshold
Definition: detectNet.h:539
int TrackID
Unique tracking ID (or -1 if untracked)
Definition: detectNet.h:129
__host__ __device__ float4 make_float4(float s)
Definition: cudaMath.h:248
float Right
Right bounding box coordinate (in pixels)
Definition: detectNet.h:136
Detection * mDetectionSets
Definition: detectNet.h:554
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
bool loadClassInfo(const char *filename)
uint32_t mMaxDetections
Definition: detectNet.h:556
uint32_t GetNumClasses() const
Retrieve the number of object classes supported in the detector.
Definition: detectNet.h:455
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
float4 GetClassColor(uint32_t classIndex) const
Retrieve the RGBA visualization color a particular class.
Definition: detectNet.h:480
std::vector< std::string > mClassDesc
Definition: detectNet.h:548
@ OVERLAY_TRACKING
Overlay tracking information (like track ID)
Definition: detectNet.h:210
float GetLineWidth() const
Retrieve the line width used during overlay when OVERLAY_LINES is used.
Definition: detectNet.h:495
#define DEFAULT_MAX_BATCH_SIZE
Default maximum batch size.
Definition: tensorNet.h:88
bool allocDetections()
detectNet(float meanPixel=0.0f)
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
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
void SetTracker(objectTracker *tracker)
Set the object tracker to be used.
Definition: detectNet.h:444
float Top
Top bounding box cooridnate (in pixels)
Definition: detectNet.h:137
float mLineWidth
Definition: detectNet.h:543
float fmaxf(float a, float b)
Definition: cudaMath.h:56
Command line parser for extracting flags, values, and strings.
Definition: commandLine.h:35
static const char * Usage()
Usage string for command line arguments to Create()
Definition: detectNet.h:308
#define DETECTNET_DEFAULT_BBOX
Name of default output blob of the grid of bounding boxes for DetectNet caffe model.
Definition: detectNet.h:46
@ 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)
#define DETECTNET_USAGE_STRING
Standard command-line options able to be passed to detectNet::Create()
Definition: detectNet.h:83
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
__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)