forked from dchen236/FairFace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec.py
More file actions
28 lines (25 loc) · 909 Bytes
/
Copy pathexec.py
File metadata and controls
28 lines (25 loc) · 909 Bytes
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
import predict
import pandas as pd
import argparse
import dlib
import uuid
import os
if __name__ == "__main__":
cnn_face_detector = dlib.cnn_face_detection_model_v1(
'dlib_models/mmod_human_face_detector.dat')
sp = dlib.shape_predictor(
'dlib_models/shape_predictor_5_face_landmarks.dat')
f_id = str(uuid.uuid4())
SAVE_DETECTED_AT = "detected_faces/" + f_id
predict.ensure_dir(SAVE_DETECTED_AT) # 디렉토리 생성
nas = "detected_faces/race_Asian_face0.jpg" # image location
imgs = [nas]
predict.detect_face(imgs, SAVE_DETECTED_AT, cnn_face_detector, sp)
#print("detected faces are saved at ", SAVE_DETECTED_AT)
model_7 = predict.make_model7()
model_4 = predict.make_model4()
output = predict.predidct_age_gender_race(
"test_outputs.csv", SAVE_DETECTED_AT, model_7, model_4)
# print('end')
print(output)
# print(arr)