fix: auto-update face track labels after clustering in worker pipeline
The P3 Face Dedup trigger previously only logged when cluster_count != face_track_count without actually syncing labels. Now it calls update_face_track_labels to: - UPDATE tkg_nodes SET label = cluster_id for each trace - UPSERT trace_profiles SET name = cluster_id - Reset unclustered traces to default Person_N name This matches what the manual 'Face Deduplication' button in Studio already does via the cluster-agent API endpoint, ensuring the automatic pipeline produces the same result without requiring manual intervention.
This commit is contained in:
@@ -2485,10 +2485,39 @@ impl JobWorker {
|
|||||||
uuid, cluster_count, face_track_count
|
uuid, cluster_count, face_track_count
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
// Labels not synced — update tkg_nodes and trace_profiles
|
||||||
info!(
|
info!(
|
||||||
"📝 Face dedup running for {}: {} clusters, {} tracks",
|
"📝 Face dedup running for {}: {} clusters, {} tracks — updating labels",
|
||||||
uuid, cluster_count, face_track_count
|
uuid, cluster_count, face_track_count
|
||||||
);
|
);
|
||||||
|
if let Ok(result) =
|
||||||
|
serde_json::from_value::<crate::core::processor::FaceClusterResult>(
|
||||||
|
cluster_data.clone()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
let db_clone = self.db.clone();
|
||||||
|
let uuid_clone = uuid.to_string();
|
||||||
|
tokio::spawn(async move {
|
||||||
|
match Self::update_face_track_labels(
|
||||||
|
&db_clone,
|
||||||
|
&uuid_clone,
|
||||||
|
&result,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(()) => info!(
|
||||||
|
"✅ Face dedup labels updated for {}",
|
||||||
|
uuid_clone
|
||||||
|
),
|
||||||
|
Err(e) => error!(
|
||||||
|
"❌ Face dedup label update failed for {}: {}",
|
||||||
|
uuid_clone, e
|
||||||
|
),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
warn!("Failed to parse face_cluster.json for {}", uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user