added
4.2.other) data_src util faceset metadata save.bat saves metadata of data_src\aligned\ faces into data_src\aligned\meta.dat 4.2.other) data_src util faceset metadata restore.bat restore metadata from 'meta.dat' to images if image size different from original, then it will be automatically resized You can greatly enhance face details of src faceset by using Topaz Gigapixel software. example https://i.imgur.com/Gwee99L.jpg Example of workflow: 1) run 'data_src util faceset metadata save.bat' 2) launch Topaz Gigapixel 3) open 'data_src\aligned\' and select all images 4) set output folder to 'data_src\aligned_topaz' (create folder in save dialog) 5) set settings as on screenshot https://i.imgur.com/kAVWMQG.jpg you can choose 2x, 4x, or 6x upscale rate 6) start process images and wait full process 7) rename folders: data_src\aligned -> data_src\aligned_original data_src\aligned_topaz -> data_src\aligned 8) copy 'data_src\aligned_original\meta.dat' to 'data_src\aligned\' 9) run 'data_src util faceset metadata restore.bat' images will be downscaled back to original size (256x256) preserving details metadata will be restored 10) now your new enhanced faceset is ready to use !
This commit is contained in:
@@ -159,6 +159,17 @@ class DFLJPG(object):
|
||||
print (e)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def embed_dfldict(filename, dfl_dict):
|
||||
inst = DFLJPG.load_raw (filename)
|
||||
inst.setDFLDictData (dfl_dict)
|
||||
|
||||
try:
|
||||
with open(filename, "wb") as f:
|
||||
f.write ( inst.dump() )
|
||||
except:
|
||||
raise Exception( 'cannot save %s' % (filename) )
|
||||
|
||||
@staticmethod
|
||||
def embed_data(filename, face_type=None,
|
||||
landmarks=None,
|
||||
@@ -185,26 +196,18 @@ class DFLJPG(object):
|
||||
io.log_err("Unable to encode fanseg_mask for %s" % (filename) )
|
||||
fanseg_mask = None
|
||||
|
||||
inst = DFLJPG.load_raw (filename)
|
||||
inst.setDFLDictData ({
|
||||
'face_type': face_type,
|
||||
'landmarks': landmarks,
|
||||
'ie_polys' : ie_polys.dump() if ie_polys is not None else None,
|
||||
'source_filename': source_filename,
|
||||
'source_rect': source_rect,
|
||||
'source_landmarks': source_landmarks,
|
||||
'image_to_face_mat': image_to_face_mat,
|
||||
'fanseg_mask' : fanseg_mask,
|
||||
'pitch_yaw_roll' : pitch_yaw_roll,
|
||||
'eyebrows_expand_mod' : eyebrows_expand_mod,
|
||||
'relighted' : relighted
|
||||
})
|
||||
|
||||
try:
|
||||
with open(filename, "wb") as f:
|
||||
f.write ( inst.dump() )
|
||||
except:
|
||||
raise Exception( 'cannot save %s' % (filename) )
|
||||
DFLJPG.embed_dfldict (filename, {'face_type': face_type,
|
||||
'landmarks': landmarks,
|
||||
'ie_polys' : ie_polys.dump() if ie_polys is not None else None,
|
||||
'source_filename': source_filename,
|
||||
'source_rect': source_rect,
|
||||
'source_landmarks': source_landmarks,
|
||||
'image_to_face_mat': image_to_face_mat,
|
||||
'fanseg_mask' : fanseg_mask,
|
||||
'pitch_yaw_roll' : pitch_yaw_roll,
|
||||
'eyebrows_expand_mod' : eyebrows_expand_mod,
|
||||
'relighted' : relighted
|
||||
})
|
||||
|
||||
def embed_and_set(self, filename, face_type=None,
|
||||
landmarks=None,
|
||||
@@ -246,7 +249,7 @@ class DFLJPG(object):
|
||||
|
||||
def remove_fanseg_mask(self):
|
||||
self.dfl_dict['fanseg_mask'] = None
|
||||
|
||||
|
||||
def remove_source_filename(self):
|
||||
self.dfl_dict['source_filename'] = None
|
||||
|
||||
|
||||
@@ -275,6 +275,17 @@ class DFLPNG(object):
|
||||
print(e)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def embed_dfldict(filename, dfl_dict):
|
||||
inst = DFLPNG.load_raw (filename)
|
||||
inst.setDFLDictData (dfl_dict)
|
||||
|
||||
try:
|
||||
with open(filename, "wb") as f:
|
||||
f.write ( inst.dump() )
|
||||
except:
|
||||
raise Exception( 'cannot save %s' % (filename) )
|
||||
|
||||
@staticmethod
|
||||
def embed_data(filename, face_type=None,
|
||||
landmarks=None,
|
||||
@@ -301,26 +312,18 @@ class DFLPNG(object):
|
||||
io.log_err("Unable to encode fanseg_mask for %s" % (filename) )
|
||||
fanseg_mask = None
|
||||
|
||||
inst = DFLPNG.load_raw (filename)
|
||||
inst.setDFLDictData ({
|
||||
'face_type': face_type,
|
||||
'landmarks': landmarks,
|
||||
'ie_polys' : ie_polys.dump() if ie_polys is not None else None,
|
||||
'source_filename': source_filename,
|
||||
'source_rect': source_rect,
|
||||
'source_landmarks': source_landmarks,
|
||||
'image_to_face_mat':image_to_face_mat,
|
||||
'fanseg_mask' : fanseg_mask,
|
||||
'pitch_yaw_roll' : pitch_yaw_roll,
|
||||
'eyebrows_expand_mod' : eyebrows_expand_mod,
|
||||
'relighted' : relighted
|
||||
})
|
||||
|
||||
try:
|
||||
with open(filename, "wb") as f:
|
||||
f.write ( inst.dump() )
|
||||
except:
|
||||
raise Exception( 'cannot save %s' % (filename) )
|
||||
DFLPNG.embed_dfldict (filename, {'face_type': face_type,
|
||||
'landmarks': landmarks,
|
||||
'ie_polys' : ie_polys.dump() if ie_polys is not None else None,
|
||||
'source_filename': source_filename,
|
||||
'source_rect': source_rect,
|
||||
'source_landmarks': source_landmarks,
|
||||
'image_to_face_mat':image_to_face_mat,
|
||||
'fanseg_mask' : fanseg_mask,
|
||||
'pitch_yaw_roll' : pitch_yaw_roll,
|
||||
'eyebrows_expand_mod' : eyebrows_expand_mod,
|
||||
'relighted' : relighted
|
||||
})
|
||||
|
||||
def embed_and_set(self, filename, face_type=None,
|
||||
landmarks=None,
|
||||
|
||||
Reference in New Issue
Block a user