Last active
November 9, 2019 12:43
-
-
Save jagin/9a2c663fbabc1e2d5d0d92d52a9978e6 to your computer and use it in GitHub Desktop.
Face detector test (see: https://medium.com/deepvisionguru/video-processing-pipeline-with-opencv-ac10187d75b)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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