mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-06 21:12:07 -07:00
fix
This commit is contained in:
parent
da7cf225db
commit
bf831331e6
1 changed files with 66 additions and 59 deletions
|
@ -142,6 +142,14 @@ class ExtractSubprocessor(Subprocessor):
|
||||||
debug_output_file = str( Path(self.debug_dir) / (filename_path.stem+'.jpg') )
|
debug_output_file = str( Path(self.debug_dir) / (filename_path.stem+'.jpg') )
|
||||||
debug_image = image.copy()
|
debug_image = image.copy()
|
||||||
|
|
||||||
|
if src_dflimg is not None and len(faces) != 1:
|
||||||
|
#if re-extracting from dflimg and more than 1 or zero faces detected - dont process and just copy it
|
||||||
|
print("src_dflimg is not None and len(faces) != 1", str(filename_path) )
|
||||||
|
output_file = str(self.output_path / filename_path.name)
|
||||||
|
if str(filename_path) != str(output_file):
|
||||||
|
shutil.copy ( str(filename_path), str(output_file) )
|
||||||
|
result.append (output_file)
|
||||||
|
else:
|
||||||
face_idx = 0
|
face_idx = 0
|
||||||
for face in faces:
|
for face in faces:
|
||||||
rect = np.array(face[0])
|
rect = np.array(face[0])
|
||||||
|
@ -169,9 +177,6 @@ class ExtractSubprocessor(Subprocessor):
|
||||||
if self.debug_dir is not None:
|
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)
|
LandmarksProcessor.draw_rect_landmarks (debug_image, rect, image_landmarks, self.image_size, self.face_type, transparent_mask=True)
|
||||||
|
|
||||||
output_file = '{}_{}{}'.format(str(self.output_path / filename_path.stem), str(face_idx), '.jpg')
|
|
||||||
face_idx += 1
|
|
||||||
|
|
||||||
landmarks=face_image_landmarks.tolist()
|
landmarks=face_image_landmarks.tolist()
|
||||||
source_filename = filename_path.name
|
source_filename = filename_path.name
|
||||||
source_landmarks = image_landmarks.tolist()
|
source_landmarks = image_landmarks.tolist()
|
||||||
|
@ -189,6 +194,7 @@ class ExtractSubprocessor(Subprocessor):
|
||||||
image_to_face_mat = mat
|
image_to_face_mat = mat
|
||||||
source_landmarks = LandmarksProcessor.transform_points (landmarks, image_to_face_mat, True)
|
source_landmarks = LandmarksProcessor.transform_points (landmarks, image_to_face_mat, True)
|
||||||
else:
|
else:
|
||||||
|
output_file = '{}_{}{}'.format(str(self.output_path / filename_path.stem), str(face_idx), '.jpg')
|
||||||
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),
|
||||||
|
@ -200,6 +206,7 @@ class ExtractSubprocessor(Subprocessor):
|
||||||
)
|
)
|
||||||
|
|
||||||
result.append (output_file)
|
result.append (output_file)
|
||||||
|
face_idx += 1
|
||||||
|
|
||||||
if self.debug_dir is not None:
|
if self.debug_dir is not None:
|
||||||
cv2_imwrite(debug_output_file, debug_image, [int(cv2.IMWRITE_JPEG_QUALITY), 50] )
|
cv2_imwrite(debug_output_file, debug_image, [int(cv2.IMWRITE_JPEG_QUALITY), 50] )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue