cleanup: remove dead code and duplicate docs
- Remove session-ses_2f27.md (161KB raw session log) - Remove 49 ROOT_* duplicate files across REFERENCE/ - Remove 14 duplicate files between REFERENCE/ root and history/ - Remove asr_legacy.rs (dead code, replaced by asr.rs) - Remove src/core/worker/ (duplicate JobWorker) - Remove src/core/layers/ (empty directory) - Remove 4 .bak files in src/ - Remove 7 dead private methods in worker/processor.rs - Remove backup directory from git tracking
This commit is contained in:
@@ -21,7 +21,6 @@ import os
|
||||
import time
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
from redis_publisher import RedisPublisher
|
||||
from resume_framework import ResumeFramework, format_time, print_progress
|
||||
from utils.pose_analyzer import calculate_pose_angle_v2
|
||||
|
||||
@@ -141,7 +140,7 @@ def process_face(
|
||||
print(f"\nProcessing video: {total_frames} frames @ {fps:.2f} fps")
|
||||
print(f"Auto-save every {auto_save_interval}s or {auto_save_frames} frames")
|
||||
print(f"Resume from frame {frame_count + 1 if resume_mode else 1}")
|
||||
print(f"Detection method: InsightFace (REQUIRED)")
|
||||
print("Detection method: InsightFace (REQUIRED)")
|
||||
print()
|
||||
|
||||
while True:
|
||||
@@ -199,7 +198,7 @@ def process_face(
|
||||
"pitch": pose_result.get("pitch", "neutral"),
|
||||
"features": pose_result.get("features", {}),
|
||||
}
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
face_list.append(
|
||||
@@ -255,6 +254,45 @@ def process_face(
|
||||
return face_data
|
||||
|
||||
|
||||
def _convert_to_face_result(face_data: dict) -> dict:
|
||||
"""Convert ResumeFramework output to FaceResult format expected by Rust."""
|
||||
metadata = face_data.get("metadata", {})
|
||||
raw_frames = face_data.get("frames", {})
|
||||
fps = metadata.get("fps", 30.0)
|
||||
frames = []
|
||||
for frame_key in sorted(raw_frames.keys(), key=lambda k: int(k)):
|
||||
f = raw_frames[frame_key]
|
||||
faces = []
|
||||
for raw_face in f.get("faces", []):
|
||||
pose = raw_face.get("pose_angle")
|
||||
attributes = raw_face.get("attributes", {})
|
||||
face = {
|
||||
"face_id": None,
|
||||
"x": raw_face["x"],
|
||||
"y": raw_face["y"],
|
||||
"width": raw_face["width"],
|
||||
"height": raw_face["height"],
|
||||
"confidence": raw_face.get("confidence", 0.0),
|
||||
"embedding": raw_face.get("embedding"),
|
||||
"landmarks": raw_face.get("landmarks"),
|
||||
"attributes": {
|
||||
"age": attributes.get("age") if attributes else None,
|
||||
"gender": attributes.get("gender") if attributes else None,
|
||||
},
|
||||
}
|
||||
faces.append(face)
|
||||
frames.append({
|
||||
"frame": f["frame_number"],
|
||||
"timestamp": f["time_seconds"],
|
||||
"faces": faces,
|
||||
})
|
||||
return {
|
||||
"frame_count": len(frames),
|
||||
"fps": fps,
|
||||
"frames": frames,
|
||||
}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Face Detection & Demographics with Resume Support")
|
||||
parser.add_argument("video_path", help="Path to video file")
|
||||
@@ -285,11 +323,11 @@ if __name__ == "__main__":
|
||||
"-s",
|
||||
help="Frame sample interval",
|
||||
type=int,
|
||||
default=30,
|
||||
default=5,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
process_face(
|
||||
result = process_face(
|
||||
args.video_path,
|
||||
args.output_path,
|
||||
args.uuid,
|
||||
@@ -297,4 +335,7 @@ if __name__ == "__main__":
|
||||
args.auto_save_frames,
|
||||
args.force_restart,
|
||||
args.sample_interval,
|
||||
)
|
||||
)
|
||||
face_result = _convert_to_face_result(result)
|
||||
with open(args.output_path, "w") as f:
|
||||
json.dump(face_result, f, indent=2)
|
||||
Reference in New Issue
Block a user