Spaces:
Runtime error
Runtime error
Update video_processing.py
Browse files- video_processing.py +2 -5
video_processing.py
CHANGED
|
@@ -23,7 +23,6 @@ mtcnn = MTCNN(keep_all=False, device=device, thresholds=[0.9, 0.9, 0.9], min_fac
|
|
| 23 |
mp_face_mesh = mp.solutions.face_mesh
|
| 24 |
face_mesh = mp_face_mesh.FaceMesh(static_image_mode=False, max_num_faces=1, min_detection_confidence=0.8)
|
| 25 |
|
| 26 |
-
|
| 27 |
def extract_frames(video_path, output_folder, desired_fps, progress_callback=None):
|
| 28 |
os.makedirs(output_folder, exist_ok=True)
|
| 29 |
clip = VideoFileClip(video_path)
|
|
@@ -199,7 +198,6 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 199 |
mse_heatmap_voice = plot_mse_heatmap(mse_voice, "Voice MSE Heatmap", df)
|
| 200 |
|
| 201 |
correlation_heatmap = plot_correlation_heatmap(mse_embeddings, mse_posture, mse_voice)
|
| 202 |
-
scatter_plot_3d = plot_3d_scatter(mse_embeddings, mse_posture, mse_voice)
|
| 203 |
|
| 204 |
try:
|
| 205 |
if progress is not None:
|
|
@@ -228,7 +226,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 228 |
print(f"Error details: {str(e)}")
|
| 229 |
import traceback
|
| 230 |
traceback.print_exc()
|
| 231 |
-
return (f"Error in video processing: {str(e)}",) + (None,) *
|
| 232 |
|
| 233 |
progress(1.0, "Preparing results")
|
| 234 |
results = f"Number of persons detected: {num_clusters}\n\n"
|
|
@@ -296,8 +294,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 296 |
aligned_faces_folder,
|
| 297 |
frames_folder,
|
| 298 |
heatmap_video_path,
|
| 299 |
-
correlation_heatmap
|
| 300 |
-
scatter_plot_3d
|
| 301 |
)
|
| 302 |
|
| 303 |
|
|
|
|
| 23 |
mp_face_mesh = mp.solutions.face_mesh
|
| 24 |
face_mesh = mp_face_mesh.FaceMesh(static_image_mode=False, max_num_faces=1, min_detection_confidence=0.8)
|
| 25 |
|
|
|
|
| 26 |
def extract_frames(video_path, output_folder, desired_fps, progress_callback=None):
|
| 27 |
os.makedirs(output_folder, exist_ok=True)
|
| 28 |
clip = VideoFileClip(video_path)
|
|
|
|
| 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:
|
|
|
|
| 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 |
aligned_faces_folder,
|
| 295 |
frames_folder,
|
| 296 |
heatmap_video_path,
|
| 297 |
+
correlation_heatmap
|
|
|
|
| 298 |
)
|
| 299 |
|
| 300 |
|