refactor: remove YOLO processor and dependencies

- Delete YOLO processor implementation (src/core/processor/yolo.rs)
- Remove YOLO from processing pipeline and worker
- Clean up YOLO-related code across multiple modules
- Add migration 033_remove_yolo.sql

YOLO functionality removed as part of architecture simplification
This commit is contained in:
Accusys
2026-09-17 16:56:25 +08:00
parent 791c782606
commit 474a5bee99
20 changed files with 161 additions and 731 deletions
+63 -10
View File
@@ -1218,10 +1218,24 @@ pub async fn get_face_groups_handler(
) -> Result<Json<FaceGroupsResponse>, StatusCode> {
let tkg_table = schema::table_name("tkg_nodes");
let tp_table = schema::table_name("trace_profiles");
let v_table = schema::table_name("videos");
// Read face_filter settings
let settings: crate::core::file_profile::FaceFilterSettings = sqlx::query_scalar(&format!(
"SELECT face_filter FROM {v_table} WHERE file_uuid = $1"
))
.bind(&file_uuid)
.fetch_optional(state.db.pool())
.await
.ok()
.flatten()
.and_then(|v| serde_json::from_value(v).ok())
.unwrap_or_else(crate::core::file_profile::FaceFilterSettings::defaults);
let rows: Vec<(String, i32)> = sqlx::query_as(&format!(
let rows: Vec<(String, i32, Option<i32>)> = sqlx::query_as(&format!(
"SELECT COALESCE(tp.name, tn.label) as name, \
COALESCE(tp.trace_id, (tn.properties->>'trace_id')::int) as trace_id \
COALESCE(tp.trace_id, (tn.properties->>'trace_id')::int) as trace_id, \
tp.frame_count \
FROM {} tn \
LEFT JOIN {} tp ON tp.file_uuid = tn.file_uuid \
AND tp.trace_id = (tn.properties->>'trace_id')::int \
@@ -1240,7 +1254,17 @@ pub async fn get_face_groups_handler(
let mut groups: HashMap<String, Vec<i32>> = HashMap::new();
let mut unassigned: Vec<i32> = Vec::new();
for (name, trace_id) in rows {
for (name, trace_id, frame_count) in rows {
// Filter single frame traces if disabled
if frame_count == Some(1) {
if !settings.single_frame_trace_group_enabled && !name.starts_with("Face Trace ") && !name.starts_with("Trace ") {
continue;
}
if !settings.single_frame_trace_unassigned_enabled && (name.starts_with("Face Trace ") || name.starts_with("Trace ")) {
continue;
}
}
if name.starts_with("Face Trace ") || name.starts_with("Trace ") {
unassigned.push(trace_id);
} else {
@@ -1248,10 +1272,17 @@ pub async fn get_face_groups_handler(
}
}
// All Person_N groups are shown as face groups regardless of trace count.
// Filter single-trace groups if enabled
let mut filtered_groups: HashMap<String, Vec<i32>> = HashMap::new();
for (name, trace_ids) in groups {
filtered_groups.insert(name, trace_ids);
let is_auto_name = name.starts_with("Person_");
let should_filter = settings.single_trace_group_filter_enabled
&& trace_ids.len() == 1
&& is_auto_name;
if !should_filter {
filtered_groups.insert(name, trace_ids);
}
}
let include_trace_ids = q.include_trace_ids.unwrap_or(true);
@@ -1337,11 +1368,25 @@ pub async fn get_cluster_results_handler(
let file_uuid = params.file_hash;
let tkg_table = schema::table_name("tkg_nodes");
let tp_table = schema::table_name("trace_profiles");
let v_table = schema::table_name("videos");
// Read face_filter settings
let settings: crate::core::file_profile::FaceFilterSettings = sqlx::query_scalar(&format!(
"SELECT face_filter FROM {v_table} WHERE file_uuid = $1"
))
.bind(&file_uuid)
.fetch_optional(state.db.pool())
.await
.ok()
.flatten()
.and_then(|v| serde_json::from_value(v).ok())
.unwrap_or_else(crate::core::file_profile::FaceFilterSettings::defaults);
// 1. Build face groups (same grouping logic as face-groups handler)
let rows: Vec<(String, i32)> = sqlx::query_as(&format!(
let rows: Vec<(String, i32, Option<i32>)> = sqlx::query_as(&format!(
"SELECT COALESCE(tp.name, tn.label) as name, \
COALESCE(tp.trace_id, (tn.properties->>'trace_id')::int) as trace_id \
COALESCE(tp.trace_id, (tn.properties->>'trace_id')::int) as trace_id, \
tp.frame_count \
FROM {} tn \
LEFT JOIN {} tp ON tp.file_uuid = tn.file_uuid \
AND tp.trace_id = (tn.properties->>'trace_id')::int \
@@ -1358,7 +1403,12 @@ pub async fn get_cluster_results_handler(
})?;
let mut groups: HashMap<String, Vec<i32>> = HashMap::new();
for (name, trace_id) in rows {
for (name, trace_id, frame_count) in rows {
// Filter out single frame traces if disabled
if frame_count == Some(1) && !settings.single_frame_trace_group_enabled {
continue;
}
if !(name.starts_with("Face Trace ") || name.starts_with("Trace ")) {
groups.entry(name).or_default().push(trace_id);
}
@@ -1369,10 +1419,13 @@ pub async fn get_cluster_results_handler(
let mut filtered_groups: HashMap<String, Vec<i32>> = HashMap::new();
for (name, trace_ids) in groups {
let is_auto_name = name.starts_with("Person_");
if trace_ids.len() > 1 || !is_auto_name {
let should_filter = settings.single_trace_group_filter_enabled
&& trace_ids.len() == 1
&& is_auto_name;
if !should_filter {
filtered_groups.insert(name, trace_ids);
}
// Single-trace auto-generated groups are silently dropped
}
// trace_id -> cluster_id mapping for frame faces