mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-06 21:12:07 -07:00
extractor: added ability to re-extract dst faces with transferring all necessary meta data
This commit is contained in:
parent
00e56299c4
commit
b03d62a29b
1 changed files with 19 additions and 6 deletions
|
@ -163,17 +163,30 @@ class ExtractSubprocessor(Subprocessor):
|
||||||
output_file = '{}_{}{}'.format(str(self.output_path / filename_path.stem), str(face_idx), '.jpg')
|
output_file = '{}_{}{}'.format(str(self.output_path / filename_path.stem), str(face_idx), '.jpg')
|
||||||
face_idx += 1
|
face_idx += 1
|
||||||
|
|
||||||
|
landmarks=face_image_landmarks.tolist()
|
||||||
|
source_filename = filename_path.name
|
||||||
|
source_landmarks = image_landmarks.tolist()
|
||||||
|
source_rect = rect
|
||||||
if src_dflimg is not None:
|
if src_dflimg is not None:
|
||||||
#if extracting from dflimg just copy it in order not to lose quality
|
#if extracting from dflimg copy it in order not to lose quality
|
||||||
|
output_file = str(self.output_path / filename_path.name)
|
||||||
shutil.copy ( str(filename_path), str(output_file) )
|
shutil.copy ( str(filename_path), str(output_file) )
|
||||||
|
|
||||||
|
#and transfer data
|
||||||
|
source_filename = src_dflimg.get_source_filename()
|
||||||
|
mat = src_dflimg.get_image_to_face_mat()
|
||||||
|
if mat is not None:
|
||||||
|
image_to_face_mat = mat
|
||||||
|
source_landmarks = LandmarksProcessor.transform_points (landmarks, image_to_face_mat, True)
|
||||||
else:
|
else:
|
||||||
cv2_imwrite(output_file, face_image, [int(cv2.IMWRITE_JPEG_QUALITY), 85] )
|
cv2_imwrite(output_file, face_image, [int(cv2.IMWRITE_JPEG_QUALITY), 85] )
|
||||||
|
|
||||||
DFLJPG.embed_data(output_file, face_type = FaceType.toString(self.face_type),
|
DFLJPG.embed_data(output_file, face_type=FaceType.toString(self.face_type),
|
||||||
landmarks = face_image_landmarks.tolist(),
|
landmarks=landmarks,
|
||||||
source_filename = filename_path.name,
|
source_filename=source_filename,
|
||||||
source_rect= rect,
|
source_rect=source_rect,
|
||||||
source_landmarks = image_landmarks.tolist()
|
source_landmarks=source_landmarks,
|
||||||
|
image_to_face_mat=image_to_face_mat
|
||||||
)
|
)
|
||||||
|
|
||||||
result.append (output_file)
|
result.append (output_file)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue