reab5555 commited on
Commit
ea63872
·
verified ·
1 Parent(s): ce25ed6

Update visualization.py

Browse files
Files changed (1) hide show
  1. visualization.py +3 -1
visualization.py CHANGED
@@ -209,6 +209,7 @@ def plot_posture(df, posture_scores, color='blue', anomaly_threshold=3):
209
 
210
 
211
  def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_voice, output_path, desired_fps, largest_cluster, progress=None):
 
212
  # Filter the DataFrame to only include frames from the largest cluster
213
  df_largest_cluster = df[df['Cluster'] == largest_cluster]
214
 
@@ -230,6 +231,7 @@ def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_v
230
 
231
  fourcc = cv2.VideoWriter_fourcc(*'mp4v')
232
  out = cv2.VideoWriter(output_path, fourcc, original_fps, (width, height + 200))
 
233
 
234
  # Ensure all MSE arrays have the same length as total_frames
235
  mse_embeddings = np.interp(np.linspace(0, len(mse_embeddings) - 1, total_frames),
@@ -301,5 +303,5 @@ def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_v
301
  cap.release()
302
  out.release()
303
  plt.close(fig)
304
-
305
  return output_path
 
209
 
210
 
211
  def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_voice, output_path, desired_fps, largest_cluster, progress=None):
212
+ print(f"Creating heatmap video. Output path: {output_path}")
213
  # Filter the DataFrame to only include frames from the largest cluster
214
  df_largest_cluster = df[df['Cluster'] == largest_cluster]
215
 
 
231
 
232
  fourcc = cv2.VideoWriter_fourcc(*'mp4v')
233
  out = cv2.VideoWriter(output_path, fourcc, original_fps, (width, height + 200))
234
+ print(f"VideoWriter initialized. FPS: {original_fps}, Size: {(width, height + 200)}")
235
 
236
  # Ensure all MSE arrays have the same length as total_frames
237
  mse_embeddings = np.interp(np.linspace(0, len(mse_embeddings) - 1, total_frames),
 
303
  cap.release()
304
  out.release()
305
  plt.close(fig)
306
+ print(f"Heatmap video created at: {output_path}")
307
  return output_path