mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-06 04:52:13 -07:00
1
This commit is contained in:
parent
668513a507
commit
6b14741160
5 changed files with 375 additions and 31 deletions
|
@ -27,13 +27,14 @@ DEBUG = False
|
|||
|
||||
class ExtractSubprocessor(Subprocessor):
|
||||
class Data(object):
|
||||
def __init__(self, filename=None, rects=None, landmarks = None, landmarks_accurate=True, pitch_yaw_roll=None, final_output_files = None):
|
||||
def __init__(self, filename=None, rects=None, landmarks = None, landmarks_accurate=True, pitch_yaw_roll=None, force_output_path=None, final_output_files = None):
|
||||
self.filename = filename
|
||||
self.rects = rects or []
|
||||
self.rects_rotation = 0
|
||||
self.landmarks_accurate = landmarks_accurate
|
||||
self.landmarks = landmarks or []
|
||||
self.pitch_yaw_roll = pitch_yaw_roll
|
||||
self.force_output_path = force_output_path
|
||||
self.final_output_files = final_output_files or []
|
||||
self.faces_detected = 0
|
||||
|
||||
|
@ -248,13 +249,18 @@ class ExtractSubprocessor(Subprocessor):
|
|||
if self.debug_dir is not None:
|
||||
LandmarksProcessor.draw_rect_landmarks (debug_image, rect, image_landmarks, self.image_size, self.face_type, transparent_mask=True)
|
||||
|
||||
final_output_path = self.final_output_path
|
||||
if data.force_output_path is not None:
|
||||
final_output_path = data.force_output_path
|
||||
|
||||
if src_dflimg is not None and filename_path.suffix == '.jpg':
|
||||
#if extracting from dflimg and jpg copy it in order not to lose quality
|
||||
output_file = str(self.final_output_path / filename_path.name)
|
||||
output_file = str(final_output_path / filename_path.name)
|
||||
if str(filename_path) != str(output_file):
|
||||
shutil.copy ( str(filename_path), str(output_file) )
|
||||
else:
|
||||
output_file = '{}_{}{}'.format(str(self.final_output_path / filename_path.stem), str(face_idx), '.jpg')
|
||||
|
||||
output_file = '{}_{}{}'.format(str(final_output_path / filename_path.stem), str(face_idx), '.jpg')
|
||||
cv2_imwrite(output_file, face_image, [int(cv2.IMWRITE_JPEG_QUALITY), 100] )
|
||||
|
||||
DFLJPG.embed_data(output_file, face_type=FaceType.toString(self.face_type),
|
||||
|
@ -303,7 +309,8 @@ class ExtractSubprocessor(Subprocessor):
|
|||
self.devices = ExtractSubprocessor.get_devices_for_config(self.manual, self.type, multi_gpu, cpu_only)
|
||||
|
||||
no_response_time_sec = 60 if not self.manual and not DEBUG else 999999
|
||||
super().__init__('Extractor', ExtractSubprocessor.Cli, no_response_time_sec)
|
||||
|
||||
super().__init__('Extractor', ExtractSubprocessor.Cli, no_response_time_sec, initialize_subprocesses_in_serial=(type != 'final'))
|
||||
|
||||
#override
|
||||
def on_check_run(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue