improved performance
This commit is contained in:
@@ -14,10 +14,8 @@
|
||||
// algorithm on a combined spatial (IoU) + embedding (cosine distance) cost.
|
||||
//
|
||||
// Each track accumulates a running directional mean of its ArcFace embeddings
|
||||
// (averaged then re-normalised to the unit sphere). Once a track reaches
|
||||
// min_frames observations its mean embedding is forwarded as track_embeddings[i]
|
||||
// and track_mature[i] is set, allowing the identity matcher to use a cleaner,
|
||||
// multi-frame signal instead of the noisy single-frame embedding.
|
||||
// (averaged then re-normalised to the unit sphere), used as the embedding side
|
||||
// of the assignment cost below for more stable track continuity.
|
||||
//
|
||||
// Assignment cost (track i, detection j):
|
||||
// cost = alpha * (1 - IoU) + (1-alpha) * min(cosine_dist/2, 1)
|
||||
@@ -41,13 +39,11 @@ struct FaceTrackerFunc {
|
||||
, min_iou_(cfg.track_min_iou)
|
||||
, max_embed_dist_(cfg.track_max_embed_dist)
|
||||
, max_missing_(cfg.track_max_frames_missing)
|
||||
, min_frames_(cfg.track_min_frames)
|
||||
{
|
||||
std::cerr << "[face_tracker] alpha=" << alpha_
|
||||
<< " min_iou=" << min_iou_
|
||||
<< " max_embed_dist=" << max_embed_dist_
|
||||
<< " max_missing=" << max_missing_
|
||||
<< " min_frames=" << min_frames_ << "\n";
|
||||
<< " max_missing=" << max_missing_ << "\n";
|
||||
}
|
||||
|
||||
TrackedSceneFrame operator()(EmbeddedSceneFrame ef) {
|
||||
@@ -102,8 +98,6 @@ struct FaceTrackerFunc {
|
||||
out.crops = ef.crops;
|
||||
out.embeddings = ef.embeddings;
|
||||
out.track_ids.assign(n_det, -1);
|
||||
out.track_embeddings = ef.embeddings; // default: per-frame embedding
|
||||
out.track_mature.assign(n_det, false);
|
||||
|
||||
std::vector<bool> det_matched(n_det, false);
|
||||
|
||||
@@ -122,9 +116,7 @@ struct FaceTrackerFunc {
|
||||
ts.frames_missing = 0;
|
||||
det_matched[di] = true;
|
||||
|
||||
out.track_ids[di] = tids[ti];
|
||||
out.track_embeddings[di] = ts.mean_emb;
|
||||
out.track_mature[di] = (ts.n_frames >= min_frames_);
|
||||
out.track_ids[di] = tids[ti];
|
||||
}
|
||||
|
||||
// Create new tracks for unmatched detections
|
||||
@@ -137,7 +129,6 @@ struct FaceTrackerFunc {
|
||||
ts.n_frames = 1;
|
||||
tracks_[tid] = ts;
|
||||
out.track_ids[di] = tid;
|
||||
// track_embeddings[di] already initialised to per-frame embedding
|
||||
}
|
||||
|
||||
// Expire stale tracks
|
||||
@@ -239,5 +230,4 @@ private:
|
||||
float min_iou_;
|
||||
float max_embed_dist_;
|
||||
int max_missing_;
|
||||
int min_frames_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user