From 5af32fa841a246e131d3faff59c8f0802205bf5e Mon Sep 17 00:00:00 2001 From: Mehrab Shahbazi Date: Fri, 3 Jan 2025 14:55:14 +0330 Subject: [PATCH] ensure output path --- deepface/modules/streaming.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deepface/modules/streaming.py b/deepface/modules/streaming.py index c16816d..78eaa1e 100644 --- a/deepface/modules/streaming.py +++ b/deepface/modules/streaming.py @@ -91,7 +91,9 @@ def analysis( height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) fps = cap.get(cv2.CAP_PROP_FPS) fourcc = cv2.VideoWriter_fourcc(*"mp4v") # Codec for output file - + # Ensure the output directory exists if output_path is provided + if output_path: + os.makedirs(os.path.dirname(output_path), exist_ok=True) # Initialize video writer if output_path is provided video_writer = ( cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*"mp4v"), fps, (width, height)) @@ -254,10 +256,10 @@ def search_identity( # detected face is coming from parent, safe to access 1st index df = dfs[0] - if df.shape[0] == 0: + if df.shape[0] == 0: return None, None - candidate = df.iloc[0] + candidate = df.iloc[0] target_path = candidate["identity"] logger.info(f"Hello, {target_path}")