Revert "Level up with python version"

This reverts commit 9aec3fbd78.
This commit is contained in:
proitlab committed 2026-07-06 03:17:44 +07:00
1 parent 9aec3fbd78
commit 5483837769
16 files changed
+121 -1949

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ TrackResult ByteTracker::update(const Eigen::MatrixXf& boxes_xyxy, const Eigen::
auto iou_mat = ious_xyxy(low_mat, unmatched_boxes);
auto cost_mat = Eigen::MatrixXf::Constant(n_low, n_unmatched, 1.0f) - iou_mat;
auto matches2 = greedy_match(cost_mat, 1.0f - match_thresh_);
auto matches2 = greedy_match(cost_mat, 0.5f);
for (auto [di, uti] : matches2) {
int det_global = low_indices[di];
+11 -36
View File
@@ -74,32 +74,18 @@ void AppConfig::load_from_env(const char* env_path) {
auto ss_s = get_env("SCORE_SIGMOID");
score_sigmoid = (ss_s == "true");
auto th0_s = get_env("TRACK_HIGH_THRESH_0");
if (!th0_s.empty()) track_high_thresh_0 = std::stof(th0_s);
auto tl0_s = get_env("TRACK_LOW_THRESH_0");
if (!tl0_s.empty()) track_low_thresh_0 = std::stof(tl0_s);
auto tm0_s = get_env("TRACK_MATCH_THRESH_0");
if (!tm0_s.empty()) track_match_thresh_0 = std::stof(tm0_s);
auto tb0_s = get_env("TRACK_BUFFER_0");
if (!tb0_s.empty()) track_buffer_0 = std::stoi(tb0_s);
auto tmh0_s = get_env("TRACK_MIN_HITS_0");
if (!tmh0_s.empty()) track_min_hits_0 = std::stoi(tmh0_s);
auto th_s = get_env("TRACK_HIGH_THRESH");
if (!th_s.empty()) track_high_thresh = std::stof(th_s);
auto tl_s = get_env("TRACK_LOW_THRESH");
if (!tl_s.empty()) track_low_thresh = std::stof(tl_s);
auto tm_s = get_env("TRACK_MATCH_THRESH");
if (!tm_s.empty()) track_match_thresh = std::stof(tm_s);
auto tb_s = get_env("TRACK_BUFFER");
if (!tb_s.empty()) track_buffer = std::stoi(tb_s);
auto tmh_s = get_env("TRACK_MIN_HITS");
if (!tmh_s.empty()) track_min_hits = std::stoi(tmh_s);
auto th1_s = get_env("TRACK_HIGH_THRESH_1");
if (!th1_s.empty()) track_high_thresh_1 = std::stof(th1_s);
auto tl1_s = get_env("TRACK_LOW_THRESH_1");
if (!tl1_s.empty()) track_low_thresh_1 = std::stof(tl1_s);
auto tm1_s = get_env("TRACK_MATCH_THRESH_1");
if (!tm1_s.empty()) track_match_thresh_1 = std::stof(tm1_s);
auto tb1_s = get_env("TRACK_BUFFER_1");
if (!tb1_s.empty()) track_buffer_1 = std::stoi(tb1_s);
auto tmh1_s = get_env("TRACK_MIN_HITS_1");
if (!tmh1_s.empty()) track_min_hits_1 = std::stoi(tmh1_s);
auto rw_s = get_env("RATE_WINDOW_SEC");
if (!rw_s.empty()) rate_window_sec = std::stoi(rw_s);
daily_cutoff_time = get_env("DAILY_CUTOFF_TIME", get_env("CUTOFF_TIME", daily_cutoff_time));
daily_cutoff_time = get_env("DAILY_CUTOFF_TIME", daily_cutoff_time);
auto bto_s = get_env("BATCH_TIMEOUT_SECONDS");
if (!bto_s.empty()) batch_timeout_seconds = std::stof(bto_s);
auto ibl_s = get_env("IGNORE_BATCH_LABEL_TIMEOUT_SECONDS");
@@ -139,15 +125,4 @@ void AppConfig::load_from_env(const char* env_path) {
if (!lsn_s.empty()) live_stream_every_n = std::stoi(lsn_s);
rtsp_ffmpeg_options = get_env("OPENCV_FFMPEG_CAPTURE_OPTIONS", rtsp_ffmpeg_options);
auto cff_s = get_env("CROSS_FLASH_FRAMES");
if (!cff_s.empty()) cross_flash_frames = std::stoi(cff_s);
auto pl_s = get_env("POPUP_LIFETIME");
if (!pl_s.empty()) popup_lifetime = std::stoi(pl_s);
auto lpf_s = get_env("LINE_PULSE_FRAMES");
if (!lpf_s.empty()) line_pulse_frames = std::stoi(lpf_s);
auto cpf_s = get_env("COUNT_PULSE_FRAMES");
if (!cpf_s.empty()) count_pulse_frames = std::stoi(cpf_s);
auto bpf_s = get_env("BATCH_PULSE_FRAMES");
if (!bpf_s.empty()) batch_pulse_frames = std::stoi(bpf_s);
}
+5 -13
View File
@@ -25,19 +25,11 @@ struct AppConfig {
int num_classes = 2;
bool score_sigmoid = false;
float track_high_thresh_0 = 0.5f;
float track_low_thresh_0 = 0.1f;
float track_match_thresh_0 = 0.8f;
int track_buffer_0 = 30;
int track_min_hits_0 = 3;
float track_high_thresh_1 = 0.5f;
float track_low_thresh_1 = 0.1f;
float track_match_thresh_1 = 0.6f;
int track_buffer_1 = 30;
int track_min_hits_1 = 3;
int rate_window_sec = 60;
float track_high_thresh = 0.5f;
float track_low_thresh = 0.1f;
float track_match_thresh = 0.8f;
int track_buffer = 30;
int track_min_hits = 3;
std::string daily_cutoff_time = "20:00";
float batch_timeout_seconds = 300.0f;
+7 -15
View File
@@ -105,12 +105,12 @@ int main(int argc, char* argv[]) {
g_config.imgsz, g_config.conf, 0.45f,
g_config.num_classes, 0, g_config.score_sigmoid);
ByteTracker ayam_tracker(g_config.track_high_thresh_0, g_config.track_low_thresh_0,
g_config.track_match_thresh_0, g_config.track_buffer_0,
g_config.track_min_hits_0);
ByteTracker talenan_tracker(g_config.track_high_thresh_1, g_config.track_low_thresh_1,
g_config.track_match_thresh_1, g_config.track_buffer_1,
g_config.track_min_hits_1);
ByteTracker ayam_tracker(g_config.track_high_thresh, g_config.track_low_thresh,
g_config.track_match_thresh, g_config.track_buffer,
g_config.track_min_hits);
ByteTracker talenan_tracker(g_config.track_high_thresh, g_config.track_low_thresh,
g_config.track_match_thresh, g_config.track_buffer,
g_config.track_min_hits);
std::unordered_set<int> ayam_line_crossed;
std::unordered_set<int> talenan_line_crossed;
@@ -122,7 +122,6 @@ int main(int argc, char* argv[]) {
auto session_start = std::chrono::steady_clock::now();
int frame_idx = 0;
std::deque<std::chrono::steady_clock::time_point> crossing_times;
cv::VideoCapture cap = open_capture(g_config.source);
bool is_live = g_config.source.substr(0, 7) == "rtsp://" ||
@@ -318,7 +317,6 @@ int main(int argc, char* argv[]) {
}
ayam_crossed_frame = true;
if (started_new) batch_started_frame = true;
crossing_times.push_back(mono);
ayam_cross_flash[tid] = g_config.cross_flash_frames;
popups.push_back({
static_cast<int>(cx) - 12,
@@ -382,13 +380,7 @@ int main(int argc, char* argv[]) {
int batch_count = store.current_batch_count();
int display_total = store.display_total();
double elapsed = static_cast<double>(elapsed_sec);
while (!crossing_times.empty() &&
std::chrono::duration_cast<std::chrono::seconds>(
mono - crossing_times.front()).count() > g_config.rate_window_sec) {
crossing_times.pop_front();
}
double rate = crossing_times.empty() ? 0.0
: (static_cast<double>(crossing_times.size()) / g_config.rate_window_sec * 60.0);
double rate = elapsed > 0 ? (display_total / elapsed * 60.0) : 0.0;
draw_elegant_counting_line(frame, line_x, h, line_pulse);
draw_hero_count(frame, line_x, h, batch_count, count_pulse);