Spaces:
Runtime error
Runtime error
Update video_processing.py
Browse files- video_processing.py +2 -7
video_processing.py
CHANGED
@@ -10,7 +10,7 @@ from face_analysis import get_face_embedding, cluster_faces, organize_faces_by_p
|
|
10 |
from pose_analysis import pose, calculate_posture_score, draw_pose_landmarks
|
11 |
from voice_analysis import get_speaker_embeddings, align_voice_embeddings, extract_audio_from_video, diarize_speakers
|
12 |
from anomaly_detection import anomaly_detection
|
13 |
-
from visualization import plot_mse, plot_mse_histogram, plot_mse_heatmap,
|
14 |
from utils import frame_to_timecode
|
15 |
import pandas as pd
|
16 |
from facenet_pytorch import MTCNN
|
@@ -197,9 +197,6 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
197 |
mse_heatmap_posture = plot_mse_heatmap(mse_posture, "Body Posture MSE Heatmap", df)
|
198 |
mse_heatmap_voice = plot_mse_heatmap(mse_voice, "Voice MSE Heatmap", df)
|
199 |
|
200 |
-
# Create audio waveform plot
|
201 |
-
audio_waveform_plot = plot_audio_waveform(audio_path, "Audio Waveform")
|
202 |
-
|
203 |
stacked_heatmap = plot_stacked_mse_heatmaps(mse_embeddings, mse_posture, mse_voice, df, "Combined MSE Heatmaps")
|
204 |
|
205 |
progress(0.95, "Finishing generating graphs")
|
@@ -208,7 +205,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
208 |
print(f"Error details: {str(e)}")
|
209 |
import traceback
|
210 |
traceback.print_exc()
|
211 |
-
return (f"Error in video processing: {str(e)}",) + (None,) *
|
212 |
|
213 |
progress(1.0, "Preparing results")
|
214 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
@@ -270,7 +267,6 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
270 |
mse_heatmap_embeddings,
|
271 |
mse_heatmap_posture,
|
272 |
mse_heatmap_voice,
|
273 |
-
audio_waveform_plot,
|
274 |
face_samples["most_frequent"],
|
275 |
anomaly_faces_embeddings,
|
276 |
anomaly_frames_posture_images,
|
@@ -281,7 +277,6 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
281 |
)
|
282 |
|
283 |
|
284 |
-
|
285 |
def is_frontal_face(landmarks, threshold=60):
|
286 |
nose_tip = landmarks[4]
|
287 |
left_chin = landmarks[234]
|
|
|
10 |
from pose_analysis import pose, calculate_posture_score, draw_pose_landmarks
|
11 |
from voice_analysis import get_speaker_embeddings, align_voice_embeddings, extract_audio_from_video, diarize_speakers
|
12 |
from anomaly_detection import anomaly_detection
|
13 |
+
from visualization import plot_mse, plot_mse_histogram, plot_mse_heatmap, plot_stacked_mse_heatmaps
|
14 |
from utils import frame_to_timecode
|
15 |
import pandas as pd
|
16 |
from facenet_pytorch import MTCNN
|
|
|
197 |
mse_heatmap_posture = plot_mse_heatmap(mse_posture, "Body Posture MSE Heatmap", df)
|
198 |
mse_heatmap_voice = plot_mse_heatmap(mse_voice, "Voice MSE Heatmap", df)
|
199 |
|
|
|
|
|
|
|
200 |
stacked_heatmap = plot_stacked_mse_heatmaps(mse_embeddings, mse_posture, mse_voice, df, "Combined MSE Heatmaps")
|
201 |
|
202 |
progress(0.95, "Finishing generating graphs")
|
|
|
205 |
print(f"Error details: {str(e)}")
|
206 |
import traceback
|
207 |
traceback.print_exc()
|
208 |
+
return (f"Error in video processing: {str(e)}",) + (None,) * 26
|
209 |
|
210 |
progress(1.0, "Preparing results")
|
211 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
|
|
267 |
mse_heatmap_embeddings,
|
268 |
mse_heatmap_posture,
|
269 |
mse_heatmap_voice,
|
|
|
270 |
face_samples["most_frequent"],
|
271 |
anomaly_faces_embeddings,
|
272 |
anomaly_frames_posture_images,
|
|
|
277 |
)
|
278 |
|
279 |
|
|
|
280 |
def is_frontal_face(landmarks, threshold=60):
|
281 |
nose_tip = landmarks[4]
|
282 |
left_chin = landmarks[234]
|