Spaces:
Runtime error
Runtime error
Update pickleface.py
Browse files- pickleface.py +27 -19
pickleface.py
CHANGED
|
@@ -1,19 +1,27 @@
|
|
| 1 |
-
from avatar import Avatar
|
| 2 |
-
import pickle
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from avatar import Avatar
|
| 2 |
+
import pickle
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
try:
|
| 6 |
+
# Khởi tạo Avatar
|
| 7 |
+
avatar = Avatar()
|
| 8 |
+
|
| 9 |
+
# Load video MC6
|
| 10 |
+
video_path = "ref_videos/MC6.mp4"
|
| 11 |
+
avatar.get_video_full_frames(video_path)
|
| 12 |
+
|
| 13 |
+
# Tạo face detection results
|
| 14 |
+
print("Creating face detection results...")
|
| 15 |
+
face_det_results = avatar.create_face_detection_results(avatar.video_full_frames, save_result=False)
|
| 16 |
+
|
| 17 |
+
# Lưu kết quả vào file pkl
|
| 18 |
+
output_path = "ref_videos/MC6_face_det_result.pkl"
|
| 19 |
+
with open(output_path, 'wb') as f:
|
| 20 |
+
pickle.dump(face_det_results, f)
|
| 21 |
+
|
| 22 |
+
print(f"Successfully saved face detection results to {output_path}")
|
| 23 |
+
sys.exit(0)
|
| 24 |
+
|
| 25 |
+
except Exception as e:
|
| 26 |
+
print(f"Error: {str(e)}")
|
| 27 |
+
sys.exit(1)
|