Jetson Inference
DNN Vision Library
objectTrackerIOU.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022, 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 __OBJECT_TRACKER_IOU_H__
24 #define __OBJECT_TRACKER_IOU_H__
25 
26 
27 #include "objectTracker.h"
28 
29 
34 #define OBJECT_TRACKER_DEFAULT_MIN_FRAMES 3
35 
40 #define OBJECT_TRACKER_DEFAULT_DROP_FRAMES 15
41 
45 #define OBJECT_TRACKER_DEFAULT_OVERLAP_THRESHOLD 0.5
46 
47 
60 {
61 public:
67  static objectTrackerIOU* Create( uint32_t minFrames=OBJECT_TRACKER_DEFAULT_MIN_FRAMES,
68  uint32_t dropFrames=OBJECT_TRACKER_DEFAULT_DROP_FRAMES,
69  float overlapThreshold=OBJECT_TRACKER_DEFAULT_OVERLAP_THRESHOLD );
70 
74  static objectTrackerIOU* Create( int argc, char** argv );
75 
79  static objectTrackerIOU* Create( const commandLine& cmdLine );
80 
84  virtual ~objectTrackerIOU();
85 
89  inline uint32_t GetMinFrames() const { return mMinFrames; }
90 
94  inline void SetMinFrames( uint32_t frames ) { mMinFrames = frames; }
95 
99  inline uint32_t GetDropFrames() const { return mDropFrames; }
100 
104  inline void SetDropFrames( uint32_t frames ) { mDropFrames = frames; }
105 
109  inline float GetOverlapThreshold() const { return mOverlapThreshold; }
110 
114  inline void SetOverlapThreshold( float threshold ) { mOverlapThreshold = threshold; }
115 
119  inline virtual Type GetType() const { return IOU; }
120 
124  virtual int Process( void* image, uint32_t width, uint32_t height, imageFormat format, detectNet::Detection* detections, int numDetections );
125 
126 protected:
127  objectTrackerIOU( uint32_t minFrames, uint32_t dropFrames, float overlapThreshold );
128 
129  uint32_t mIDCount;
130  uint64_t mFrameCount;
131 
132  uint32_t mMinFrames;
133  uint32_t mDropFrames;
134 
136 
137  std::vector<detectNet::Detection> mTracks;
138 };
139 
140 #endif
OBJECT_TRACKER_DEFAULT_MIN_FRAMES
#define OBJECT_TRACKER_DEFAULT_MIN_FRAMES
The number of re-identified frames before establishing a track.
Definition: objectTrackerIOU.h:34
objectTrackerIOU::mIDCount
uint32_t mIDCount
Definition: objectTrackerIOU.h:129
objectTrackerIOU::mFrameCount
uint64_t mFrameCount
Definition: objectTrackerIOU.h:130
objectTrackerIOU::SetOverlapThreshold
void SetOverlapThreshold(float threshold)
Set how much IOU overlap is required for a bounding box to be matched.
Definition: objectTrackerIOU.h:114
detectNet::Detection
Object Detection result.
Definition: detectNet.h:122
objectTrackerIOU::SetDropFrames
void SetDropFrames(uint32_t frames)
Set the number of consecutive lost frames after which a track is removed.
Definition: objectTrackerIOU.h:104
objectTrackerIOU
Object tracker using Intersection-Over-Union (IOU)
Definition: objectTrackerIOU.h:59
objectTrackerIOU::GetType
virtual Type GetType() const
Definition: objectTrackerIOU.h:119
objectTrackerIOU::GetMinFrames
uint32_t GetMinFrames() const
The number of re-identified frames before before establishing a track.
Definition: objectTrackerIOU.h:89
objectTrackerIOU::mMinFrames
uint32_t mMinFrames
Definition: objectTrackerIOU.h:132
objectTrackerIOU::objectTrackerIOU
objectTrackerIOU(uint32_t minFrames, uint32_t dropFrames, float overlapThreshold)
objectTrackerIOU::~objectTrackerIOU
virtual ~objectTrackerIOU()
Destroy.
objectTrackerIOU::GetOverlapThreshold
float GetOverlapThreshold() const
How much IOU overlap is required for a bounding box to be matched.
Definition: objectTrackerIOU.h:109
objectTracker::IOU
@ IOU
Intersection-Over-Union (IOU) tracker.
Definition: objectTracker.h:61
objectTrackerIOU::mTracks
std::vector< detectNet::Detection > mTracks
Definition: objectTrackerIOU.h:137
objectTracker
Object tracker interface.
Definition: objectTracker.h:52
OBJECT_TRACKER_DEFAULT_OVERLAP_THRESHOLD
#define OBJECT_TRACKER_DEFAULT_OVERLAP_THRESHOLD
How much IOU overlap is required for a bounding box to be matched.
Definition: objectTrackerIOU.h:45
objectTracker::Type
Type
Tracker type enum.
Definition: objectTracker.h:58
objectTrackerIOU::GetDropFrames
uint32_t GetDropFrames() const
The number of consecutive lost frames after which a track is removed.
Definition: objectTrackerIOU.h:99
objectTrackerIOU::mOverlapThreshold
float mOverlapThreshold
Definition: objectTrackerIOU.h:135
objectTrackerIOU::SetMinFrames
void SetMinFrames(uint32_t frames)
Set the number of re-identified frames before before establishing a track.
Definition: objectTrackerIOU.h:94
objectTrackerIOU::mDropFrames
uint32_t mDropFrames
Definition: objectTrackerIOU.h:133
OBJECT_TRACKER_DEFAULT_DROP_FRAMES
#define OBJECT_TRACKER_DEFAULT_DROP_FRAMES
The number of consecutive lost frames after which a track is removed.
Definition: objectTrackerIOU.h:40
objectTrackerIOU::Create
static objectTrackerIOU * Create(uint32_t minFrames=OBJECT_TRACKER_DEFAULT_MIN_FRAMES, uint32_t dropFrames=OBJECT_TRACKER_DEFAULT_DROP_FRAMES, float overlapThreshold=OBJECT_TRACKER_DEFAULT_OVERLAP_THRESHOLD)
Create a new object tracker.
commandLine
Command line parser for extracting flags, values, and strings.
Definition: commandLine.h:35
objectTracker.h
imageFormat
imageFormat
The imageFormat enum is used to identify the pixel format and colorspace of an image.
Definition: imageFormat.h:49
objectTrackerIOU::Process
virtual int Process(void *image, uint32_t width, uint32_t height, imageFormat format, detectNet::Detection *detections, int numDetections)