Spaces:
Runtime error
Runtime error
Update video_processing.py
Browse files- video_processing.py +3 -3
video_processing.py
CHANGED
|
@@ -21,10 +21,10 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
| 21 |
mtcnn = MTCNN(keep_all=False, device=device, thresholds=[0.9, 0.9, 0.9], min_face_size=50)
|
| 22 |
|
| 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.
|
| 25 |
|
| 26 |
mp_pose = mp.solutions.pose
|
| 27 |
-
pose = mp_pose.Pose(static_image_mode=False, min_detection_confidence=0.
|
| 28 |
|
| 29 |
def extract_frames(video_path, output_folder, desired_fps, progress_callback=None):
|
| 30 |
os.makedirs(output_folder, exist_ok=True)
|
|
@@ -251,7 +251,7 @@ def process_video(video_path, anomaly_threshold, desired_fps, progress=None):
|
|
| 251 |
frames_folder
|
| 252 |
)
|
| 253 |
|
| 254 |
-
def is_frontal_face(landmarks, threshold=
|
| 255 |
nose_tip = landmarks[4]
|
| 256 |
left_chin = landmarks[234]
|
| 257 |
right_chin = landmarks[454]
|
|
|
|
| 21 |
mtcnn = MTCNN(keep_all=False, device=device, thresholds=[0.9, 0.9, 0.9], min_face_size=50)
|
| 22 |
|
| 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 |
mp_pose = mp.solutions.pose
|
| 27 |
+
pose = mp_pose.Pose(static_image_mode=False, min_detection_confidence=0.8, min_tracking_confidence=0.8)
|
| 28 |
|
| 29 |
def extract_frames(video_path, output_folder, desired_fps, progress_callback=None):
|
| 30 |
os.makedirs(output_folder, exist_ok=True)
|
|
|
|
| 251 |
frames_folder
|
| 252 |
)
|
| 253 |
|
| 254 |
+
def is_frontal_face(landmarks, threshold=60):
|
| 255 |
nose_tip = landmarks[4]
|
| 256 |
left_chin = landmarks[234]
|
| 257 |
right_chin = landmarks[454]
|