mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2024-12-24 23:11:12 -08:00
2b7364005d
Now you can replace the head. Example: https://www.youtube.com/watch?v=xr5FHd0AdlQ Requirements: Post processing skill in Adobe After Effects or Davinci Resolve. Usage: 1) Find suitable dst footage with the monotonous background behind head 2) Use “extract head” script 3) Gather rich src headset from only one scene (same color and haircut) 4) Mask whole head for src and dst using XSeg editor 5) Train XSeg 6) Apply trained XSeg mask for src and dst headsets 7) Train SAEHD using ‘head’ face_type as regular deepfake model with DF archi. You can use pretrained model for head. Minimum recommended resolution for head is 224. 8) Extract multiple tracks, using Merger: a. Raw-rgb b. XSeg-prd mask c. XSeg-dst mask 9) Using AAE or DavinciResolve, do: a. Hide source head using XSeg-prd mask: content-aware-fill, clone-stamp, background retraction, or other technique b. Overlay new head using XSeg-dst mask Warning: Head faceset can be used for whole_face or less types of training only with XSeg masking. XSegEditor: added button ‘view trained XSeg mask’, so you can see which frames should be masked to improve mask quality.
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
from enum import IntEnum
|
|
|
|
class FaceType(IntEnum):
|
|
#enumerating in order "next contains prev"
|
|
HALF = 0
|
|
MID_FULL = 1
|
|
FULL = 2
|
|
FULL_NO_ALIGN = 3
|
|
WHOLE_FACE = 4
|
|
HEAD = 10
|
|
HEAD_NO_ALIGN = 20
|
|
|
|
MARK_ONLY = 100, #no align at all, just embedded faceinfo
|
|
|
|
@staticmethod
|
|
def fromString (s):
|
|
r = from_string_dict.get (s.lower())
|
|
if r is None:
|
|
raise Exception ('FaceType.fromString value error')
|
|
return r
|
|
|
|
@staticmethod
|
|
def toString (face_type):
|
|
return to_string_dict[face_type]
|
|
|
|
to_string_dict = { FaceType.HALF : 'half_face',
|
|
FaceType.MID_FULL : 'midfull_face',
|
|
FaceType.FULL : 'full_face',
|
|
FaceType.FULL_NO_ALIGN : 'full_face_no_align',
|
|
FaceType.WHOLE_FACE : 'whole_face',
|
|
FaceType.HEAD : 'head',
|
|
FaceType.HEAD_NO_ALIGN : 'head_no_align',
|
|
|
|
FaceType.MARK_ONLY :'mark_only',
|
|
}
|
|
|
|
from_string_dict = { to_string_dict[x] : x for x in to_string_dict.keys() } |