MCPcopy
hub / github.com/serengil/deepface / test_numpy_input

Function test_numpy_input

tests/unit/test_extract_faces.py:85–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83
84
85def test_numpy_input():
86 img_path = "dataset/img1.jpg"
87 img = cv2.imread(img_path)[:, :, ::-1] # BGR to RGB
88 for detector in detectors:
89 img_objs = DeepFace.extract_faces(img_path=img.copy(), detector_backend=detector)
90 # img_objs should be a list of dicts
91 assert isinstance(img_objs, list)
92 assert len(img_objs) == 1
93 for img_obj in img_objs:
94 assert isinstance(img_obj, dict)
95 assert "face" in img_obj.keys()
96 assert "facial_area" in img_obj.keys()
97 face = img_obj["face"]
98 assert face.shape[0] > 0 and face.shape[1] > 0
99 logger.info(f"✅ extract_faces for {detector} backend with numpy input test is done")
100
101
102def test_backends_for_enforced_detection_with_non_facial_inputs():

Callers

nothing calls this directly

Calls 1

infoMethod · 0.80

Tested by

no test coverage detected