reab5555 commited on
Commit
57f57c1
·
verified ·
1 Parent(s): 6c4ec2c

Update video_processing.py

Browse files
Files changed (1) hide show
  1. video_processing.py +5 -14
video_processing.py CHANGED
@@ -197,21 +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:
203
- if progress is not None:
204
- progress(0.95, desc="Generating video with heatmap")
205
-
206
- heatmap_video_path = create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_voice, output_folder, desired_fps, largest_cluster)
207
-
208
- if heatmap_video_path is None:
209
- print("Failed to create heatmap video")
210
- else:
211
- print(f"Heatmap video path from create_video_with_heatmap: {heatmap_video_path}")
212
-
213
  if progress is not None:
214
- progress(1.0, "Video processing complete")
215
 
216
  except Exception as e:
217
  print(f"Error in create_video_with_heatmap: {str(e)}")
@@ -223,7 +214,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
223
  print(f"Error details: {str(e)}")
224
  import traceback
225
  traceback.print_exc()
226
- return (f"Error in video processing: {str(e)}",) + (None,) * 26
227
 
228
  progress(1.0, "Preparing results")
229
  results = f"Number of persons detected: {num_clusters}\n\n"
@@ -290,7 +281,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
290
  anomaly_frames_posture_images,
291
  aligned_faces_folder,
292
  frames_folder,
293
- heatmap_video_path,
294
  correlation_heatmap
295
  )
296
 
 
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
  correlation_heatmap = plot_correlation_heatmap(mse_embeddings, mse_posture, mse_voice)
203
 
 
 
 
 
 
 
 
 
 
 
 
204
  if progress is not None:
205
+ progress(0.95, "Finishing generating graphs")
206
 
207
  except Exception as e:
208
  print(f"Error in create_video_with_heatmap: {str(e)}")
 
214
  print(f"Error details: {str(e)}")
215
  import traceback
216
  traceback.print_exc()
217
+ return (f"Error in video processing: {str(e)}",) + (None,) * 27
218
 
219
  progress(1.0, "Preparing results")
220
  results = f"Number of persons detected: {num_clusters}\n\n"
 
281
  anomaly_frames_posture_images,
282
  aligned_faces_folder,
283
  frames_folder,
284
+ stacked_heatmap,
285
  correlation_heatmap
286
  )
287