Ejemplo n.º 1
0
 def test_features(self):
     image_a = io.load_image("faces/albert-einstein.jpg")
     image_b = io.load_image("faces/einstein-laughing.jpg")
     features_a = self.get_features(image_a)
     features_b = self.get_features(image_b)
     distance = features_distance(features_a, features_b)
     self.assertTrue(distance < 0.6)
Ejemplo n.º 2
0
 def test_landmarks(self):
     image = io.load_image("faces/albert-einstein.jpg")
     faces = detect_faces(image)
     self.assertTrue(len(faces) == 1)
     face = faces[0]
     landmarks = face_landmarks(image, face)
     self.assertTrue(len(landmarks) == 68)
Ejemplo n.º 3
0
 def test_features(self):
     image = io.load_image("faces/albert-einstein.jpg")
     faces = detect_faces(image)
     self.assertTrue(len(faces) == 1)
     face = faces[0]
     landmarks = face_landmarks(image, face)
     features = extract_face_features(image, landmarks.shape)
     self.assertTrue(len(features) == 128)
Ejemplo n.º 4
0
 def test_faces(self):
     for image_file in glob("faces/*.jpg"):
         image = io.load_image(image_file)
         faces = detect_faces(image, min_score=1.0)
         face = faces[0]
         landmarks = face_landmarks(image, face)
         image = visualize(
             image,
             face,
             landmarks=landmarks,
             thickness=1,
             color=(0, 0, 255),
         )
         cv2.imshow('image', image)
         cv2.imwrite('images/' + image_file, image)
         cv2.waitKey(0)
Ejemplo n.º 5
0
 def test_einstein(self):
     image = io.load_image("faces/albert-einstein.jpg")
     faces = detect_faces(image)        
     self.assertTrue(len(faces) == 1)
     self.assertTrue(faces[0].width() == 156)