Repository navigation
Expand file tree
/
Copy pathface_checkpoint.py
More file actions
74 lines (57 loc) · 2.09 KB
/
Copy pathface_checkpoint.py
File metadata and controls
74 lines (57 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import pandas as pd
import os
# ============================================================
# USER INPUT
# ============================================================
csv_path = input("Enter the path of your face_analysis.csv file: ").strip()
# Remove quotes if the user pastes a path like:
# "C:\Users\User\Desktop\face_analysis.csv"
csv_path = csv_path.strip('"').strip("'")
# ============================================================
# CHECK FILE
# ============================================================
if not os.path.isfile(csv_path):
print("\nERROR: File not found.")
print("Please check the file path and try again.")
exit()
# ============================================================
# LOAD CSV
# ============================================================
df = pd.read_csv(csv_path)
# ============================================================
# MOVEMENT COLUMNS
# ============================================================
movement_columns = [
"lip_movement",
"left_eyebrow_movement",
"right_eyebrow_movement",
"left_cheek_movement",
"right_cheek_movement",
"jawline_movement"
]
# ============================================================
# CHECK REQUIRED COLUMNS
# ============================================================
missing_columns = [
col for col in movement_columns
if col not in df.columns
]
if missing_columns:
print("\nERROR: The following columns are missing from the CSV:")
for col in missing_columns:
print(f" - {col}")
exit()
# ============================================================
# MOVEMENT STATISTICS
# ============================================================
print("\n==============================================")
print(" FACIAL MOVEMENT STATISTICS")
print("==============================================")
print(f"\nInput file: {csv_path}")
print(f"Total frames: {len(df)}")
print("\nMovement Statistics:\n")
print(
df[movement_columns].describe(
percentiles=[0.50, 0.75, 0.90, 0.95, 0.99]
)
)