SSCMA-Micro CPP SDK  v2.0.0
SSCMA-Micro is a cross-platform machine learning inference framework designed for embedded devices.
strack.h
Go to the documentation of this file.
1 /*
2  * MIT License
3  * Copyright (c) 2021 Yifu Zhang
4  *
5  * Modified by nullptr, Aug 8, 2024, Seeed Technology Co.,Ltd
6 */
7 
8 #ifndef _BYTETRACK_STRACK_H_
9 #define _BYTETRACK_STRACK_H_
10 
11 #include <cfloat>
12 #include <cstddef>
13 #include <cstdint>
14 #include <vector>
15 
16 #include "kalman_filter.h"
17 
18 enum TrackState { New = 0, Tracked, Lost, Removed };
19 
20 class STrack {
21  public:
22  STrack(std::vector<float> tlwh_, float score, int label);
23  ~STrack();
24 
25  std::vector<float> static tlbr_to_tlwh(std::vector<float>& tlbr);
26  void static multi_predict(std::vector<STrack*>& stracks, KalmanFilter& kalman_filter);
27  void static_tlwh();
28  void static_tlbr();
29  std::vector<float> tlwh_to_xyah(std::vector<float> tlwh_tmp);
30  std::vector<float> to_xyah();
31  void mark_lost();
32  void mark_removed();
33  int next_id();
34  int end_frame();
35 
36  void activate(KalmanFilter& kalman_filter, int frame_id);
37  void re_activate(STrack& new_track, int frame_id, bool new_id = false);
38  void update(STrack& new_track, int frame_id);
39 
40  public:
42  int track_id;
43  int state;
44 
45  std::vector<float> _tlwh;
46  std::vector<float> tlwh;
47  std::vector<float> tlbr;
48 
49  int frame_id;
52 
55 
56  float score;
57  int label;
58 
59  private:
60  KalmanFilter kalman_filter;
61 };
62 
63 #endif
Definition: kalman_filter.h:39
Definition: strack.h:20
int track_id
Definition: strack.h:42
int tracklet_len
Definition: strack.h:50
std::vector< float > to_xyah()
Definition: strack.cpp:147
int frame_id
Definition: strack.h:49
KAL_MEAN mean
Definition: strack.h:53
float score
Definition: strack.h:56
std::vector< float > _tlwh
Definition: strack.h:45
int start_frame
Definition: strack.h:51
void activate(KalmanFilter &kalman_filter, int frame_id)
Definition: strack.cpp:36
STrack(std::vector< float > tlwh_, float score, int label)
Definition: strack.cpp:12
int label
Definition: strack.h:57
std::vector< float > tlwh_to_xyah(std::vector< float > tlwh_tmp)
Definition: strack.cpp:140
~STrack()
Definition: strack.cpp:34
void static_tlwh()
Definition: strack.cpp:114
static std::vector< float > tlbr_to_tlwh(std::vector< float > &tlbr)
Definition: strack.cpp:149
void mark_removed()
Definition: strack.cpp:157
void mark_lost()
Definition: strack.cpp:155
int end_frame()
Definition: strack.cpp:164
bool is_activated
Definition: strack.h:41
void static_tlbr()
Definition: strack.cpp:133
int state
Definition: strack.h:43
void re_activate(STrack &new_track, int frame_id, bool new_id=false)
Definition: strack.cpp:68
std::vector< float > tlbr
Definition: strack.h:47
int next_id()
Definition: strack.cpp:159
KAL_COVA covariance
Definition: strack.h:54
std::vector< float > tlwh
Definition: strack.h:46
static void multi_predict(std::vector< STrack * > &stracks, KalmanFilter &kalman_filter)
Definition: strack.cpp:166
void update(STrack &new_track, int frame_id)
Definition: strack.cpp:90
Eigen::Matrix< float, 8, 8, Eigen::RowMajor > KAL_COVA
Definition: kalman_filter.h:25
Eigen::Matrix< float, 1, 8, Eigen::RowMajor > KAL_MEAN
Definition: kalman_filter.h:24
TrackState
Definition: strack.h:18
@ Removed
Definition: strack.h:18
@ Lost
Definition: strack.h:18
@ Tracked
Definition: strack.h:18
@ New
Definition: strack.h:18