TDN-M commited on
Commit
7bdef33
·
verified ·
1 Parent(s): 939a8b2

Update pickleface.py

Browse files
Files changed (1) hide show
  1. pickleface.py +27 -19
pickleface.py CHANGED
@@ -1,19 +1,27 @@
1
- from avatar import Avatar
2
- import pickle
3
-
4
- # Khởi tạo Avatar
5
- avatar = Avatar()
6
-
7
- # Load video MC6
8
- video_path = "ref_videos/MC6.mp4"
9
- avatar.get_video_full_frames(video_path)
10
-
11
- # Tạo face detection results
12
- face_det_results = avatar.create_face_detection_results(avatar.video_full_frames, save_result=False)
13
-
14
- # Lưu kết quả vào file pkl
15
- output_path = "ref_videos/MC6_face_det_result.pkl"
16
- with open(output_path, 'wb') as f:
17
- pickle.dump(face_det_results, f)
18
-
19
- print(f"Đã lưu face detection results vào {output_path}")
 
 
 
 
 
 
 
 
 
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)