forked from dsutanto/bytetrack-counter-cpp
Fix and tested
This commit is contained in:
1 parent
37fe4eee3a
commit
fc172117cc
8 files changed
+1737
-49
No files matched your search
@@ -136,7 +136,6 @@ json BatchStore::load_state() {
|
||||
}
|
||||
|
||||
void BatchStore::save_state() {
|
||||
std::lock_guard<std::mutex> lock(state_mutex_);
|
||||
if (current_state_.is_null()) {
|
||||
std::filesystem::remove(state_file_);
|
||||
return;
|
||||
|
||||
@@ -214,6 +214,52 @@ int main(int argc, char* argv[]) {
|
||||
talenan_scores_vec(i) = talenan_scores[i];
|
||||
}
|
||||
|
||||
// Apply NMS per-class to suppress duplicate boxes
|
||||
if (na > 0) {
|
||||
auto keep = nms(ayam_mat, ayam_scores_vec);
|
||||
int nk = static_cast<int>(keep.size());
|
||||
Eigen::MatrixXf fm(nk, 4);
|
||||
Eigen::VectorXf fs(nk);
|
||||
std::vector<Eigen::Vector4f> fb;
|
||||
std::vector<float> fcx;
|
||||
std::vector<std::vector<std::vector<cv::Point2f>>> fkpts;
|
||||
for (int ki = 0; ki < nk; ++ki) {
|
||||
int idx = keep[ki];
|
||||
fm.row(ki) = ayam_mat.row(idx);
|
||||
fs(ki) = ayam_scores_vec(idx);
|
||||
fb.push_back(ayam_boxes[idx]);
|
||||
fcx.push_back(ayam_cx_list[idx]);
|
||||
if (idx < (int)ayam_kpts_list.size())
|
||||
fkpts.push_back(ayam_kpts_list[idx]);
|
||||
}
|
||||
na = nk;
|
||||
ayam_mat = std::move(fm);
|
||||
ayam_scores_vec = std::move(fs);
|
||||
ayam_boxes = std::move(fb);
|
||||
ayam_cx_list = std::move(fcx);
|
||||
ayam_kpts_list = std::move(fkpts);
|
||||
}
|
||||
if (nt > 0) {
|
||||
auto keep = nms(talenan_mat, talenan_scores_vec);
|
||||
int nk = static_cast<int>(keep.size());
|
||||
Eigen::MatrixXf fm(nk, 4);
|
||||
Eigen::VectorXf fs(nk);
|
||||
std::vector<Eigen::Vector4f> fb;
|
||||
std::vector<float> fcx;
|
||||
for (int ki = 0; ki < nk; ++ki) {
|
||||
int idx = keep[ki];
|
||||
fm.row(ki) = talenan_mat.row(idx);
|
||||
fs(ki) = talenan_scores_vec(idx);
|
||||
fb.push_back(talenan_boxes[idx]);
|
||||
fcx.push_back(talenan_cx_list[idx]);
|
||||
}
|
||||
nt = nk;
|
||||
talenan_mat = std::move(fm);
|
||||
talenan_scores_vec = std::move(fs);
|
||||
talenan_boxes = std::move(fb);
|
||||
talenan_cx_list = std::move(fcx);
|
||||
}
|
||||
|
||||
TrackResult ayam_tr = ayam_tracker.update(ayam_mat, ayam_scores_vec);
|
||||
TrackResult talenan_tr = talenan_tracker.update(talenan_mat, talenan_scores_vec);
|
||||
|
||||
|
||||
Reference in new issue
Block a user