-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtracker.h
68 lines (56 loc) · 1.92 KB
/
tracker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include "metrics.h"
#include "kalman.h"
#include "../definition.h"
#include <vector>
#include <string>
#include <map>
using namespace std;
class SingleObjectTracker
{
public:
SingleObjectTracker(Box box0, float score0_, float max_staleness_ = 12.0, float smooth_score_gamma_ = 0.8,
float smooth_feature_gamma_ = 0.9);
~SingleObjectTracker();
Box box();
bool is_invalid();
void _predict();
void _update_box(Detection detection_);
void predict();
void update(Detection detection_);
float stale(float rate = 1.0);
float unstale(float rate = 2.0);
bool is_stale();
public:
int id;
float score;
float staleness;
int steps_positive;
int steps_alive;
bool invalid;
private:
float max_staleness;
float smooth_score_gamma;
float smooth_feature_gamma;
Kalman* _tracker;
};
class MultiObjectTracker
{
public:
MultiObjectTracker(float dt, int order_pos = 1, int dim_pos = 2,
int order_size = 0, int dim_size = 2,
float q_var_pos = 5000., float r_var_pos = 0.1);
~MultiObjectTracker();
vector<Track> active_tracks(float max_staleness_to_positive_ratio = 3.0,
float max_staleness = 999,
int min_steps_alive = -1);
void cleanup_trackers();
void remove_invalid();
tuple<vector<int>, map<int, int> > step(const vector<Detection*> detections);
public:
vector<SingleObjectTracker*> trackers;
};
tuple<cv::Mat, cv::Mat> cost_matrix_iou_feature(vector<SingleObjectTracker*> trackers,
vector<Detection*> detections);
vector<pair_track_det_idx> IOUAndFeatureMatchingFunction(vector<SingleObjectTracker*> trackers, vector<Detection*> detections, float min_iou = 0.1, float multi_match_min_iou = 1. + EPS);
void get_face_pose(FaceBox_ box, float* landmark, float* pose);