here new whole_face + XSeg workflow:
with XSeg model you can train your own mask segmentator for dst(and/or src) faces
that will be used by the merger for whole_face.
Instead of using a pretrained segmentator model (which does not exist),
you control which part of faces should be masked.
new scripts:
5.XSeg) data_dst edit masks.bat
5.XSeg) data_src edit masks.bat
5.XSeg) train.bat
Usage:
unpack dst faceset if packed
run 5.XSeg) data_dst edit masks.bat
Read tooltips on the buttons (en/ru/zn languages are supported)
mask the face using include or exclude polygon mode.
repeat for 50/100 faces,
!!! you don't need to mask every frame of dst
only frames where the face is different significantly,
for example:
closed eyes
changed head direction
changed light
the more various faces you mask, the more quality you will get
Start masking from the upper left area and follow the clockwise direction.
Keep the same logic of masking for all frames, for example:
the same approximated jaw line of the side faces, where the jaw is not visible
the same hair line
Mask the obstructions using exclude polygon mode.
run XSeg) train.bat
train the model
Check the faces of 'XSeg dst faces' preview.
if some faces have wrong or glitchy mask, then repeat steps:
run edit
find these glitchy faces and mask them
train further or restart training from scratch
Restart training of XSeg model is only possible by deleting all 'model\XSeg_*' files.
If you want to get the mask of the predicted face (XSeg-prd mode) in merger,
you should repeat the same steps for src faceset.
New mask modes available in merger for whole_face:
XSeg-prd - XSeg mask of predicted face -> faces from src faceset should be labeled
XSeg-dst - XSeg mask of dst face -> faces from dst faceset should be labeled
XSeg-prd*XSeg-dst - the smallest area of both
if workspace\model folder contains trained XSeg model, then merger will use it,
otherwise you will get transparent mask by using XSeg-* modes.
Some screenshots:
XSegEditor: https://i.imgur.com/7Bk4RRV.jpg
trainer : https://i.imgur.com/NM1Kn3s.jpg
merger : https://i.imgur.com/glUzFQ8.jpg
example of the fake using 13 segmented dst faces
: https://i.imgur.com/wmvyizU.gifv
with XSeg model you can train your own mask segmentator of dst(and src) faces
that will be used in merger for whole_face.
Instead of using a pretrained model (which does not exist),
you control which part of faces should be masked.
Workflow is not easy, but at the moment it is the best solution
for obtaining the best quality of whole_face's deepfakes using minimum effort
without rotoscoping in AfterEffects.
new scripts:
XSeg) data_dst edit.bat
XSeg) data_dst merge.bat
XSeg) data_dst split.bat
XSeg) data_src edit.bat
XSeg) data_src merge.bat
XSeg) data_src split.bat
XSeg) train.bat
Usage:
unpack dst faceset if packed
run XSeg) data_dst split.bat
this scripts extracts (previously saved) .json data from jpg faces to use in label tool.
run XSeg) data_dst edit.bat
new tool 'labelme' is used
use polygon (CTRL-N) to mask the face
name polygon "1" (one symbol) as include polygon
name polygon "0" (one symbol) as exclude polygon
'exclude polygons' will be applied after all 'include polygons'
Hot keys:
ctrl-N create polygon
ctrl-J edit polygon
A/D navigate between frames
ctrl + mousewheel image zoom
mousewheel vertical scroll
alt+mousewheel horizontal scroll
repeat for 10/50/100 faces,
you don't need to mask every frame of dst,
only frames where the face is different significantly,
for example:
closed eyes
changed head direction
changed light
the more various faces you mask, the more quality you will get
Start masking from the upper left area and follow the clockwise direction.
Keep the same logic of masking for all frames, for example:
the same approximated jaw line of the side faces, where the jaw is not visible
the same hair line
Mask the obstructions using polygon with name "0".
run XSeg) data_dst merge.bat
this script merges .json data of polygons into jpg faces,
therefore faceset can be sorted or packed as usual.
run XSeg) train.bat
train the model
Check the faces of 'XSeg dst faces' preview.
if some faces have wrong or glitchy mask, then repeat steps:
split
run edit
find these glitchy faces and mask them
merge
train further or restart training from scratch
Restart training of XSeg model is only possible by deleting all 'model\XSeg_*' files.
If you want to get the mask of the predicted face in merger,
you should repeat the same steps for src faceset.
New mask modes available in merger for whole_face:
XSeg-prd - XSeg mask of predicted face -> faces from src faceset should be labeled
XSeg-dst - XSeg mask of dst face -> faces from dst faceset should be labeled
XSeg-prd*XSeg-dst - the smallest area of both
if workspace\model folder contains trained XSeg model, then merger will use it,
otherwise you will get transparent mask by using XSeg-* modes.
Some screenshots:
label tool: https://i.imgur.com/aY6QGw1.jpg
trainer : https://i.imgur.com/NM1Kn3s.jpg
merger : https://i.imgur.com/glUzFQ8.jpg
example of the fake using 13 segmented dst faces
: https://i.imgur.com/wmvyizU.gifv
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
If you want, you can manually remove unnecessary angles from src faceset after sort by yaw.
Optimized sample generators (CPU workers). Now they consume less amount of RAM and work faster.
added
4.2.other) data_src/dst util faceset pack.bat
Packs /aligned/ samples into one /aligned/samples.pak file.
After that, all faces will be deleted.
4.2.other) data_src/dst util faceset unpack.bat
unpacks faces from /aligned/samples.pak to /aligned/ dir.
After that, samples.pak will be deleted.
Packed faceset load and work faster.
fixed model sizes from previous update.
avoided bug in ML framework(keras) that forces to train the model on random noise.
Converter: added blur on the same keys as sharpness
Added new model 'TrueFace'. This is a GAN model ported from https://github.com/NVlabs/FUNIT
Model produces near zero morphing and high detail face.
Model has higher failure rate than other models.
Keep src and dst faceset in same lighting conditions.
Session is now saved to the model folder.
blur and erode ranges are increased to -400+400
hist-match-bw is now replaced with seamless2 mode.
Added 'ebs' color transfer mode (works only on Windows).
FANSEG model (used in FAN-x mask modes) is retrained with new model configuration
and now produces better precision and less jitter
Pixel loss may help to enhance fine details and stabilize face color. Use it only if quality does not improve over time.
SAE:
previous SAE model will not work with this update.
Greatly decreased chance of model collapse.
Increased model accuracy.
Residual blocks now default and this option has been removed.
Improved 'learn mask'.
Added masked preview (switch by space key)
Converter:
fixed rct/lct in seamless mode
added mask mode (6) learned*FAN-prd*FAN-dst
added mask editor, its created for refining dataset for FANSeg model, and not for production, but you can spend your time and test it in regular fakes with face obstructions