mirror of
https://github.com/deepfakes/faceswap
synced 2025-06-09 13:03:19 -04:00
* Convert prints to logger. Further logging improvements. Tidy up * Fix system verbosity. Allow SystemExit * Fix reload extract bug * Child Traceback handling * Safer shutdown procedure * Add shutdown event to queue manager * landmarks_as_xy > property. GUI notes + linting. Aligner bugfix * fix FaceFilter. Enable nFilter when no Filter is supplied * Fix blurry face filter * Continue on IO error. Better error handling * Explicitly print stack trace tocrash log * Windows Multiprocessing bugfix * Add git info and conda version to crash log * Windows/Anaconda mp bugfix * Logging fixes for training
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
""" Manual face detection plugin """
|
|
|
|
from ._base import Detector, dlib, logger
|
|
|
|
|
|
class Detect(Detector):
|
|
""" Manual Detector """
|
|
def __init__(self, **kwargs):
|
|
super().__init__(**kwargs)
|
|
|
|
def set_model_path(self):
|
|
""" No model required for Manual Detector """
|
|
return None
|
|
|
|
def initialize(self, *args, **kwargs):
|
|
""" Create the mtcnn detector """
|
|
super().initialize(*args, **kwargs)
|
|
logger.info("Initializing Manual Detector...")
|
|
self.init.set()
|
|
logger.info("Initialized Manual Detector.")
|
|
|
|
def detect_faces(self, *args, **kwargs):
|
|
""" Return the given bounding box in a dlib rectangle """
|
|
super().detect_faces(*args, **kwargs)
|
|
while True:
|
|
item = self.get_item()
|
|
if item == "EOF":
|
|
break
|
|
face = item["face"]
|
|
|
|
bounding_box = [dlib.rectangle( # pylint: disable=c-extension-no-member
|
|
int(face[0]), int(face[1]), int(face[2]), int(face[3]))]
|
|
item["detected_faces"] = bounding_box
|
|
self.finalize(item)
|
|
|
|
self.queues["out"].put("EOF")
|