-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Mishchenko
committed
Apr 2, 2022
1 parent
e50d9e7
commit e35dc2b
Showing
7 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from insomniac import activation_controller | ||
|
||
exec(activation_controller.get_extra_feature('face_detector')) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
import unittest | ||
|
||
from insomniac.extra_features.face_detector import FaceDetector | ||
|
||
|
||
class FaceDetectorTests(unittest.TestCase): | ||
|
||
ASSETS_DIR = "assets" | ||
face_detector = FaceDetector() | ||
|
||
def setUp(self): | ||
print("Initializing FaceDetector") | ||
self.face_detector.init() | ||
|
||
def test_positive(self): | ||
for file in os.listdir(self.ASSETS_DIR): | ||
filename = os.fsdecode(file) | ||
if filename.startswith("face"): | ||
is_face = self.face_detector.is_face_on_image_by_filename(os.path.join(self.ASSETS_DIR, file)) | ||
assert is_face | ||
|
||
def test_negative(self): | ||
for file in os.listdir(self.ASSETS_DIR): | ||
filename = os.fsdecode(file) | ||
if filename.startswith("notface"): | ||
is_face = self.face_detector.is_face_on_image_by_filename(os.path.join(self.ASSETS_DIR, file)) | ||
assert not is_face | ||
|
||
@staticmethod | ||
def _interpret_faces_array(faces) -> str: | ||
if len(faces) > 0: | ||
return "face" | ||
else: | ||
return "not face" |