reab5555 commited on
Commit
338dc52
·
verified ·
1 Parent(s): 281509f

Update video_processing.py

Browse files
Files changed (1) hide show
  1. video_processing.py +10 -2
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, create_video_with_heatmap, plot_correlation_heatmap
14
  from utils import frame_to_timecode
15
  import pandas as pd
16
  from facenet_pytorch import MTCNN
@@ -197,6 +197,12 @@ 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
  correlation_heatmap = plot_correlation_heatmap(mse_embeddings, mse_posture, mse_voice)
201
 
202
  try:
@@ -226,7 +232,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
226
  print(f"Error details: {str(e)}")
227
  import traceback
228
  traceback.print_exc()
229
- return (f"Error in video processing: {str(e)}",) + (None,) * 24
230
 
231
  progress(1.0, "Preparing results")
232
  results = f"Number of persons detected: {num_clusters}\n\n"
@@ -294,6 +300,8 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
294
  aligned_faces_folder,
295
  frames_folder,
296
  heatmap_video_path,
 
 
297
  correlation_heatmap
298
  )
299
 
 
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, create_video_with_heatmap, plot_combined_mse, combined_heatmap, plot_correlation_heatmap
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
+ # Generate the combined MSE plot
201
+ combined_mse_plot = plot_combined_mse(df, mse_embeddings, mse_posture, mse_voice, "Combined MSE Plot")
202
+
203
+ # Generate the combined heatmap
204
+ combined_heatmap = plot_mse_heatmap(np.vstack((mse_embeddings, mse_posture, mse_voice)), "Combined MSE Heatmap", df)
205
+
206
  correlation_heatmap = plot_correlation_heatmap(mse_embeddings, mse_posture, mse_voice)
207
 
208
  try:
 
232
  print(f"Error details: {str(e)}")
233
  import traceback
234
  traceback.print_exc()
235
+ return (f"Error in video processing: {str(e)}",) + (None,) * 28
236
 
237
  progress(1.0, "Preparing results")
238
  results = f"Number of persons detected: {num_clusters}\n\n"
 
300
  aligned_faces_folder,
301
  frames_folder,
302
  heatmap_video_path,
303
+ combined_mse_plot,
304
+ combined_heatmap,
305
  correlation_heatmap
306
  )
307