Spaces:
Runtime error
Runtime error
Update video_processing.py
Browse files- video_processing.py +4 -9
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, plot_correlation_heatmap
|
| 14 |
from utils import frame_to_timecode
|
| 15 |
import pandas as pd
|
| 16 |
from facenet_pytorch import MTCNN
|
|
@@ -203,16 +203,11 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 203 |
|
| 204 |
progress(0.95, "Finishing generating graphs")
|
| 205 |
|
| 206 |
-
# Generate the video with heatmap
|
| 207 |
-
output_video_path = os.path.join(output_folder, "output_with_heatmap.mp4")
|
| 208 |
-
create_video_with_heatmap(video_path, mse_embeddings, mse_posture, mse_voice, df, output_video_path)
|
| 209 |
-
|
| 210 |
-
|
| 211 |
except Exception as e:
|
| 212 |
print(f"Error details: {str(e)}")
|
| 213 |
import traceback
|
| 214 |
traceback.print_exc()
|
| 215 |
-
return (f"Error in video processing: {str(e)}",) + (None,) *
|
| 216 |
|
| 217 |
progress(1.0, "Preparing results")
|
| 218 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
|
@@ -280,8 +275,8 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 280 |
aligned_faces_folder,
|
| 281 |
frames_folder,
|
| 282 |
stacked_heatmap,
|
| 283 |
-
correlation_heatmap
|
| 284 |
-
|
| 285 |
)
|
| 286 |
|
| 287 |
|
|
|
|
| 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, plot_correlation_heatmap
|
| 14 |
from utils import frame_to_timecode
|
| 15 |
import pandas as pd
|
| 16 |
from facenet_pytorch import MTCNN
|
|
|
|
| 203 |
|
| 204 |
progress(0.95, "Finishing generating graphs")
|
| 205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
except Exception as e:
|
| 207 |
print(f"Error details: {str(e)}")
|
| 208 |
import traceback
|
| 209 |
traceback.print_exc()
|
| 210 |
+
return (f"Error in video processing: {str(e)}",) + (None,) * 27
|
| 211 |
|
| 212 |
progress(1.0, "Preparing results")
|
| 213 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
|
|
|
| 275 |
aligned_faces_folder,
|
| 276 |
frames_folder,
|
| 277 |
stacked_heatmap,
|
| 278 |
+
correlation_heatmap
|
| 279 |
+
|
| 280 |
)
|
| 281 |
|
| 282 |
|