Update video_processing.py
Browse files- video_processing.py +7 -3
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, plot_stacked_mse_heatmaps
|
14 |
from utils import frame_to_timecode
|
15 |
import pandas as pd
|
16 |
from facenet_pytorch import MTCNN
|
@@ -197,6 +197,9 @@ 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 |
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,7 +208,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
205 |
print(f"Error details: {str(e)}")
|
206 |
import traceback
|
207 |
traceback.print_exc()
|
208 |
-
return (f"Error in video processing: {str(e)}",) + (None,) *
|
209 |
|
210 |
progress(1.0, "Preparing results")
|
211 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
@@ -267,12 +270,13 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
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,
|
273 |
aligned_faces_folder,
|
274 |
frames_folder,
|
275 |
-
stacked_heatmap
|
276 |
|
277 |
)
|
278 |
|
|
|
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_audio_waveform, 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 |
+
# 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 |
print(f"Error details: {str(e)}")
|
209 |
import traceback
|
210 |
traceback.print_exc()
|
211 |
+
return (f"Error in video processing: {str(e)}",) + (None,) * 27
|
212 |
|
213 |
progress(1.0, "Preparing results")
|
214 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
|
|
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,
|
277 |
aligned_faces_folder,
|
278 |
frames_folder,
|
279 |
+
stacked_heatmap
|
280 |
|
281 |
)
|
282 |
|