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:
@@ -84,7 +84,6 @@ use crate::core::processor::face::FaceResult;
|
||||
use crate::core::processor::ocr::OcrResult;
|
||||
use crate::core::processor::pose::PoseResult;
|
||||
use crate::core::processor::scene_classification::SceneClassificationResult;
|
||||
use crate::core::processor::yolo::YoloResult;
|
||||
use crate::worker::resources::SystemResources;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -710,53 +709,6 @@ impl ProcessorPool {
|
||||
total_faces: 0,
|
||||
})
|
||||
}
|
||||
ProcessorType::Yolo => {
|
||||
let result = processor::process_yolo(
|
||||
video_path,
|
||||
output_path.to_str().unwrap(),
|
||||
uuid,
|
||||
Some(&sample_frames),
|
||||
)
|
||||
.await?;
|
||||
let chunks_produced = result.frames.len() as i32;
|
||||
tracing::info!(
|
||||
"YOLO completed, storing {} frames for {}",
|
||||
chunks_produced,
|
||||
job.uuid
|
||||
);
|
||||
if let Err(e) = Self::store_yolo_chunks(db, &job.uuid, &result).await {
|
||||
tracing::error!("Failed to store YOLO chunks for {}: {}", job.uuid, e);
|
||||
}
|
||||
if let Some(ref ws) = workspace {
|
||||
for frame in &result.frames {
|
||||
let data = serde_json::json!({"objects": frame.objects});
|
||||
let _ = ws
|
||||
.store_pre_chunk(
|
||||
"yolo",
|
||||
"raw",
|
||||
Some(frame.frame as i64),
|
||||
None,
|
||||
Some(frame.timestamp),
|
||||
None,
|
||||
Some(&data.to_string()),
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
Ok(ProcessorOutput {
|
||||
data: serde_json::to_value(result)?,
|
||||
chunks_produced,
|
||||
frames_processed: total_frames,
|
||||
total_frames,
|
||||
retry_count: 0,
|
||||
pid: 0,
|
||||
asr_status: None,
|
||||
segment_count: 0,
|
||||
face_status: None,
|
||||
total_faces: 0,
|
||||
})
|
||||
}
|
||||
ProcessorType::Ocr => {
|
||||
let result = processor::process_ocr(
|
||||
video_path,
|
||||
@@ -1321,40 +1273,6 @@ impl ProcessorPool {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn store_yolo_chunks(
|
||||
db: &PostgresDb,
|
||||
uuid: &str,
|
||||
yolo_result: &YoloResult,
|
||||
) -> Result<()> {
|
||||
let frames_count = yolo_result.frames.len();
|
||||
tracing::info!(
|
||||
"Storing {} YOLO pre-chunks for video {}",
|
||||
frames_count,
|
||||
uuid
|
||||
);
|
||||
|
||||
let mut pre_chunks_to_store = Vec::new();
|
||||
|
||||
for frame in yolo_result.frames.iter() {
|
||||
let data = serde_json::json!({
|
||||
"objects": frame.objects,
|
||||
"timestamp": frame.timestamp,
|
||||
});
|
||||
|
||||
pre_chunks_to_store.push((
|
||||
frame.frame as i64, // coordinate_index
|
||||
Some(frame.timestamp), // timestamp
|
||||
data,
|
||||
None, // identity_id
|
||||
None, // confidence
|
||||
));
|
||||
}
|
||||
|
||||
db.store_raw_pre_chunks_batch(uuid, "yolo", &pre_chunks_to_store)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn store_ocr_chunks(
|
||||
db: &PostgresDb,
|
||||
uuid: &str,
|
||||
|
||||
@@ -9,6 +9,8 @@ pub struct SystemResources {
|
||||
pub gpu_available: bool,
|
||||
pub gpu_utilization: Option<f64>,
|
||||
pub gpu_memory_used_pct: Option<f64>,
|
||||
pub ane_available: bool,
|
||||
pub ane_utilization: Option<f64>,
|
||||
}
|
||||
|
||||
impl SystemResources {
|
||||
@@ -23,6 +25,7 @@ impl SystemResources {
|
||||
0.0
|
||||
};
|
||||
let (gpu_avail, gpu_util, gpu_mem) = Self::get_gpu_info();
|
||||
let (ane_avail, ane_util) = Self::get_ane_info();
|
||||
|
||||
Self {
|
||||
cpu_idle_percent: cpu_idle,
|
||||
@@ -33,6 +36,8 @@ impl SystemResources {
|
||||
gpu_available: gpu_avail,
|
||||
gpu_utilization: gpu_util,
|
||||
gpu_memory_used_pct: gpu_mem,
|
||||
ane_available: ane_avail,
|
||||
ane_utilization: ane_util,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,4 +281,28 @@ impl SystemResources {
|
||||
|
||||
(false, None, None)
|
||||
}
|
||||
|
||||
fn get_ane_info() -> (bool, Option<f64>) {
|
||||
use std::process::Command;
|
||||
|
||||
let output = Command::new("ps")
|
||||
.args(["aux"])
|
||||
.output();
|
||||
|
||||
if let Ok(o) = output {
|
||||
let s = String::from_utf8_lossy(&o.stdout);
|
||||
for line in s.lines() {
|
||||
if line.contains("/usr/libexec/aned") {
|
||||
if let Some(cpu_str) = line.split_whitespace().nth(2) {
|
||||
if let Ok(cpu) = cpu_str.parse::<f64>() {
|
||||
return (true, Some(cpu));
|
||||
}
|
||||
}
|
||||
return (true, None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(false, None)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user