Base result for gonito challange
This commit is contained in:
commit
3e3979ff7b
28
base_results.py
Normal file
28
base_results.py
Normal 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()
|
BIN
dlib_face_recognition_resnet_model_v1.dat
Normal file
BIN
dlib_face_recognition_resnet_model_v1.dat
Normal file
Binary file not shown.
BIN
shape_predictor_68_face_landmarks.dat
Normal file
BIN
shape_predictor_68_face_landmarks.dat
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user