-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathtest_libreface.py
30 lines (25 loc) · 1.8 KB
/
test_libreface.py
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
import libreface
import time
# inference on single image and store results to a variable
detected_facial_attributes = libreface.get_facial_attributes_image(image_path = "sample_disfa.png",
temp_dir = "./temp",
device = "cpu")
# inference on a single image and save results in a csv file
libreface.save_facial_attributes_image(image_path = "sample_disfa.png",
output_save_path = "sample_image_results.csv",
temp_dir = "./temp",
device = "cpu")
# inference on a video and store the results to a pandas dataframe
detected_facial_attributes_df = libreface.get_facial_attributes_video(video_path = "sample_disfa.avi",
temp_dir = "./temp",
device = "cpu")
# ## inference on a video and save the results framewise in a csv file
libreface.save_facial_attributes_video(video_path = "sample_disfa.avi",
output_save_path = "sample_video_results.csv",
temp_dir = "./temp",
device = "cpu")
## inference on any image or video type and store results accordingly to a variable or save results
detected_facial_attributes = libreface.get_facial_attributes(file_path = "sample_disfa.avi",
output_save_path = "sample_results.csv",
temp_dir = "./temp",
device = "cpu")