Base result for gonito challange

This commit is contained in:
Zofia Zientek 2023-12-07 19:49:09 +01:00
commit 3e3979ff7b
3 changed files with 28 additions and 0 deletions

28
base_results.py Normal file
View File

@ -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()

Binary file not shown.

Binary file not shown.