Commit graph

372 commits

Author SHA1 Message Date
Colombo
71ebf06c89 SAEHD,Quick96:
improved model generalization, overall accuracy and sharpness
by using new 'Learning rate dropout' technique from paper https://arxiv.org/abs/1912.00144
An example of a loss histogram where this function is enabled after the red arrow:
https://i.imgur.com/3olskOd.jpg
2019-12-15 15:53:06 +04:00
Colombo
e8673e3fcc nothing interesting 2019-12-11 22:33:23 +04:00
Colombo
1cc24f2a75 1 2019-11-13 10:31:04 +04:00
Colombo
c0f258c336 SAE,SAEHD,Converter:
added sot-m color transfer

Converter:
removed seamless2 mode
2019-11-12 09:07:50 +04:00
Colombo
7d389718fe added Quick96 model
This is the fastest model for low-end cards.
Model has zero options and trains a 96pix fullface.
It is good for quick deepfake demo.
Example of the preview trained in 15 minutes on RTX2080Ti:
https://i.imgur.com/oRMvZFP.jpg
2019-11-09 19:24:31 +04:00
Colombo
1f350ae413 1 2019-11-09 19:23:55 +04:00
Colombo
770c70d778 converter:
fixed crashes

removed useless 'ebs' color transfer

changed keys for color degrade

added image degrade via denoise - same as denoise extracted data_dst.bat ,
but you can control this option directly in the interactive converter

added image degrade via bicubic downscale and upscale

SAEHD: default ae_dims for df now 256.
2019-11-09 15:12:35 +04:00
Colombo
f17a54b23a nothing interesting 2019-10-25 11:19:23 +04:00
Colombo
734d97d729 added 'sort by vggface': sorting by face similarity using VGGFace model.
Requires 4GB+ VRAM and internet connection for the first run.
2019-10-23 15:06:39 +04:00
Colombo
e63e89c305 fix s3fd extractor bug for 11GB+ cards 2019-10-17 22:25:23 +04:00
Colombo
e3f63a7b40 fix 2019-10-15 17:37:16 +04:00
Colombo
73511a072a SAE/SAEHD:
removed option 'apply random ct'

added option
   Color transfer mode apply to src faceset. ( none/rct/lct/mkl/idt, ?:help skip: none )
   Change color distribution of src samples close to dst samples. Try all modes to find the best.
before was lct mode, but sometime it does not work properly for some facesets.
2019-10-15 11:22:19 +04:00
Colombo
24eac44dd9 fix random_flip option bug 2019-10-14 14:08:36 +04:00
Colombo
e013cb0f6b moving some files 2019-10-14 09:34:44 +04:00
Colombo
aa523b3f2e change name 2019-10-12 16:13:23 +04:00
Colombo
91d2391ac9 fix 2019-10-12 14:09:48 +04:00
Colombo
8595c757ad change options order 2019-10-12 10:39:48 +04:00
Colombo
92f14dee70 SAEHD: added option Enable random warp of samples, default is on
Random warp is required to generalize facial expressions of both faces. When the face is trained enough, you can disable it to get extra sharpness for less amount of iterations.
2019-10-12 10:31:50 +04:00
Colombo
e15f846d08 SAE, SAEHD: random flip and learn mask options now can be overridden 2019-10-10 22:56:57 +04:00
Colombo
1f27d13f61 clip border for midface 2019-10-10 14:48:51 +04:00
Colombo
3f23135982 SAEHD: speed up for nvidia, duplicate code clean up 2019-10-08 21:02:20 +04:00
Colombo
627df082d7 fix for plaidml 2019-10-08 16:55:21 +04:00
Colombo
ac7725163d removed SAEv2,
added SAEHD model ( High Definition Styled AutoEncoder )
This is a new heavyweight model for high-end cards to achieve maximum possible deepfake quality in 2020.
Differences from SAE:
+ new encoder produces more stable face and less scale jitter
  before: https://i.imgur.com/4jUcol8.gifv
  after:  https://i.imgur.com/lyiax49.gifv - scale of the face is less changed within frame size
+ new decoder produces subpixel clear result
+ pixel loss and dssim loss are merged together to achieve both training speed and pixel trueness
+ by default networks will be initialized with CA weights, but only after first successful iteration
  therefore you can test network size and batch size before weights initialization process
+ new neural network optimizer consumes less VRAM than before
+ added option <Enable 'true face' training>
  The result face will be more like src and will get extra sharpness.
  example: https://i.imgur.com/ME3A7dI.gifv
  Enable it for last 15-30k iterations before conversion.
+ encoder and decoder dims are merged to one parameter encoder/decoder dims
+ added mid-full face, which covers 30% more area than half face.
2019-10-08 15:09:28 +04:00
Colombo
4c2cb44643 upd liae loss 2019-10-06 10:06:22 +04:00
Colombo
e4a360e5ff upd loss 2019-10-06 01:00:34 +04:00
Colombo
d781af3d1f fixed GPU detection and indexes, got rid of using nvml, now using direct cuda lib to determine gpu info that match tensorflow indexes,
removed TrueFace model.

added SAEv2 model. Differences from SAE:
+ default e_ch_dims is now 21
+ new encoder produces more stable face and less scale jitter
  before: https://i.imgur.com/4jUcol8.gifv
  after:  https://i.imgur.com/lyiax49.gifv - scale of the face is less changed within frame size
+ decoder now has only 1 residual block instead of 2, result is same quality with less decoder size
+ added mid-full face, which covers 30% more area than half face.
+ added option " Enable 'true face' training "
  Enable it only after 50k iters, when the face is sharp enough.
  the result face will be more like src.
  The most src-like face with 'true-face-training' you can achieve with DF architecture.
2019-10-05 16:26:23 +04:00
Colombo
09a990852f funits models: cleaning code 2019-09-27 18:48:01 +04:00
Colombo
deeb98474b fix funit 2019-09-23 18:54:37 +04:00
Colombo
62682351ac fix avatar model 2019-09-21 14:48:40 +04:00
Colombo
2a3b3f0021 added tf_cpu_mode option for funit models 2019-09-21 09:44:34 +04:00
Colombo
a325d0353b fix 2019-09-19 11:20:30 +04:00
Colombo
dc11ec32be SAE : WARNING, RETRAIN IS REQUIRED !
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.
2019-09-19 11:13:56 +04:00
Colombo
201b762541 SAE: fix 2019-09-14 16:39:47 +04:00
Colombo
b6b92bded0 converter: now writes a filename of current frame config,
SAE: removed multiscale decoder, because it's not effective
2019-09-13 08:59:00 +04:00
Colombo
7ed38a8097 Converter:
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
2019-09-07 13:57:42 +04:00
iperov
6c66495bcf default avatar type option is now HEAD. Head produces stable result. 2019-08-25 08:16:54 +04:00
iperov
00dce38187 fix 2019-08-25 07:43:22 +04:00
iperov
e3505d9b8c fix AVATARModel 2019-08-24 20:33:29 +04:00
iperov
5968ac21f6 fix AVATARModel 2019-08-24 19:55:38 +04:00
iperov
407ce3b1ca Added interactive converter.
With interactive converter you can change any parameter of any frame and see the result in real time.

Converter: added motion_blur_power param.
Motion blur is applied by precomputed motion vectors.
So the moving face will look more realistic.

RecycleGAN model is removed.

Added experimental AVATAR model. Minimum required VRAM is 6GB (NVIDIA), 12GB (AMD)
Usage:
1) place data_src.mp4 10-20min square resolution video of news reporter sitting at the table with static background,
   other faces should not appear in frames.
2) process "extract images from video data_src.bat" with FULL fps
3) place data_dst.mp4 video of face who will control the src face
4) process "extract images from video data_dst FULL FPS.bat"
5) process "data_src mark faces S3FD best GPU.bat"
6) process "data_dst extract unaligned faces S3FD best GPU.bat"
7) train AVATAR.bat stage 1, tune batch size to maximum for your card (32 for 6GB), train to 50k+ iters.
8) train AVATAR.bat stage 2, tune batch size to maximum for your card (4 for 6GB), train to decent sharpness.
9) convert AVATAR.bat
10) converted to mp4.bat

updated versions of modules
2019-08-24 12:57:29 +04:00
Auroir
c4e68ef539 Formatted Model Summary (#348)
* Formatted Model Summary

Aligns the model summary output using f-string formatting. The logic structure of the base class has not been changed, only the lines put into `model_summary_text`. Output width is calculated from keys & values and will scale to show a clean summary for any model/platform.

GPU VRAM has been added as an output. Incorrect detection of VRAM is possible in broken environments and GPUs of different sizes can report the same name. Showing it here adds clarity for the user and for issue tickets.

Concatenation changed from "\r\n" to "\n", CRLF end of lines for Windows are handled transparently so using it here caused extra blank lines in the summary txt file.

**Examples:**
Using CUDA + SAE-LIAE
```
============= Model Summary ==============
==                                      ==
==         Model name: SAE              ==
==                                      ==
==  Current iteration: 16               ==
==                                      ==
==----------- Model Options ------------==
==                                      ==
==         batch_size: 4                ==
==        sort_by_yaw: False            ==
==        random_flip: True             ==
==         resolution: 128              ==
==          face_type: f                ==
==         learn_mask: True             ==
==     optimizer_mode: 1                ==
==              archi: liae             ==
==            ae_dims: 256              ==
==          e_ch_dims: 42               ==
==          d_ch_dims: 21               ==
== multiscale_decoder: False            ==
==         ca_weights: False            ==
==         pixel_loss: False            ==
==   face_style_power: 0.0              ==
==     bg_style_power: 0.0              ==
==    apply_random_ct: False            ==
==           clipgrad: False            ==
==                                      ==
==------------- Running On -------------==
==                                      ==
==       Device index: 0                ==
==               Name: GeForce GTX 1080 ==
==               VRAM: 8.00GB           ==
==                                      ==
==========================================
```
Colab
```
========== Model Summary ==========
==                               ==
==         Model name: SAE       ==
==                               ==
==  Current iteration: 39822     ==
==                               ==
==-------- Model Options --------==
==                               ==
==         batch_size: 24        ==
==        sort_by_yaw: True      ==
==        random_flip: False     ==
==         resolution: 128       ==
==          face_type: f         ==
==         learn_mask: True      ==
==     optimizer_mode: 2         ==
==              archi: liae      ==
==            ae_dims: 222       ==
==          e_ch_dims: 34        ==
==          d_ch_dims: 16        ==
== multiscale_decoder: True      ==
==         ca_weights: True      ==
==         pixel_loss: False     ==
==   face_style_power: 2.0       ==
==     bg_style_power: 1.5       ==
==    apply_random_ct: False     ==
==           clipgrad: True      ==
==                               ==
==--------- Running On ----------==
==                               ==
==       Device index: 0         ==
==               Name: Tesla K80 ==
==               VRAM: 11.00GB   ==
==                               ==
===================================
```
Using OpenCL + H128
```
=========================== Model Summary ===========================
==                                                                 ==
==        Model name: H128                                         ==
==                                                                 ==
== Current iteration: 0                                            ==
==                                                                 ==
==------------------------- Model Options -------------------------==
==                                                                 ==
==        batch_size: 4                                            ==
==       sort_by_yaw: False                                        ==
==       random_flip: True                                         ==
==        lighter_ae: False                                        ==
==        pixel_loss: False                                        ==
==                                                                 ==
==-------------------------- Running On ---------------------------==
==                                                                 ==
==      Device index: 0                                            ==
==              Name: Advanced Micro Devices, Inc. gfx900 (OpenCL) ==
==              VRAM: 7.98GB                                       ==
==                                                                 ==
=====================================================================
```
Using CPU (output trimmed)
```
==------- Running On --------==
==                           ==
==       Using device: CPU   ==
==                           ==
===============================
```
multi_gpu support is retained (output trimmed)
```
==------------- Running On -------------==
==                                      ==
==    Using multi_gpu: True             ==
==                                      ==
==       Device index: 1                ==
==               Name: Geforce GTX 1080 ==
==               VRAM: 8.00GB           ==
==       Device index: 2                ==
==               Name: Geforce GTX 1080 ==
==               VRAM: 8.00GB           ==
==                                      ==
==========================================
```

Low VRAM warning (output trimmed)
```
==------------- Running On -------------==
==                                      ==
==       Device index: 0                ==
==               Name: Geforce GTX 1050 ==
==               VRAM: 2.00GB           ==
==                                      ==
==========================================
/!\
/!\ WARNING:
/!\ You are using a GPU with 2GB or less VRAM. This may significantly reduce the quality of your result!
/!\ If training does not start, close all programs and try again.
/!\ Also you can disable Windows Aero Desktop to increase available VRAM.
/!\
```

* Fix indent
2019-08-16 18:35:27 +04:00
iperov
e8c5f168bd Merge branch 'master' of https://github.com/iperov/DeepFaceLab 2019-08-11 11:17:38 +04:00
iperov
b72d5a3f9a fixed error "Failed to get convolution algorithm" on some systems
fixed error "dll load failed" on some systems
Expanded eyebrows line of face masks. It does not affect mask of FAN-x converter mode.
2019-08-11 11:17:22 +04:00
Josh Johnson
e2bc65d5f0 Fix issue with RTX GPU and TensorFlow (#322)
An issue affecting at least 2070 and 2080 cards (possibly other RTX cards too) requires auto growth to be enabled for TensorFlow to work.

I don't know enough about the impact of this change to know whether this ought to be made optional or not, but for RTX owners, this simple change fixes TensorFlow errors when generating models.
2019-08-02 16:40:41 +04:00
fakerdaker
582c974851 Colab choose random preview (#316) 2019-07-25 11:29:31 +04:00
iperov
8484060e01 Trainer: added option for all models
Enable autobackup? (y/n ?:help skip:%s) :
Autobackup model files with preview every hour for last 15 hours. Latest backup located in model/<>_autobackups/01

SAE: added option only for CUDA builds:
Enable gradient clipping? (y/n, ?:help skip:%s) :
Gradient clipping reduces chance of model collapse, sacrificing speed of training.
2019-06-20 10:42:55 +04:00
Jakob6174
ea1d59f620 Update ModelBase.py (#283)
Typo: 'NotImplementeError' --> 'NotImplementedError'
2019-06-19 13:02:19 +04:00
iperov
66a12a973a fix choosing preview image on options override 2019-05-14 17:00:25 +04:00
iperov
d6e8dde481 'sort by yaw' option now can be overriden each run 2019-05-14 09:33:53 +04:00
iperov
39809ff7dc upd 2019-05-11 16:15:16 +04:00