fix: face processor 讀取 .with_embedding 檔案當 copy 失敗時(確保 facenet embeddings 不會遺失)
This commit is contained in:
@@ -576,11 +576,11 @@ async fn run_face_with_config(
|
||||
|
||||
// Generate embeddings with FaceNet CoreML
|
||||
let facenet_path = swift_processor_path("facenet_embedding");
|
||||
let facenet_output = format!("{}.with_embedding", output_path);
|
||||
|
||||
if facenet_path.exists() {
|
||||
tracing::info!("[FACE] Generating embeddings with FaceNet CoreML");
|
||||
|
||||
let facenet_output = format!("{}.with_embedding", output_path);
|
||||
let mut facenet_args = vec![
|
||||
video_path.to_string(),
|
||||
output_path.to_string(),
|
||||
@@ -614,7 +614,13 @@ async fn run_face_with_config(
|
||||
}
|
||||
}
|
||||
|
||||
let json_str = std::fs::read_to_string(output_path)
|
||||
// Read face.json (prefer .with_embedding if copy failed)
|
||||
let json_path = if std::path::Path::new(&facenet_output).exists() {
|
||||
&facenet_output
|
||||
} else {
|
||||
output_path
|
||||
};
|
||||
let json_str = std::fs::read_to_string(json_path)
|
||||
.context("Failed to read Swift FACE output")?;
|
||||
let mut result: FaceResult =
|
||||
serde_json::from_str(&json_str).context("Failed to parse Swift FACE output")?;
|
||||
|
||||
Reference in New Issue
Block a user