Skip to content

Commit 13a31cf

Browse files
committed
Replace local models with a call to face_recognition_models
1 parent 51acc6e commit 13a31cf

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

face_recognition/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import scipy.misc
44
import dlib
55
import numpy as np
6-
from pkg_resources import resource_filename
6+
import face_recognition_models
77

8-
predictor_model = resource_filename(__name__, "models/shape_predictor_68_face_landmarks.dat")
8+
predictor_model = face_recognition_models.pose_predictor_model_location()
99
pose_predictor = dlib.shape_predictor(predictor_model)
1010

11-
face_recognition_model = resource_filename(__name__, "models/dlib_face_recognition_resnet_model_v1.dat")
11+
face_recognition_model = face_recognition_models.face_recognition_model_location()
1212
face_encoder = dlib.face_recognition_model_v1(face_recognition_model)
1313

1414

-21.4 MB
Binary file not shown.
-95.1 MB
Binary file not shown.

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
history = history_file.read()
1111

1212
requirements = [
13+
'face_recognition_models',
1314
'Click>=6.0',
1415
'dlib>=19.3.0',
1516
'numpy',
@@ -22,7 +23,7 @@
2223

2324
setup(
2425
name='face_recognition',
25-
version='0.1.2',
26+
version='0.1.3',
2627
description="Recognize faces from Python or from the command line",
2728
long_description=readme + '\n\n' + history,
2829
author="Adam Geitgey",

tests/test_face_recognition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_face_landmarks(self):
5252
img = api.load_image_file(os.path.join(os.path.dirname(__file__), "test_images", "obama.jpg"))
5353
face_landmarks = api.face_landmarks(img)
5454

55-
assert list(face_landmarks[0].keys()) == ['chin', 'left_eyebrow', 'right_eyebrow', 'nose_bridge', 'nose_tip', 'left_eye', 'right_eye', 'top_lip', 'bottom_lip']
55+
assert set(face_landmarks[0].keys()) == set(['chin', 'left_eyebrow', 'right_eyebrow', 'nose_bridge', 'nose_tip', 'left_eye', 'right_eye', 'top_lip', 'bottom_lip'])
5656
assert face_landmarks[0]['chin'] == [(369, 220), (372, 254), (378, 289), (384, 322), (395, 353), (414, 382), (437, 407), (464, 424), (495, 428), (527, 420), (552, 399), (576, 372), (594, 344), (604, 314)]
5757

5858
def test_face_encodings(self):

0 commit comments

Comments
 (0)