commit 3e3979ff7b26c5c45b646a8c145b639fb78c1059 Author: Zofia Zientek Date: Thu Dec 7 19:49:09 2023 +0100 Base result for gonito challange diff --git a/base_results.py b/base_results.py new file mode 100644 index 0000000..6dad75b --- /dev/null +++ b/base_results.py @@ -0,0 +1,28 @@ +import os +import dlib +from skimage import io +import imghdr + + +pwd = os.path.dirname(__file__) +result = open(pwd + '\\test-A\out.tsv', 'w') + +sp = dlib.shape_predictor(pwd + '\shape_predictor_68_face_landmarks.dat') +facerec = dlib.face_recognition_model_v1(pwd + '\dlib_face_recognition_resnet_model_v1.dat') +detector = dlib.get_frontal_face_detector() + +directory = input('Enter directory path:\n') + +for filename in os.listdir(directory): + f = os.path.join(directory, filename) + picture = io.imread(f) + if imghdr.what(f) != 'png': + dets = detector(picture, 1) + for k, d in enumerate(dets): + fraze = "face:"+str(d.left())+","+str(d.top())+","+str(d.right())+","+str(d.bottom())+"\t" + result.write(fraze) + shape = sp(picture, d) + + result.write('\n') + +result.close() \ No newline at end of file diff --git a/dlib_face_recognition_resnet_model_v1.dat b/dlib_face_recognition_resnet_model_v1.dat new file mode 100644 index 0000000..ddb5158 Binary files /dev/null and b/dlib_face_recognition_resnet_model_v1.dat differ diff --git a/shape_predictor_68_face_landmarks.dat b/shape_predictor_68_face_landmarks.dat new file mode 100644 index 0000000..e0ec20d Binary files /dev/null and b/shape_predictor_68_face_landmarks.dat differ