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
+4 -2
View File
@@ -148,7 +148,6 @@ struct ScriptIntegrity {
#[derive(Debug, Serialize)]
struct ProcessorInventory {
asr: bool,
yolo: bool,
face: bool,
pose: bool,
ocr: bool,
@@ -172,6 +171,8 @@ struct ResourceStatus {
gpu_available: bool,
gpu_utilization: Option<f64>,
gpu_memory_used_pct: Option<f64>,
ane_available: bool,
ane_utilization: Option<f64>,
}
#[derive(Debug, Serialize)]
@@ -348,6 +349,8 @@ pub async fn health_detailed(State(state): State<AppState>) -> Json<DetailedHeal
gpu_available: sys.gpu_available,
gpu_utilization: sys.gpu_utilization,
gpu_memory_used_pct: sys.gpu_memory_used_pct,
ane_available: sys.ane_available,
ane_utilization: sys.ane_utilization,
},
pipeline: PipelineStatus {
scripts_ready: scripts_path.is_dir(),
@@ -355,7 +358,6 @@ pub async fn health_detailed(State(state): State<AppState>) -> Json<DetailedHeal
scripts_integrity,
processors: ProcessorInventory {
asr: check_script("asr_processor.py"),
yolo: check_script("yolo_processor.py"),
face: check_script("face_processor.py"),
pose: check_script("pose_processor.py"),
ocr: check_script("ocr_processor.py"),
+1
View File
@@ -1,3 +1,4 @@
pub mod admin_config;
pub mod agent_api;
pub mod agent_search;
pub mod auth;
-7
View File
@@ -816,13 +816,6 @@ async fn get_processor_counts(
.get("scenes")
.and_then(|v| v.as_array())
.map(|arr| arr.len() as u32);
} else if proc_name == "yolo" {
// YOLO: use metadata.total_frames (avoids parsing huge frames array)
frame_count = json
.get("metadata")
.and_then(|m| m.get("total_frames"))
.and_then(|v| v.as_u64())
.map(|v| v as u32);
} else {
// Standard frame_count field
frame_count = json
+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
+10
View File
@@ -9,6 +9,7 @@ use crate::core::cache::{MongoCache, RedisCache};
use crate::core::db::{Database, PostgresDb, QdrantDb};
use crate::Embedder;
use super::admin_config;
use super::agent_api;
use super::agent_search;
use super::auth;
@@ -99,6 +100,14 @@ pub async fn start_server(host: &str, port: u16) -> anyhow::Result<()> {
let qdrant = std::sync::Arc::new(QdrantDb::new());
// Initialize AdminConfigManager
let admin_config_manager = std::sync::Arc::new(
crate::core::admin_config::AdminConfigManager::new(
&crate::core::admin_config::get_default_config_path()
)
.expect("Failed to initialize AdminConfigManager")
);
// Ensure trash collection exists for trace hard-delete undo
if let Err(e) = qdrant.ensure_collection("_faces_trash", 512).await {
tracing::warn!("[Server] Failed to ensure _faces_trash collection: {}", e);
@@ -136,6 +145,7 @@ pub async fn start_server(host: &str, port: u16) -> anyhow::Result<()> {
.merge(cluster_agent::cluster_agent_routes())
.merge(profile::profile_routes())
.merge(face_filter::face_filter_routes())
.merge(admin_config::admin_config_routes().with_state(admin_config_manager.clone()))
.layer(axum::middleware::from_fn_with_state(
state.api_state.clone(),
unified_auth,