mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-06 04:52:13 -07:00
Upgraded to TF version 1.13.2
Removed the wait at first launch for most graphics cards. Increased speed of training by 10-20%, but you have to retrain all models from scratch. SAEHD: added option 'use float16' Experimental option. Reduces the model size by half. Increases the speed of training. Decreases the accuracy of the model. The model may collapse or not train. Model may not learn the mask in large resolutions. true_face_training option is replaced by "True face power". 0.0000 .. 1.0 Experimental option. Discriminates the result face to be more like the src face. Higher value - stronger discrimination. Comparison - https://i.imgur.com/czScS9q.png
This commit is contained in:
parent
a3dfcb91b9
commit
76ca79216e
49 changed files with 1320 additions and 1297 deletions
|
@ -15,34 +15,34 @@ def save_faceset_metadata_folder(input_path):
|
|||
input_path = Path(input_path)
|
||||
|
||||
metadata_filepath = input_path / 'meta.dat'
|
||||
|
||||
|
||||
io.log_info (f"Saving metadata to {str(metadata_filepath)}\r\n")
|
||||
|
||||
d = {}
|
||||
for filepath in io.progress_bar_generator( pathex.get_image_paths(input_path), "Processing"):
|
||||
filepath = Path(filepath)
|
||||
dflimg = DFLIMG.load (filepath)
|
||||
|
||||
dfl_dict = dflimg.getDFLDictData()
|
||||
|
||||
dfl_dict = dflimg.getDFLDictData()
|
||||
d[filepath.name] = ( dflimg.get_shape(), dfl_dict )
|
||||
|
||||
|
||||
try:
|
||||
with open(metadata_filepath, "wb") as f:
|
||||
f.write ( pickle.dumps(d) )
|
||||
except:
|
||||
raise Exception( 'cannot save %s' % (filename) )
|
||||
|
||||
|
||||
io.log_info("Now you can edit images.")
|
||||
io.log_info("!!! Keep same filenames in the folder.")
|
||||
io.log_info("You can change size of images, restoring process will downscale back to original size.")
|
||||
io.log_info("!!! Keep same filenames in the folder.")
|
||||
io.log_info("You can change size of images, restoring process will downscale back to original size.")
|
||||
io.log_info("After that, use restore metadata.")
|
||||
|
||||
|
||||
def restore_faceset_metadata_folder(input_path):
|
||||
input_path = Path(input_path)
|
||||
|
||||
metadata_filepath = input_path / 'meta.dat'
|
||||
io.log_info (f"Restoring metadata from {str(metadata_filepath)}.\r\n")
|
||||
|
||||
|
||||
if not metadata_filepath.exists():
|
||||
io.log_err(f"Unable to find {str(metadata_filepath)}.")
|
||||
|
||||
|
@ -54,27 +54,27 @@ def restore_faceset_metadata_folder(input_path):
|
|||
|
||||
for filepath in io.progress_bar_generator( pathex.get_image_paths(input_path), "Processing"):
|
||||
filepath = Path(filepath)
|
||||
|
||||
|
||||
shape, dfl_dict = d.get(filepath.name, None)
|
||||
|
||||
|
||||
img = cv2_imread (str(filepath))
|
||||
if img.shape != shape:
|
||||
img = cv2.resize (img, (shape[1], shape[0]), cv2.INTER_LANCZOS4 )
|
||||
|
||||
|
||||
if filepath.suffix == '.png':
|
||||
cv2_imwrite (str(filepath), img)
|
||||
elif filepath.suffix == '.jpg':
|
||||
cv2_imwrite (str(filepath), img)
|
||||
elif filepath.suffix == '.jpg':
|
||||
cv2_imwrite (str(filepath), img, [int(cv2.IMWRITE_JPEG_QUALITY), 100] )
|
||||
|
||||
if filepath.suffix == '.png':
|
||||
DFLPNG.embed_dfldict( str(filepath), dfl_dict )
|
||||
elif filepath.suffix == '.jpg':
|
||||
DFLPNG.embed_dfldict( str(filepath), dfl_dict )
|
||||
elif filepath.suffix == '.jpg':
|
||||
DFLJPG.embed_dfldict( str(filepath), dfl_dict )
|
||||
else:
|
||||
continue
|
||||
|
||||
|
||||
metadata_filepath.unlink()
|
||||
|
||||
|
||||
def remove_ie_polys_file (filepath):
|
||||
filepath = Path(filepath)
|
||||
|
||||
|
@ -95,7 +95,7 @@ def remove_ie_polys_folder(input_path):
|
|||
for filepath in io.progress_bar_generator( pathex.get_image_paths(input_path), "Removing"):
|
||||
filepath = Path(filepath)
|
||||
remove_ie_polys_file(filepath)
|
||||
|
||||
|
||||
def remove_fanseg_file (filepath):
|
||||
filepath = Path(filepath)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue