Commit graph

89 commits

Author SHA1 Message Date
iperov
fdb143ff47 added AMD/Intel cards support via DirectX12 ( DirectML backend ) 2021-04-22 18:19:15 +04:00
iperov
8d46cd94fd upd pretrain option help 2021-03-23 16:07:50 +04:00
iperov
e47b602ec8 SAEHD: random flip replaced with random SRC flip(default False) and random DST flip(default True) 2021-03-23 15:13:10 +04:00
iperov
b333fcea4b dump_ckpt 2021-03-23 15:00:24 +04:00
iperov
11add4cd4f update GAN model 2021-01-03 19:25:39 +04:00
iperov
54fc3162ed new gan 2021-01-03 01:08:20 +04:00
iperov
ad5733c5bb upd PatchDiscriminator 2020-12-31 17:38:41 +04:00
iperov
ae9e16b4a5 SAEHD: new GAN 2020-12-30 14:33:14 +04:00
iperov
db83a21244 Eyes priority is replaced with Eyes and mouth priority,
Helps to fix eye problems during training like "alien eyes" and wrong eyes direction.
Also makes the detail of the teeth higher.

New default values with new model:
Archi : ‘liae-ud’
AdaBelief : enabled
2020-12-20 09:45:22 +04:00
iperov
dd037d2dea SAEHD: lr_dropout now can be used with AdaBelief 2020-12-18 12:42:10 +04:00
iperov
40d18896b7 SAEHD: change help 2020-12-16 18:25:25 +04:00
iperov
da058cf17f remove lrcos from adabelief 2020-12-11 20:34:14 +04:00
iperov
704b5dc072 SAEHD: added new option Use AdaBelief optimizer?
Experimental AdaBelief optimizer. It requires more VRAM, but the accuracy of the model is higher, and lr_dropout is not needed.
2020-12-11 15:48:27 +04:00
iperov
35945b257c fix dimensions error 2020-12-11 14:34:37 +04:00
iperov
b9c9e7cffd fix depth_to_space for tf2.4.0. Removing compute_output_shape in leras, because it uses CPU device, which does not support all ops. 2020-12-11 11:28:33 +04:00
Colombo
6134e57762 options_show_override{} for model summary in pretrain mode 2020-07-27 16:37:13 +04:00
Colombo
1435dd3dd1 SAEHD: now random_warp is disabled for pretraining mode by default 2020-07-26 16:11:08 +04:00
Colombo
ce95af9068 SAEHD: write_preview_history now works faster
The frequency at which the preview is saved now depends on the resolution.
For example 64x64 – every 10 iters. 448x448 – every 70 iters.
2020-07-18 11:03:13 +04:00
Colombo
58670722dc fix 2020-07-17 17:40:32 +04:00
Colombo
b9b97861e1 fix mask for style losses 2020-07-17 17:34:07 +04:00
Colombo
e8b04053e4 SAEHD:
Changed help for “Learning rate dropout” option:

When the face is trained enough, you can enable this option to get extra sharpness and reduce subpixel shake for less amount of iterations.

Enabled it before “disable random warp” and before GAN. n disabled. y enabled

cpu enabled on CPU. This allows not to use extra VRAM, sacrificing 20% time of iteration.

 Changed help for GAN option:

Train the network in Generative Adversarial manner.

Forces the neural network to learn small details of the face.

Enable it only when the face is trained enough and don't disable.

Typical value is 0.1

improved GAN. Now it produces better skin detail, less patterned aggressive artifacts, works faster.
https://i.imgur.com/Nbh3mw1.png
2020-07-16 22:19:17 +04:00
Colombo
44e6970dc5 changed help for gan_power 2020-06-30 12:37:12 +04:00
Colombo
4e998aff93 . 2020-06-24 10:06:31 +04:00
Colombo
f90723c9f9 SAEHD: ‘uniform_yaw’ now always enabled in pretrain mode. 2020-06-21 00:57:48 +04:00
Colombo
53222839c6 SAEHD: for -d archis resolution should be divided by 32 2020-06-19 14:21:41 +04:00
Colombo
0c2e1c3944 SAEHD:
Maximum resolution is increased to 640.

‘hd’ archi is removed. ‘hd’ was experimental archi created to remove subpixel shake, but ‘lr_dropout’ and ‘disable random warping’ do that better.

‘uhd’ is renamed to ‘-u’
dfuhd and liaeuhd will be automatically renamed to df-u and liae-u in existing models.

Added new experimental archi (key -d) which doubles the resolution using the same computation cost.
It is mean same configs will be x2 faster, or for example you can set 448 resolution and it will train as 224.
Strongly recommended not to train from scratch and use pretrained models.

New archi naming:
'df' keeps more identity-preserved face.
'liae' can fix overly different face shapes.
'-u' increased likeness of the face.
'-d' (experimental) doubling the resolution using the same computation cost
Examples: df, liae, df-d, df-ud, liae-ud, ...

Improved GAN training (GAN_power option).  It was used for dst model, but actually we don’t need it for dst.
Instead, a second src GAN model with x2 smaller patch size was added, so the overall quality for hi-res models should be higher.

Added option ‘Uniform yaw distribution of samples (y/n)’:
	Helps to fix blurry side faces due to small amount of them in the faceset.

Quick96:
	Now based on df-ud archi and 20% faster.

XSeg trainer:
	Improved sample generator.
Now it randomly adds the background from other samples.
Result is reduced chance of random mask noise on the area outside the face.
Now you can specify ‘batch_size’ in range 2-16.

Reduced size of samples with applied XSeg mask. Thus size of packed samples with applied xseg mask is also reduced.
2020-06-19 09:45:55 +04:00
Colombo
7f11713730 fix 2020-06-11 21:29:39 +04:00
Colombo
af98407f06 SAEHD: lr_dropout now can be ‘n’, ‘y’, ‘cpu’. ‘n’ and ’y’ are the same as before.
‘cpu’ mean enabled on CPU. This allows not to use extra VRAM, sacrificing 20% time of iteration.

SAEHD: resolution >= 256 now has second dssim loss function
2020-06-08 14:18:33 +04:00
Colombo
2b7364005d Added new face type : head
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.
2020-04-04 09:28:06 +04:00
Colombo
3702531898 SAEHD: ‘Face style power’ and ‘Background style power’ are now available for whole_face
New help messages for these options:

Face style power
Learn the color of the predicted face to be the same as dst inside mask.
If you want to use this option with 'whole_face' you have to use XSeg trained mask.
Warning: Enable it only after 10k iters, when predicted face is clear enough to start learn style.
Start from 0.001 value and check history changes.
Enabling this option increases the chance of model collapse

Background style power
      Learn the area outside mask of the predicted face to be the same as dst.
If you want to use this option with 'whole_face' you have to use XSeg trained mask.
This can make face more like dst.
Enabling this option increases the chance of model collapse. Typical value is 2.0
2020-03-30 19:46:17 +04:00
Colombo
6687213fa5 SAEHD: fixed the use of pretrained liae model, now it produces less face morphing 2020-03-27 00:15:18 +04:00
Colombo
eddebedcf6 SAEHD: added 'dfuhd' and 'liaeuhd' archi 2020-03-23 22:01:44 +04:00
Colombo
dde856499d saehd: removed liaech 2020-03-13 13:04:26 +04:00
Colombo
61472cdaf7 global refactoring and fixes,
removed support of extracted(aligned) PNG faces. Use old builds to convert from PNG to JPG.

fanseg model file in facelib/ is renamed
2020-03-13 08:09:00 +04:00
Colombo
ba58621361 SAEHD: removed option learn_mask, it is now enabled by default 2020-03-10 10:36:08 +04:00
Colombo
3b6ad4abf9 refactoring 2020-03-07 20:51:54 +04:00
Colombo
d6a685887f fix nick 2020-03-07 19:20:07 +04:00
Colombo
45270f3fb5 SAEHD:
added new experimental arhi
'liaech' - made by @chervoniy. Based on liae, but produces more src-like face.
2020-03-07 16:06:10 +04:00
Colombo
ada60ccefe code refactoring,
lr_dropout is now disabled in pretraining mode
changed help message for lr_dropout and random_warp
2020-03-07 13:59:47 +04:00
Colombo
302d23a612 refactoring 2020-03-03 22:20:15 +04:00
Colombo
757ec77e44 refactoring 2020-03-01 19:09:50 +04:00
Colombo
f88c45d338 fix saehd for multi gpu 2020-02-27 23:06:06 +04:00
Colombo
74999ce7ee SAEHD:
'models_opt_on_gpu' option is now available for multigpus (before only for 1 gpu)
max resolution is now 512
2020-02-27 16:21:32 +04:00
Colombo
c7ab9653c5 new optimized training:
for every batch_size*16 samples,
model collects the samples with the highest error and learns them again
therefore hard samples will be trained more often
2020-02-27 11:19:53 +04:00
Colombo
a1cc297cef SAEHD: fix hd arhis 2020-02-25 21:58:05 +04:00
Colombo
58deb2bed1 enable pretrain option for whole_face type 2020-02-23 20:49:30 +04:00
Colombo
f1d115b63b added experimental face type 'whole_face'
Basic usage instruction: https://i.imgur.com/w7LkId2.jpg

	'whole_face' requires skill in Adobe After Effects.

	For using whole_face you have to extract whole_face's by using
	4) data_src extract whole_face
	and
	5) data_dst extract whole_face
	Images will be extracted in 512 resolution, so they can be used for regular full_face's and half_face's.

	'whole_face' covers whole area of face include forehead in training square,
	but training mask is still 'full_face'
	therefore it requires manual final masking and composing in Adobe After Effects.

added option 'masked_training'
	This option is available only for 'whole_face' type.
	Default is ON.
	Masked training clips training area to full_face mask,
	thus network will train the faces properly.
	When the face is trained enough, disable this option to train all area of the frame.
	Merge with 'raw-rgb' mode, then use Adobe After Effects to manually mask, tune color, and compose whole face include forehead.
2020-02-21 16:21:04 +04:00
Colombo
778fb94246 saehd change face_style help 2020-02-20 20:56:02 +04:00
Colombo
c052ee7d60 SAEHD : change help message for eyes_prio : Helps to fix eye problems during training like "alien eyes" and wrong eyes direction ( especially on HD architectures ) by forcing the neural network to train eyes with higher priority. before/after 2020-02-20 08:29:37 +04:00
Colombo
7a9cd6379f bug fixes 2020-02-19 15:27:22 +04:00