Commit 17c1c6df authored by xin.wang.waytous's avatar xin.wang.waytous

byte_tracker-lost-out

parent 7d7002ef
...@@ -68,5 +68,6 @@ units: ...@@ -68,5 +68,6 @@ units:
high_thresh: 0.2 high_thresh: 0.2
match_thresh: 0.8 match_thresh: 0.8
init_frames: 0 init_frames: 0
out_lost_threshold: 3
...@@ -147,6 +147,7 @@ units: ...@@ -147,6 +147,7 @@ units:
high_thresh: 0.2 high_thresh: 0.2
match_thresh: 0.8 match_thresh: 0.8
init_frames: 0 init_frames: 0
out_lost_threshold: 3
...@@ -59,6 +59,7 @@ units: ...@@ -59,6 +59,7 @@ units:
high_thresh: 0.2 high_thresh: 0.2
match_thresh: 0.8 match_thresh: 0.8
init_frames: 0 init_frames: 0
out_lost_threshold: 3
......
...@@ -87,6 +87,7 @@ units: ...@@ -87,6 +87,7 @@ units:
high_thresh: 0.2 high_thresh: 0.2
match_thresh: 0.8 match_thresh: 0.8
init_frames: 0 init_frames: 0
out_lost_threshold: 3
......
...@@ -19,6 +19,9 @@ bool ByteTracker::Init(YAML::Node& node) ...@@ -19,6 +19,9 @@ bool ByteTracker::Init(YAML::Node& node)
high_thresh = node["high_thresh"].as<float>(); high_thresh = node["high_thresh"].as<float>();
match_thresh = node["match_thresh"].as<float>(); match_thresh = node["match_thresh"].as<float>();
init_frames = node["init_frames"].as<int>(); init_frames = node["init_frames"].as<int>();
if(!node["out_lost_threshold"].IsNull()){
out_lost_threshold = node["out_lost_threshold"].as<int>();
}
frame_id = 0; frame_id = 0;
max_time_lost = int(frame_rate / 30.0 * track_buffer); max_time_lost = int(frame_rate / 30.0 * track_buffer);
...@@ -250,6 +253,16 @@ bool ByteTracker::Exec() ...@@ -250,6 +253,16 @@ bool ByteTracker::Exec()
tracked_bboxes->detections.push_back(t); tracked_bboxes->detections.push_back(t);
} }
} }
// no detections in, get lost tracks out
if(tracked_bboxes->detections.size() == 0){
for(auto& ltrack: this->lost_tracks){
if(this->frame_id - ltrack.end_frame() <= this->out_lost_threshold){
auto t = ltrack.obj_->copy();
t->validCoordinate();
tracked_bboxes->detections.push_back(t);
}
}
}
interfaces::SetIOPtr(outputNames[0], tracked_bboxes); interfaces::SetIOPtr(outputNames[0], tracked_bboxes);
LOG_INFO << "Get " << tracked_bboxes->detections.size() << " tracked objs. Removed track length: " << this->removed_tracks.size(); LOG_INFO << "Get " << tracked_bboxes->detections.size() << " tracked objs. Removed track length: " << this->removed_tracks.size();
return true; return true;
......
...@@ -45,6 +45,7 @@ private: ...@@ -45,6 +45,7 @@ private:
int frame_id; int frame_id;
int max_time_lost; int max_time_lost;
int init_frames = 0; int init_frames = 0;
int out_lost_threshold = 3;
std::vector<Track> tracked_tracks; std::vector<Track> tracked_tracks;
std::vector<Track> lost_tracks; std::vector<Track> lost_tracks;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment