Spaces:
Runtime error
Runtime error
Update video_processing.py
Browse files- video_processing.py +2 -6
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_combined_mse,
|
| 14 |
from utils import frame_to_timecode
|
| 15 |
import pandas as pd
|
| 16 |
from facenet_pytorch import MTCNN
|
|
@@ -200,9 +200,6 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 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,7 +229,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 232 |
print(f"Error details: {str(e)}")
|
| 233 |
import traceback
|
| 234 |
traceback.print_exc()
|
| 235 |
-
return (f"Error in video processing: {str(e)}",) + (None,) *
|
| 236 |
|
| 237 |
progress(1.0, "Preparing results")
|
| 238 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
|
@@ -301,7 +298,6 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 301 |
frames_folder,
|
| 302 |
heatmap_video_path,
|
| 303 |
combined_mse_plot,
|
| 304 |
-
combined_heatmap,
|
| 305 |
correlation_heatmap
|
| 306 |
)
|
| 307 |
|
|
|
|
| 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, plot_correlation_heatmap
|
| 14 |
from utils import frame_to_timecode
|
| 15 |
import pandas as pd
|
| 16 |
from facenet_pytorch import MTCNN
|
|
|
|
| 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 |
correlation_heatmap = plot_correlation_heatmap(mse_embeddings, mse_posture, mse_voice)
|
| 204 |
|
| 205 |
try:
|
|
|
|
| 229 |
print(f"Error details: {str(e)}")
|
| 230 |
import traceback
|
| 231 |
traceback.print_exc()
|
| 232 |
+
return (f"Error in video processing: {str(e)}",) + (None,) * 27
|
| 233 |
|
| 234 |
progress(1.0, "Preparing results")
|
| 235 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
|
|
|
| 298 |
frames_folder,
|
| 299 |
heatmap_video_path,
|
| 300 |
combined_mse_plot,
|
|
|
|
| 301 |
correlation_heatmap
|
| 302 |
)
|
| 303 |
|