Skip to content

Instantly share code, notes, and snippets.

@jagin
Last active November 9, 2019 12:43
Show Gist options
  • Save jagin/9a2c663fbabc1e2d5d0d92d52a9978e6 to your computer and use it in GitHub Desktop.
Save jagin/9a2c663fbabc1e2d5d0d92d52a9978e6 to your computer and use it in GitHub Desktop.
import os
import cv2
from pipeline.libs.face_detector import FaceDetector
import tests.config as config
class TestFaceDetector:
def test_face_detector(self):
prototxt = os.path.join(config.MODELS_FACE_DETECTOR_DIR, "deploy.prototxt.txt")
model = os.path.join(config.MODELS_FACE_DETECTOR_DIR, "res10_300x300_ssd_iter_140000.caffemodel")
detector = FaceDetector(prototxt, model)
test_image = cv2.imread(os.path.join(config.ASSETS_IMAGES_DIR, "friends", "friends_01.jpg"))
faces = detector.detect([test_image])
assert len(faces) == 1
assert len(faces[0]) # Should recognize some faces from friends_01.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment