Commit graph

65 commits

Author SHA1 Message Date
Colombo
c1612c5553 fixes 2019-12-23 14:57:47 +04:00
Colombo
e0e8970ab9 fix PackedFaceset 2019-12-22 15:58:46 +04:00
Colombo
dd45b7dacc cleaning 2019-12-22 15:02:53 +04:00
Colombo
50f892d57d all models: removed options 'src_scale_mod', and 'sort samples by yaw as target'
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.
2019-12-21 23:16:55 +04:00
Colombo
8866dce22e 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 !
2019-12-20 15:03:17 +04:00
Colombo
d4745b5cf8 added sort by absdiff
This is sort method by absolute per pixel difference between all faces.
options:
Sort by similar? ( y/n ?:help skip:y ) :
if you choose 'n', then most dissimilar faces will be placed first.
2019-12-11 22:33:49 +04:00
Colombo
fe58459f36 added FacesetRelighter:
Synthesize new faces from existing ones by relighting them using DeepPortraitRelighter network.
With the relighted faces neural network will better reproduce face shadows.

Therefore you can synthsize shadowed faces from fully lit faceset.
https://i.imgur.com/wxcmQoi.jpg

as a result, better fakes on dark faces:
https://i.imgur.com/5xXIbz5.jpg

in OpenCL build Relighter runs on CPU,

install pytorch directly via pip install, look at requirements
2019-11-11 11:42:52 +04:00
Colombo
d897893fd5 fix denoise-image-sequence for jpg files 2019-11-08 22:58:39 +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
e013cb0f6b moving some files 2019-10-14 09:34:44 +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
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
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
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
iperov
54fa75aa13 fix 2019-05-02 00:39:18 +04:00
iperov
2a8dd788dc SAE: added option 'Pretrain the model?',
Pretrain the model with large amount of various faces. This technique may help to train the fake with overly different face shapes and light conditions of src/dst data. Face will be look more like a morphed. To reduce the morph effect, some model files will be initialized but not be updated after pretrain: LIAE: inter_AB.h5 DF: both decoders.h5. The longer you pretrain the model the more morphed face will look. After that, save and run the training again.
2019-05-01 19:55:27 +04:00
iperov
e58197ca22 initial code to extract umdfaces.io dataset and train pose estimator 2019-04-23 08:14:09 +04:00
iperov
046649e6be
update == 04.20.2019 == (#242)
* superb improved fanseg

* _

* _

* added FANseg extractor for src and dst faces to use it in training

* -

* _

* _

* update to 'partial' func

* _

* trained FANSeg_256_full_face.h5,
new experimental models: AVATAR, RecycleGAN

* _

* _

* _

* fix for TCC mode cards(tesla), was conflict with plaidML initialization.

* _

* update manuals

* _
2019-04-20 08:23:08 +04:00
iperov
de8d75b4f7 fix mask editor,
upd manuals
2019-04-04 22:19:56 +04:00
iperov
5ac7e5d7f1 changed help message for pixel loss:
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
2019-04-04 10:22:53 +04:00
iperov
f63f78e1ab fix 2019-03-26 19:15:20 +04:00
iperov
808f74e9c8 fix 2019-03-26 19:14:30 +04:00
iperov
77d9f3c856 fix 2019-03-26 19:09:00 +04:00
iperov
fedeee4395 Colab: added ability to run programs after N secs in trainer 2019-03-26 19:06:19 +04:00
lbfs
dbc8faf899 Small typo in argument (#203) 2019-03-25 21:25:47 +04:00
iperov
37505d88e3 old SAE model will not work with this update.
Fixed bug when SAE can be collapsed during a time.

SAE: removed CA weights and encoder/decoder dims.

added new options:

Encoder dims per channel (21-85 ?:help skip:%d)
More encoder dims help to recognize more facial features, but require more VRAM. You can fine-tune model size to fit your GPU.

Decoder dims per channel (11-85 ?:help skip:%d)
More decoder dims help to get better details, but require more VRAM. You can fine-tune model size to fit your GPU.

Add residual blocks to decoder? (y/n, ?:help skip:n) :
These blocks help to get better details, but require more computing time.

Remove gray border? (y/n, ?:help skip:n) :
Removes gray border of predicted face, but requires more computing resources.
2019-03-24 15:35:02 +04:00
iperov
a3df04999c removing trailing spaces 2019-03-19 23:53:27 +04:00
iperov
1d56585f33 fix ability for auto re-extract dst faces, after this update DFL torrent extractor scripts will not work. 2019-03-18 01:12:04 +04:00
iperov
71ff0ce1a7 nothing interesting 2019-03-16 09:22:00 +04:00
iperov
5bd3f875fa fix 2019-03-14 10:50:53 +04:00
iperov
296e8a111a fix for Linux 2019-03-14 05:08:15 +04:00
Luke Barr
7d6ca32250 Raise python minimum version (#190) 2019-03-13 09:56:07 +04:00
iperov
fbf39d2727 added new extractor: S3FD,
all extractors now produce less false-positive faces
2019-03-10 23:18:10 +04:00
iperov
6094e5ead8 added Util.recover_original_aligned_filename 2019-03-04 10:57:44 +04:00
iperov
4196e962a8 added VideoEd - operating video files by ffmpeg from python. 2019-03-02 14:58:22 +04:00
iperov
438213e97c manual extractor: increased FPS,
sort by final : now you can specify target number of images,
converter: fix seamless mask and exception,
huge refactoring
2019-02-28 11:56:31 +04:00
iperov
5e474c3462 added sort by one face in images. it trashes all images in which more than 1 face is found 2019-02-22 11:32:27 +04:00
iperov
72ba6b103c added support of AMD videocards
added Intel's plaidML backend to use OpenCL engine. Check new requirements.
smart choosing of backend in device.py
env var 'force_plaidML' can be choosed to forced using plaidML
all tf functions transferred to pure keras
MTCNN transferred to pure keras, but it works slow on plaidML (forced to CPU in this case)
default batch size for all models and VRAMs now 4, feel free to adjust it on your own
SAE: default style options now ZERO, because there are no best values for all scenes, set them on your own.
SAE: return back option pixel_loss, feel free to enable it on your own.
SAE: added option multiscale_decoder default is true, but you can disable it to get 100% same as H,DF,LIAEF model behaviour.
fix converter output to .png
added linux fork reference to doc/doc_build_and_repository_info.md
2019-02-19 17:33:12 +04:00
iperov
6e12594af1 added util --add-landmarks-debug-images 2019-02-13 10:17:08 +04:00
iperov
06fe1314d8 removing default yaw_value from DFLIMG files,
added better pitch/yaw estimator from 68 landmarks,
improving face yaw accuracy for sorting and trainers,
added sort by face-pitch
2019-02-12 21:31:37 +04:00
iperov
6d95dd4a99 DFL now works with JPG files by default. Old PNG files also supported. Added util convertor PNG to JPG. 2019-02-04 19:47:24 +04:00
iperov
2571f23bc4 Extractor added new feature --manual-output-debug-fix,
Performs manual reextract input-dir frames which were deleted from [output_dir]_debug\ dir.
2019-01-22 12:46:54 +04:00
iperov
1f2b1481ef now you can train models on multiple GPU's on same workspace without cloning any folders.
Model files names will be prefixed with GPU index if GPU choosed explicitly on train/convert start.
if you leave GPU idx choice default, then best GPU idx will be choosed and model file names will not contain index prefix.
It gives you possibility to train same fake with various models or options on multiple GPUs.

H64 and H128: now you can choose 'Lighter autoencoder'. It is same as vram gb <= 4 before this update.

added archived_models.zip contains old experiments

RecycleGAN: archived

devicelib: if your system has no NVML installed (some old cards), then it will work with gpu_idx=0 as 'Generic GeForce GPU' with 2GB vram.

refactorings
2019-01-14 10:48:23 +04:00
iperov
48d0123f0b SAE: new options face_style_power, bg_style_power instead of style_power. Zero - means dont use style.
SAE: new option 'lighter_encoder'.
Now model settings can be overrided by pressing enter in 2 seconds while model loading (works on Windows).
Removed all MultiGPU models, because keras multi_gpu in fact doesn't work.
2019-01-10 18:28:12 +04:00
iperov
abdbe7fd8d added sort by 'final' 2019-01-07 14:20:44 +04:00
iperov
8456122cb2 upd 2019-01-03 22:15:10 +04:00
iperov
7b70e7eec1 added new model U-net Face Morpher.
removed AVATAR - useless model was just for demo
removed MIAEF128 - use UFM insted
removed LIAEF128YAW - use model option sort by yaw on start for any model
All models now ask some options on start.
Session options (such as target epoch, batch_size, write_preview_history etc) can be overrided by special command arg.
Converter now always ask options and no more support to define options via command line.
fix bug when ConverterMasked always used not predicted mask.
SampleGenerator now always generate samples with replicated border, exclude mask samples.
refactorings
2019-01-02 17:26:12 +04:00
iperov
cd9e2c239c
Update main.py 2019-01-01 19:50:04 +04:00
Plucky
a8694b73f0 DockerFile for Mac users to run DeepfaceLab with CPU Mode (#95)
* fix localization nullpointer exception

* fix devicelib error line:61,remove e

* support create docker from cpu dockerfile

* support preview or not when train(resolve cannot connect to X server)
2019-01-01 18:08:21 +04:00
iperov
f8824f9601 refactoring. Added RecycleGAN for testing. 2018-12-28 19:38:52 +04:00