Commit Graph

534 Commits

Author SHA1 Message Date
torzdf
c7d85f89e6 Bugfix: Phaze-A Correct documentation for original encoder input size 2021-09-01 11:16:15 +01:00
torzdf
f1819ad592 bugfix: Phaze-A - Fix -1 to 1 scaling 2021-09-01 09:41:21 +01:00
torzdf
6f1e6743df Bugfixes:
- Gui - Stats - Return empty dict on state file look up error
  - Gui - Last Session - Don't load saved project information when loading project from last session
  - Train - Set default coverage to 87.5%
2021-08-28 10:40:01 +00:00
torzdf
1b78098799 Phaze-A - Force AdaInstanceNorm to float32
- Reduce NaN for Mixed Precision training
2021-08-04 12:55:21 +01:00
torzdf
bfc8517c5e Bugfix - Correctly parse 'load_layers' configuration parameter 2021-07-27 21:49:24 +01:00
torzdf
ac22d40a91 extract: mask - Delete any mask from outside of frame boundaries 2021-07-22 13:04:29 +01:00
torzdf
55bb7236fa New Model: Phaze-A 2021-06-15 21:59:31 +01:00
torzdf
1763c44383 Bugfix - Extract
- Set fallback scaling amount for parallel plugins
2021-06-10 10:20:17 +01:00
torzdf
30346e4cdb Merge branch 'staging' into bisenet 2021-05-31 10:37:22 +01:00
torzdf
18e3139275 Updates
- Change shortcut key to M
  - Slight optimizations
  - GUI support for mask toggling
2021-05-28 19:41:11 +01:00
AnDenixa
486375ec99 - added push t to disable mask display at preview window
trsprmvd

- added extra checks for mask presence in the set
2021-05-28 18:00:08 +01:00
torzdf
4c1631b58e lib.model - Add AdaBelief Optimizer 2021-05-25 13:11:35 +01:00
torzdf
723b02ef96 Merge branch 'master' into bisenet 2021-05-20 11:37:11 +01:00
torzdf
c0a1b7f536 bugfix: Switch - for _ in bisenet mask 2021-05-19 22:34:22 +01:00
torzdf
440cf6c8cd Merge branch 'master' into bisenet 2021-05-19 11:24:25 +01:00
torzdf
903da47940 bugfix: unet-dfl mask - Store + extract with legacy centering 2021-05-19 11:11:53 +01:00
torzdf
2b39b63e0a Update docstrings 2021-05-18 18:55:16 +01:00
torzdf
f63c498a04 Merge branch 'mask_update' into bisenet 2021-05-17 18:21:51 +01:00
torzdf
6c439944cd Masks updates
- Add head centering support to training
  - Update helptext/tooltips
2021-05-17 18:20:08 +01:00
torzdf
63ab6f9bc5 split head and face mask naming 2021-05-17 17:18:08 +01:00
torzdf
0c8fef8e83 Merge branch 'staging' into bisenet 2021-05-17 13:52:15 +01:00
torzdf
58cedef281 bugfix: lib.convert - Correctly pass mask centering to mask plugin 2021-05-17 12:06:18 +01:00
torzdf
40798fd27f core mask updates:
- Add support for different mask centering
  - Update legacy alignments to store mask centering
  - Bugfix: lib.image ImageIO. Ensure unique queues are created (fixes mask tool when Face is input and an output folder is provided)
2021-05-16 13:24:00 +01:00
torzdf
c34709d97e typo fix 2021-05-16 00:25:24 +01:00
torzdf
a95554aa16 Merge branch 'mask_update' into bisenet 2021-05-16 00:21:37 +01:00
torzdf
1b3530f104 Add support for different mask centering types 2021-05-16 00:21:19 +01:00
torzdf
108fbc497b Implement VRAM sizes 2021-05-15 13:22:09 +01:00
torzdf
84ab423cb7 Implemented working as masker 2021-05-15 11:42:32 +01:00
torzdf
bd8b6b674d Working implementation 2021-05-13 13:05:20 +01:00
torzdf
82f365acc7 initial commit 2021-05-12 01:36:10 +01:00
torzdf
3092d1421c GUI Bugfix - Handle underscores in config options correctly 2021-05-01 11:09:14 +01:00
torzdf
91a6a50255 Training Bugfix - Unfreeze weights when loading a previously frozen model 2021-04-24 12:49:38 +01:00
torzdf
29cfdaad46 Training startup updates
- Remove alignments path option from cli
  - Restructure training_data.py
  - Load alignment data from PNG header during first epoch
  - lib.image.read_image_batch - Add option to return metadata
  - lib.utils.get_image_paths - Add option for explicit extension
  - plugins.train.trainer._base - remove pre-cache alignments code
  - scripts.train - Check first image in training folders for metadata
  - Documentation
2021-03-21 23:29:31 +00:00
torzdf
46cb53e6f0 Training updates:
- Expose optimizer epsilon param
  - Add NaN protection
GUI - slider - add support for discreet values
2021-03-19 18:22:35 +00:00
torzdf
a656552204 Minor Updates
- GUI - Tweaks
    - Fix Analysis Slider background color
    - More granular theming controls
    - Standardize comboboxes and scrollbars
  - plugins.train.model._base
      - Catch more model corruption errors
2021-03-18 17:43:56 +00:00
torzdf
11009bf237 GUI Bugfix - Stop settings colors leaking into analysis. 2021-03-16 23:20:19 +00:00
torzdf
cff0f5698b GUI updates
- Control panel fixes
  - Basic themeing support
  - Fix tools to display more natively
  - Give all config items a group
2021-03-16 19:46:14 +00:00
torzdf
caa6e541c6 Training - Load Weights
- Enable the loading of previously trained encoders for new models.
2021-03-12 14:48:59 +00:00
torzdf
a79b8c6905 Fixups
- Documentation - Update sphinx_requirements.txt
  - plugins.train.model - Add recursive keras model scanning
  - Change "freeze" option to "freeze-weights"
2021-03-12 09:48:00 +00:00
torzdf
52c10dcc35 scripts.train - Add freeze weights option
lib.config:
  - Better formatting for .ini files
  - Support multi-select options
gui - Add support for multi-select config items
2021-03-11 16:42:36 +00:00
torzdf
1d07dbaa5d train - Add option to output model summary and exit 2021-03-11 01:35:00 +00:00
torzdf
e111355183 trainer - Add RGB model support 2021-03-04 17:44:22 +00:00
torzdf
8f499a44dd Fixups:
- lib.gui.display - Catch error when trying to delete non-existant notebook tabs
  - lib.model.nn_blocks.ResidualBlock: Remove first LeakyReLU (explicit > implicit)
  - lib.model.nn_blocks._get_default_initializer - Always use ConvAware if selected
  - plugins.model.model - Add explicit leakyReLUs for ResBlocks
2021-03-03 14:32:03 +00:00
torzdf
1d01af75a2 Bugfixes:
- plugins.train.trainer._base - Don't output error message for sides which have valid masks
  - lib.gui.menu - Fix project file saving extension on Linux
2021-02-28 12:32:55 +00:00
torzdf
790a094d34 Code updates:
- lib.image.update_existing_meta: optimize
  - plugins.tran.model._base - Capture corrupt model errors
2021-02-26 10:29:11 +00:00
torzdf
7f6ee925f9 bugfix: plugins.train.trainer._base - Don't validate masks if None selected 2021-02-21 17:02:35 +00:00
torzdf
51f9eef0f8 typofix 2021-02-19 11:42:52 +00:00
torzdf
d5c30e7ea9 bugfix - plugin.model.trainer._base - Fix mixed extract face type check 2021-02-19 11:36:03 +00:00
torzdf
48ca4d1b0e bugfix - FIx rare bug that fails to load configuration files on some windows installs 2021-02-17 18:36:30 +00:00
torzdf
d4c4c8c2e9 bugfix - plugins.trainer._base - Update image list to point to renamed pngs 2021-02-15 17:24:27 +00:00
torzdf
fcf6d8238c Bugfixes:
- lib.image Don't raise error if legacy non-png is found when reading header data
  - plugins.train.trainer._base - Correctly pass legacy alignments through to DetectedFace
2021-02-15 00:24:59 +00:00
torzdf
b1cfbe458c
Update extracted faces to use PNG EXIF data (#1123)
Documentation
  - Update Usage.md, align.rst and image.rst
lib.image.py
  - read_image - Remove hash return, add metadata return
  - Remove read_image_hash functions
  - Add read_image_meta functios
  - Replace encode_image_with_hash with encode_image (to store metadata)
  - Add png meta reading and writing functions
  - Update Image Loaders/Savers to handle metadata rather than hashes
lib.training_data
  - Naming updates to remove references to hashes
lib.align.Alignments
  - Add versioning notes
  - Increment alignments version to 2.1
  - Deprecate hashing lookup functions
  - Replace filter_hashes with filter_faces
lib.align.detected_face
  - DetectedFace
    - Remove hash property
    - Add png header data serializing/deserializing functions
  - Mask
    - Add png header data serializing/deserializing functions
  - add update_legacy_png_header function to update png meta data
lib.cli.args - Deprecate alignments files for training
- plugins.train.trainer
  - Update alignments/mask code to read png header data
- scripts.convert
  - Aligned images folder - read data from png headers
- scripts.extract
  - Write png header information and no longer store hash of face
- tools.alignments
  - remove leftover-faces, merge and update-hashes jobs
  - Update jobs to use png meta data rather than hashes
- tools.manual
  - Update extract code to output png meta data and don't store hashes
  - Perform check on launch that tool is not pointing at a faces folder
tools.mask
  - Update to use png meta data
tools.sort
  - Update to use png meta data
2021-02-14 16:49:55 +00:00
torzdf
a84462f4fa Training - Move disable warp option out of config 2021-02-11 10:24:03 +00:00
torzdf
6de2b3193e bugfix: plugins.train - AMD Inference model compilation 2021-02-07 12:30:22 +00:00
torzdf
1d8c3c4c1b Merge branch 'master' into staging 2021-01-31 18:54:45 +00:00
torzdf
0941d6d27b realface model - Bugfix resblock 2021-01-31 18:54:18 +00:00
torzdf
bcf38b02cc plugins.train.model.base - More robust inference model generation 2021-01-31 16:08:48 +00:00
torzdf
a62fddf786 lib.model - Maintenance
- Add Depthwise option to Conv Block
  - Add Swish Activation function
  - remove res_block_follows and add_instance_norm_args
  - Add explicit normalization and activation args
  - Add K.resize_images layer
plugins.train.model - Inference creation bugfix
2021-01-29 11:47:07 +00:00
torzdf
29667b4696 Expand support for tf2.2-2.4 2021-01-04 15:15:48 +00:00
torzdf
3438198ac2 Merge branch 'master' into dev-tf2.4 2021-01-04 15:13:33 +00:00
torzdf
5a79a6f5e9 Bugfix - Warp to landmarks 2020-12-21 18:39:50 +00:00
torzdf
3b7535c732
Update to TF2.3 (#1100)
* Minimum requirements to tf2.3.
  - Handle upgrades for Windows users with tf2.2 installed by Pip
  - Handle windows upgrade from pip tf2.2
  - Explicitly install Cuda for Conda installs

* Update tensorflow errors api reference
* Suppress AutoGraph warning messages
* Update GUI Stats to work with tf2.3
* Fix live graph for tf2.3
* DSSIMObjective - autoGraph bugfix
* Update Travis test
2020-12-18 19:58:30 +00:00
torzdf
ce786ec273 plugins.train.config - Update coverage helptext 2020-12-15 22:44:01 +00:00
torzdf
d392dfbdf7 Bugfixes
- Manual Tool:
    - Hide annotations for faces not meeting criteria
    - Update landmarks on face add/del
    - Clearer landmark annotations
    - Handle non-numerics in frame number box
  - Training
    - Fix mis-aligned preview images
    - Allows mixing legacy + new alignments for A and B
    - Catch non-training images in training folder
    - Catch inconsistently sized training images
    - Standardize coverage ratio calculation
    - lib.image - Add option to get image shape along with hash
Dfaker model:
  - Add 256px mode
2020-12-15 12:11:26 +00:00
Dominik Miszkiewicz
6279f85787
Update tensorflow to 2.4.0rc4 (#1086)
* Update tensorflow to 2.4.0rc1

* Update requirements_nvidia.txt

* Update requirements_nvidia.txt
2020-12-08 12:49:49 +00:00
torzdf
05018f6119
Extract - Increase area and move centering (#1095)
* Extract
  - Implement aligner re-feeding
  - Add extract type to pipeline.ExtractMedia
  - Add pose annotation to debug
* Convert
  - implement centering
  - remove usage of feed and reference face properties
  - Remove distributed option from convert
  - Force update of alignments file on legacy receive
* Train
  - Resize preview image to model output size
  - Force legacy centering if centering does not exist in model's state file
  - Enable training on legacy face sets

* Alignments Tool
  - Update draw to include head/pose
  - Remove DFL drop + linting
  - Remove remove-frames job
  - remove align-eyes option
  - Update legacy masks to new extract type
  - Exit if attempting to merge version 1.0 alignments files with version 2.0 alignments files
  - Re-generate thumbnails on legacy upgrade
* Mask Tool
  - Update for new extract + bugfix full frame
* Manual Tool
  - Update to new extraction method
   - Disable legacy alignments,
   - extract box bugfix
   - extract faces - size to 512 and center on head
* Preview Tool
  - Display based on model centering
* Sort Tool
  - Use alignments for sort by face

* lib.aligner
  - Add Pose Class
  - Add AlignedFace Class
  - center _MEAN_FACE on x
  - Add meta information with versioning to alignments file
  - lib.aligner.get_align_matrix to use landmarks not face
  - Refactor aligned faces in lib.faces_detect
* lib.logger
  - larger file log padding
* lib.config
  - Fix global changeable_items
* lib.face_filter
  - Use new extracted face images
* lib.image
  - bump thumbnail default size to 96px
2020-12-08 01:31:56 +00:00
torzdf
b7ecad058d GUI: Consolidate settings to single menu 2020-10-24 00:06:52 +01:00
torzdf
15632cabbb Typo Fix 2020-10-23 10:50:09 +01:00
torzdf
3dbbac5a98 Convert - Move scaling option exclusively to config 2020-10-20 14:36:43 +01:00
torzdf
5bf56be57d Catch OOM Errors on Extract 2020-10-19 14:17:48 +01:00
torzdf
b46c02d104 extract: S3FD - Convert to re-enable CPU 2020-10-18 23:35:50 +01:00
torzdf
c049fed42e Bugfix - IAE Model for AMD users 2020-10-10 11:43:16 +01:00
torzdf
fe664e2748 Bugfix - Fix Timelapse when alignments files are used 2020-10-09 23:15:40 +01:00
torzdf
68bf1e7431 Typofix 2020-09-24 16:49:46 +01:00
torzdf
961f8ff283 - Bugfix: Training - Disable loss multipliers if penalized loss not selected
- Training: Half mouth/eye multiplier defaults
- GUI: Remove analysis callback from convert tab
2020-09-24 11:31:54 +01:00
torzdf
1daa7dc6f6
GUI - Stats optimization (#1067)
* Faster stat loading + caching

* Compress data in cache

* Optimize some calculations

* Vectorize smoothing

* stats.Calculations optimized

* Load latest training data from live iterator

* Add options to training graph
2020-09-24 01:23:25 +01:00
torzdf
5530346aa0 Bugfix - Pre-caching masks when warp-to-landmarks is disabled 2020-09-07 00:09:41 +01:00
torzdf
49f86e13de training - Add config item to disable warp 2020-09-07 00:03:00 +01:00
torzdf
cd3fc8179a Training - Cache eye and mouth masks during first epoch rather than at startup 2020-09-06 15:31:21 +01:00
torzdf
10da0c40eb Loss multipliers:
- Lower defaults.
  - Set to updateable
2020-09-05 14:13:33 +01:00
torzdf
e6d62b8315 Bugfixes:
- dfl_h128 Legacy Weights update
  - lib.faces_detect - Logging fix
2020-08-30 23:43:08 +01:00
torzdf
3433928133
Add Mouth and Eye Priority to Loss options (#1054)
* Priority Training for Mouth and Eyes - Tensorflow

* Use chosen loss function for area multipliers

* loss multipliers for AMD

* Fix mask multipliers for plaid and roll PenalizedMaskLoss into LossWrapper

* losses_tf: roll PenalizedMaskLoss into LossWrapper
2020-08-27 16:49:57 +01:00
torzdf
1f9e834719 typofix 2020-08-23 23:57:45 +01:00
torzdf
0e31b98d36 Training - Add L2 Regularization to Structural Losses 2020-08-23 23:08:19 +01:00
torzdf
83bd60ddbc training - Use explicit loss dictionaries to map to outputs 2020-08-23 12:00:45 +01:00
torzdf
8c8e1b2c14 Training Config - Split Loss to it's own section 2020-08-23 00:33:25 +01:00
torzdf
d9809d2997 Bugfix - Convert - Swap Model option 2020-08-22 16:07:02 +01:00
torzdf
619bd415aa Catch further AMD OOM errors 2020-08-20 16:52:51 +01:00
torzdf
445aa4944c Bugfix - Legacy Models. Set penalized_loss and learn_mask to "False" if mask_type is None 2020-08-20 13:21:40 +01:00
torzdf
0a25dff896 model.config - Make convert batchsize a user configurable option 2020-08-19 23:51:28 +01:00
torzdf
45d699555e bugfix - Extract - VGG Clear Mask - Fix for TF2 2020-08-19 10:39:49 +01:00
torzdf
9c5568f887 Bugfix - Models.dfl_h128 2020-08-18 22:26:29 +01:00
torzdf
d27b0798d3 Training - Catch AMD OOM Errors 2020-08-18 15:44:15 +01:00
torzdf
7f061f7999 bugfix: Training - Fix clipnorm check for mixed precision 2020-08-18 15:08:42 +01:00
torzdf
030dadfef3 Extract - Fix VGG Obstructed Masker for TF2 2020-08-17 23:52:12 +01:00
torzdf
725d864975 Training - Move Mixed Precision to model config 2020-08-17 09:24:37 +01:00
torzdf
fa4783fa11 training config - Add selectable optimizers 2020-08-16 23:33:09 +01:00
torzdf
d8557c1970
Faceswap 2.0 (#1045)
* Core Updates
    - Remove lib.utils.keras_backend_quiet and replace with get_backend() where relevant
    - Document lib.gpu_stats and lib.sys_info
    - Remove call to GPUStats.is_plaidml from convert and replace with get_backend()
    - lib.gui.menu - typofix

* Update Dependencies
Bump Tensorflow Version Check

* Port extraction to tf2

* Add custom import finder for loading Keras or tf.keras depending on backend

* Add `tensorflow` to KerasFinder search path

* Basic TF2 training running

* model.initializers - docstring fix

* Fix and pass tests for tf2

* Replace Keras backend tests with faceswap backend tests

* Initial optimizers update

* Monkey patch tf.keras optimizer

* Remove custom Adam Optimizers and Memory Saving Gradients

* Remove multi-gpu option. Add Distribution to cli

* plugins.train.model._base: Add Mirror, Central and Default distribution strategies

* Update tensorboard kwargs for tf2

* Penalized Loss - Fix for TF2 and AMD

* Fix syntax for tf2.1

* requirements typo fix

* Explicit None for clipnorm if using a distribution strategy

* Fix penalized loss for distribution strategies

* Update Dlight

* typo fix

* Pin to TF2.2

* setup.py - Install tensorflow from pip if not available in Conda

* Add reduction options and set default for mirrored distribution strategy

* Explicitly use default strategy rather than nullcontext

* lib.model.backup_restore documentation

* Remove mirrored strategy reduction method and default based on OS

* Initial restructure - training

* Remove PingPong
Start model.base refactor

* Model saving and resuming enabled

* More tidying up of model.base

* Enable backup and snapshotting

* Re-enable state file
Remove loss names from state file
Fix print loss function
Set snapshot iterations correctly

* Revert original model to Keras Model structure rather than custom layer
Output full model and sub model summary
Change NNBlocks to callables rather than custom keras layers

* Apply custom Conv2D layer

* Finalize NNBlock restructure
Update Dfaker blocks

* Fix reloading model under a different distribution strategy

* Pass command line arguments through to trainer

* Remove training_opts from model and reference params directly

* Tidy up model __init__

* Re-enable tensorboard logging
Suppress "Model Not Compiled" warning

* Fix timelapse

* lib.model.nnblocks - Bugfix residual block
Port dfaker
bugfix original

* dfl-h128 ported

* DFL SAE ported

* IAE Ported

* dlight ported

* port lightweight

* realface ported

* unbalanced ported

* villain ported

* lib.cli.args - Update Batchsize + move allow_growth to config

* Remove output shape definition
Get image sizes per side rather than globally

* Strip mask input from encoder

* Fix learn mask and output learned mask to preview

* Trigger Allow Growth prior to setting strategy

* Fix GUI Graphing

* GUI - Display batchsize correctly + fix training graphs

* Fix penalized loss

* Enable mixed precision training

* Update analysis displayed batch to match input

* Penalized Loss - Multi-GPU Fix

* Fix all losses for TF2

* Fix Reflect Padding

* Allow different input size for each side of the model

* Fix conv-aware initialization on reload

* Switch allow_growth order

* Move mixed_precision to cli

* Remove distrubution strategies

* Compile penalized loss sub-function into LossContainer

* Bump default save interval to 250
Generate preview on first iteration but don't save
Fix iterations to start at 1 instead of 0
Remove training deprecation warnings
Bump some scripts.train loglevels

* Add ability to refresh preview on demand on pop-up window

* Enable refresh of training preview from GUI

* Fix Convert
Debug logging in Initializers

* Fix Preview Tool

* Update Legacy TF1 weights to TF2
Catch stats error on loading stats with missing logs

* lib.gui.popup_configure - Make more responsive + document

* Multiple Outputs supported in trainer
Original Model - Mask output bugfix

* Make universal inference model for convert
Remove scaling from penalized mask loss (now handled at input to y_true)

* Fix inference model to work properly with all models

* Fix multi-scale output for convert

* Fix clipnorm issue with distribution strategies
Edit error message on OOM

* Update plaidml losses

* Add missing file

* Disable gmsd loss for plaidnl

* PlaidML - Basic training working

* clipnorm rewriting for mixed-precision

* Inference model creation bugfixes

* Remove debug code

* Bugfix: Default clipnorm to 1.0

* Remove all mask inputs from training code

* Remove mask inputs from convert

* GUI - Analysis Tab - Docstrings

* Fix rate in totals row

* lib.gui - Only update display pages if they have focus

* Save the model on first iteration

* plaidml - Fix SSIM loss with penalized loss

* tools.alignments - Remove manual and fix jobs

* GUI - Remove case formatting on help text

* gui MultiSelect custom widget - Set default values on init

* vgg_face2 - Move to plugins.extract.recognition and use plugins._base base class
cli - Add global GPU Exclude Option
tools.sort - Use global GPU Exlude option for backend
lib.model.session - Exclude all GPUs when running in CPU mode
lib.cli.launcher - Set backend to CPU mode when all GPUs excluded

* Cascade excluded devices to GPU Stats

* Explicit GPU selection for Train and Convert

* Reduce Tensorflow Min GPU Multiprocessor Count to 4

* remove compat.v1 code from extract

* Force TF to skip mixed precision compatibility check if GPUs have been filtered

* Add notes to config for non-working AMD losses

* Rasie error if forcing extract to CPU mode

* Fix loading of legace dfl-sae weights + dfl-sae typo fix

* Remove unused requirements
Update sphinx requirements
Fix broken rst file locations

* docs: lib.gui.display

* clipnorm amd condition check

* documentation - gui.display_analysis

* Documentation - gui.popup_configure

* Documentation - lib.logger

* Documentation - lib.model.initializers

* Documentation - lib.model.layers

* Documentation - lib.model.losses

* Documentation - lib.model.nn_blocks

* Documetation - lib.model.normalization

* Documentation - lib.model.session

* Documentation - lib.plaidml_stats

* Documentation: lib.training_data

* Documentation: lib.utils

* Documentation: plugins.train.model._base

* GUI Stats: prevent stats from using GPU

* Documentation - Original Model

* Documentation: plugins.model.trainer._base

* linting

* unit tests: initializers + losses

* unit tests: nn_blocks

* bugfix - Exclude gpu devices in train, not include

* Enable Exclude-Gpus in Extract

* Enable exclude gpus in tools

* Disallow multiple plugin types in a single model folder

* Automatically add exclude_gpus argument in for cpu backends

* Cpu backend fixes

* Relax optimizer test threshold

* Default Train settings - Set mask to Extended

* Update Extractor cli help text
Update to Python 3.8

* Fix FAN to run on CPU

* lib.plaidml_tools - typofix

* Linux installer - check for curl

* linux installer - typo fix
2020-08-12 10:36:41 +01:00
torzdf
2a1457f21f convert - Add a "skip_mux" option for ffmpeg writer 2020-08-07 11:16:11 +01:00
torzdf
4a68b3f023 Move custom dlight blocks to nn_blocks 2020-06-07 17:06:00 +00:00
torzdf
ac40b0f52f
Remove subpixel upscaling option (#1024) 2020-05-13 13:50:48 +01:00
torzdf
815c843f63
Simple backend unit tests (#1020)
* Add simple backend tests for lib.model
* Document lib.model
* Fix GMSD Loss for AMD
* Remove obsolete code from lib.model
2020-05-12 23:46:04 +01:00
torzdf
ff8d85118e
Cli Restructure + Multi-Mask Select on Extract (#1012)
- Split up cli.py to smaller modules
- Enable Multi Mask Selection in Extraction
- Handle multi option selection options in the GUI
- Document lib/cli
2020-04-22 00:04:21 +01:00
torzdf
ab4ef75671 Extract - Allow multiple pipelines to be loaded 2020-04-02 15:53:29 +01:00
torzdf
8d4f381e7c Extract - Better VRAM Allocation in Extraction Pipeline 2020-03-31 15:24:32 +01:00
torzdf
bb3e3d0f16 Extraction - Auto generate Components and Extended Masks 2020-03-30 19:24:29 +01:00
torzdf
e7c5b7b633 Bugfix: cv2-dnn aligner - Assertion image is empty error 2020-03-29 18:24:58 +01:00
torzdf
924d53789b
Core updates (#982)
* plugins.extract.align
  - Expose normalization method

* lib.gui core updates
  - Minor updates to support future development.
2020-03-10 14:48:12 +00:00
torzdf
e58fd535d5 bugfix: CV2-DNN aligner. Fix Assertion error when bounding box falls out of frame 2020-03-06 12:10:40 +00:00
torzdf
d11ed95d87 Merge branch 'master' into staging 2020-01-26 00:35:13 +00:00
torzdf
76bf610996 plugins.extract.mask - Enable allow_growth option for mask tool 2020-01-26 00:34:59 +00:00
Rodrigo Agundez
1be2fd1e55 plugins.train.model.villain - Change fixed input size to variable (#960) 2020-01-10 12:05:12 +00:00
torzdf
86d039c242 Convert - bugfixes
- Default mask to an available mask in Preview tool
- Correctly output predicted mask
2020-01-03 14:13:58 +00:00
torzdf
f2333e1f9d tools.preview - Limit mask selection to only masks available for all faces
plugins.mask - Correctly set dtype for "None" mask
2019-12-30 18:10:54 +00:00
torzdf
1bdc9da02f
Smart Masks to Convert (#957)
- scripts.convert - Use Smart Masks for Convert
    * Make on-the-fly conversion an explicit option

- Move BlurMask to lib.faces_detect

- tools.preview - Fix for smart masks
    * Subclass from tk.Tk
    * Options to lib.gui.control_helper
    *variable cleanup

- lib.logger - Demote more tensorflow deprecation messages

- Documentation:
    * lib.faces_detect.BlurMask
    * plugins.convert.mask
    * lib.convert
    * scripts.convert
    * scripts.fsmedia
    * tools.preview
2019-12-29 23:13:25 +00:00
torzdf
ba41a9c37a bugfix: dlight model
change "mask_type" to "learn_mask" in decoders
2019-12-27 03:50:25 +00:00
torzdf
8fee68e2b9 bugfix: plugins.train.model._base - Legacy update.
Set `learn_mask` to False on legacy models if a `mask_type` does not exist otherwise `True`
2019-12-19 23:41:32 +00:00
torzdf
c1e6080d92 Training: Cleaner loss printing 2019-12-12 13:27:14 +00:00
torzdf
c4b6ed0ba8 Small bugfix 2019-12-12 01:39:30 +00:00
torzdf
6efed85490 lib,cli: Add suppressed colab flag 2019-12-12 01:22:02 +00:00
torzdf
6afa6a9eb5 bugfix: plugins.train.trainer._base - Fix landmarks loading 2019-12-09 17:54:35 +00:00
torzdf
4e654eb328 plugins.train.trainer - Speed up mask caching 2019-12-09 12:50:27 +00:00
torzdf
43a4d06540
Smart Masks - Training Implementation (#914)
* Smart Masks - Training

- Reinstate smart mask training code
- Reinstate mask_type back to model.config
- change 'replicate_input_mask to 'learn_mask'
- Add learn mask option
- Add mask loading from alignments to plugins.train.trainer
- Add mask_blur and mask threshold options
- _base.py - Pass mask options through training_opts dict
- plugins.train.model - check for mask_type not None for learn_mask and penalized_mask_loss
- Limit alignments loading to just those faces that appear in the training folder
- Raise error if not all training images have an alignment, and alignment file is required
- lib.training_data - Mask generation code
- lib.faces_detect - cv2 dimension stripping bugfix
- Remove cv2 linting code

* Update mask helptext in cli.py

* Fix Warp to Landmarks
Remove SHA1 hashing from training data

* Update mask training config

* Capture missing masks at training init

* lib.image.read_image_batch - Return filenames with batch for ordering

* scripts.train - Documentation

* plugins.train.trainer - documentation

* Ensure backward compatibility.
Fix convert for new predicted masks

* Update removed masks to components for legacy models.
2019-12-05 16:02:01 +00:00
torzdf
aede5f0f44 bugfix: Extract - Calculate zero sized faces prior to scaling up 2019-11-30 19:33:59 +00:00
torzdf
4fdeb67fba Bugfix - Manual tool. Use new ExtractMedia class 2019-11-29 23:53:00 +00:00
torzdf
46309771bb plugins.extract - Create ExtractMedia class for pipeline flow
Bugfix - Fix memory leak in extract
2019-11-29 00:46:27 +00:00
torzdf
3ce448ba90 plugins.convert.ffmpef - Explicit stream selection on mux audio 2019-11-22 22:08:24 +00:00
Kyle
d5c2063459 fix to error on out of bounds 2019-11-15 18:09:12 -06:00
torzdf
e4b7717c64 Minor fixes 2019-11-15 20:16:45 +00:00
kvrooman
47681a8bab Landmarks stored and used as floating point numbers (#928)
* remove and fix int adjustments
* masking rounding
2019-11-15 11:01:37 +00:00
kvrooman
36be6cd4d8 Vectorize FAN post-processing (#926) 2019-11-14 13:01:35 +00:00
kvrooman
64a400f6b4 Refine S3FD post-processing: NMS box voting (#902) 2019-11-14 12:49:47 +00:00
torzdf
73ff840fbd scripts.extract - code optimizations
Limit queue sizes to reduce RAM usage
Rename lib.image.BackgroundIO to ImageIO
Create separate ImagesLoader and ImagesSaver classes
Load/Save images from centralized lib.image.ImageIO
scripts.extract documentation
2019-11-13 19:16:25 +00:00
kvrooman
b49c352e8f # pylint:disable=no-member cleanup (#927)
# pylint:disable=no-member cleanup
2019-11-13 12:17:59 +00:00
kilroythethird
54b6e86008 Changed MTCNN input to RGB 2019-11-11 20:13:33 +01:00
torzdf
b15494d7a9 Merge branch 'master' into staging 2019-10-29 22:41:17 +00:00
torzdf
68109fcc80 bugfix: plugins.extract.pipeline - Exclude CPU plugins from vram calculations 2019-10-29 22:41:01 +00:00
torzdf
efbe606b0e Merge branch 'master' into staging 2019-10-29 11:38:53 +00:00
torzdf
ef49d121e1 Add masker to Travis Tests
Bugfix: Parallel VRAM calculation for non-gpu extractors
2019-10-28 11:56:38 +00:00
Artem Ivanov
3f29b72a93 DeLight model rc3 (#908)
* DeLight model rc3

* lint wishes fulfilled
2019-10-28 10:03:54 +00:00
Vyacheslav Linnik
9af7726897 Always set batchsize as int (#913) 2019-10-26 22:51:04 +01:00
torzdf
e488baf5f4 Mask Updates
- Remove storage of original frame_dims from alignments file
- Require frame dims to be passed in to faces_detect.Mask when requesting full frame mask
- Create copy of read only mask when adding blurring/threshold
2019-10-25 17:25:06 +00:00
torzdf
c065916f23 Extract - Mask updates
- Remove none mask plugin
- Make pipeline more flexible
- Add support for pre-aligned faces to masker plugin
- Migrate blur and threshold settings to mask output
2019-10-23 15:05:24 +00:00
torzdf
ad035f2a24 Optimize Extract parallel VRAM allocation 2019-10-19 23:53:42 +00:00
torzdf
d93e7b1114 Smart Mask - Extract code review
- Lint simple_tests.py
- Only reformat alignments file if it exists otherwise change filename
- Update legacy alignments to new format at all stages
- faces_detect.Mask.from_dict - logging format fix
- convert.py fix otf for new pipeline
- cli.py - Add note that masks not used. Revert convert masks
- faces_detect.py - Revert non-extract code
- Add .p and .pickle extensions for serializer
- plugins/extract revert some changes
- scripts/fsmedia - Revert code changes
- Pipeline - cleanup
- Consistant alpha channel stripping (fixes single-process)
- Store landmarks as numpy array
- Code attribution
- Normalize feed face and reference face to 0.0 - 1.0 in convert
- Lock in mask VRAM sized
- Add documentation to plugin_loader
- Update alignments tool to work with new format
2019-10-18 15:44:25 +00:00
torzdf
eceee07241 Legacy alignments update
- Remove legacy update hashes
- Remove legacy job from alignment-tools
- Remove legacy landmark rotation
- Add rotate face method to plugins/extract/detect
- Update travis test for new alignments extension
- Alignments format to .fsa
- Remove serializer option from alignments-tool
- Auto update legacy format alignment files to new format
2019-10-15 16:08:20 +00:00
torzdf
bc822fad22 Merge branch 'staging' into smart-mask-alpha 2019-10-15 09:40:26 +00:00
torzdf
bc6ab7313f Mask extraction fixes
- Save mask to alignments file as dict
- Remove blur_kernel param from plugins
- Correctly read out the mask buffer on decompress
- Fix full frame mask output
- Remove BORDER_TRANSPARENT in warp_affine (it is bugged. Don't use it)
- Store the affine matrix for the saved mask size
2019-10-14 18:42:59 +00:00
torzdf
d60118fd6f Capture cudnn launch error in extract model init 2019-10-14 09:37:58 +01:00
torzdf
70ee125283 Serialize masks to alignments file
- Add new serializers (npy + compressed)
- Remove Serializer option from cli
- Revert get_aligned call in scripts/extract
- Default alignments to compressed
- Size masks to 128px and compress
- Remove mask thresholding/blur from generation code
- Add Mask class to lib/faces_detect
- Revert debug landmarks to aligned face
- Revert non-extraction code to staging version
2019-10-13 22:50:28 +00:00
torzdf
3deb79392d Merge branch 'staging' into smart-mask-alpha 2019-10-12 09:41:19 +00:00
torzdf
468e2709de Mask plugin cleanup
- PEP8 Fixes
- Remove config for non NN Masks
- Tidy up defaults helptext
- cli.py fix typos
- Remove unused imports and functions _base.py
- Standardize input_size param
- Enable and update documentation
- Change references from `aligner` to `masker`
- Change  input_size, output_size and coverage_ratio from kwargs to params
- Move load_aligned to batch input iterator
- Remove unnecessary self.input param
- Add softmax layer append function to KSession
- Remove references to KSession protected objects
- Standardize plugin output into finalize method
- Make masks full frame and add to lib.faces_detect
- Add masks to alignments.json (temporary zipped base64 solution)
2019-10-11 18:17:39 +00:00
torzdf
e35918cadf
Standardize serialization (#903)
* Standardize serialization

- Linting
- Standardize serializer use throughout code
- Extend serializer to load and save files
- Always load and save in utf-8
- Create documentation
2019-10-10 23:11:12 +01:00
kvrooman
995a857154 Smart Mask Exposure for Extraction & Training (#831)
Smart Masks - Initial Commit
2019-10-07 16:16:18 +01:00
torzdf
c63b080937 Add non-fixed items to session item in state.json 2019-10-04 10:35:05 +00:00
torzdf
861f78fff1 Capture cuDNN error in extract and raise a useful message 2019-09-29 17:18:50 +01:00
torzdf
29a75b90d4 Extract: Expose "allow_growth" option 2019-09-29 12:06:04 +01:00
torzdf
bf2510dfc4 Force imageio to use ffmpeg 2019-09-29 00:33:28 +01:00
torzdf
174e6950ea Logging format fixes 2019-09-25 13:01:24 +01:00
torzdf
54d5159ad4 trainer._base - explicit list extending for preview 2019-09-24 15:59:34 +00:00
torzdf
cacb2ce2ac Preview + crashlog bugfixes 2019-09-24 15:26:54 +00:00
torzdf
66ed005ef3
Optimize Data Augmentation (#881)
* Move image utils to lib.image
* Add .pylintrc file
* Remove some cv2 pylint ignores
* TrainingData: Load images from disk in batches
* TrainingData: get_landmarks to batch
* TrainingData: transform and flip to batches
* TrainingData: Optimize color augmentation
* TrainingData: Optimize target and random_warp
* TrainingData - Convert _get_closest_match for batching
* TrainingData: Warp To Landmarks optimized
* Save models to threadpoolexecutor
* Move stack_images, Rename ImageManipulation. ImageAugmentation Docstrings
* Masks: Set dtype and threshold for lib.masks based on input face
* Docstrings and Documentation
2019-09-24 12:16:05 +01:00
kvrooman
139b581177 Align eyes deprecation (#851)
* align eyes removal

* add align_eyes tool
2019-09-24 11:16:03 +01:00
Kyle
9a57af45d5 loss name correction 2019-09-22 16:37:43 -05:00
torzdf
1cdbc5ea27 Update cli for MTCNN 2019-09-18 23:37:22 +00:00
torzdf
a14bb9d636 extract: Autoset batchsize if it is too large in singleprocess mode 2019-09-18 23:00:55 +00:00
torzdf
feb5f75201 set mtcnn Nvidia defaults 2019-09-18 22:30:49 +00:00
kilroythethird
b7cd51a2f1 Optimized mtcnn a bit + added batching (#874) 2019-09-18 23:09:00 +01:00
torzdf
88352b0268
De-Multiprocess Extract (#871)
* requirements.txt: - Pin opencv to 4.1.1 (fixes cv2-dnn error)

* lib.face_detect.DetectedFace: change LandmarksXY to landmarks_xy. Add left, right, top, bottom attributes

* lib.model.session: Session manager for loading models into different graphs (for Nvidia + CPU)

* plugins.extract._base: New parent class for all extract plugins

* plugins.extract.pipeline. Remove MultiProcessing. Dynamically limit batchsize for Nvidia cards. Remove loglevel input

* S3FD + FAN plugins. Standardise to Keras version for all backends

* Standardize all extract plugins to new threaded codebase

* Documentation. Start implementing Numpy style docstrings for Sphinx Documentation

* Remove s3fd_amd. Change convert OTF to expect DetectedFace object

* faces_detect - clean up and documentation

* Remove PoolProcess

* Migrate manual tool to new extract workflow

* Remove AMD specific extractor code from cli and plugins

* Sort tool to new extract workflow

* Remove multiprocessing from project

* Remove multiprocessing queues from QueueManager

* Remove multiprocessing support from logger

* Move face_filter to new extraction pipeline

* Alignments landmarksXY > landmarks_xy and legacy handling

* Intercept get_backend for sphinx doc build

# Add Sphinx documentation
2019-09-15 17:07:41 +01:00
kilroythethird
da0d303c1d s3fd-amd fixes 2019-09-04 17:21:35 +02:00
kilroythethird
3ba8c73f49 de-MultiProcess Training
* Replaced multiprocessing in training_data with threading
* Fix cpu affinity issue
* Using multiple threads for BackgroundGenerator
2019-09-03 23:42:51 +01:00
torzdf
f0833012a1
De-Multiprocess Convert (#857)
* Convert: Swap MP pool for Thread pool
2019-09-02 22:55:36 +01:00
torzdf
967f97f4a5 Minor extract fixups 2019-08-29 18:31:34 +00:00
torzdf
105af8a02a GUI Tweaks 2019-08-25 11:07:34 +01:00
torzdf
e1fdb25673 Add grouping for GUI options 2019-08-23 02:48:59 +00:00
torzdf
f77cf1fef9 AMD Backend typofix 2019-08-17 22:30:28 +00:00
torzdf
b8598be2b6 More seamless AMD Integration
- utils.py: Set FS backend if .faceswap config file doesn't exist
- setup.py: set .faceswap config on setup
- Dynamically load options for AMD/CPU/NVIDIA backends
2019-08-17 19:16:43 +00:00
torzdf
f540236262 Merge branch 'master' into staging 2019-08-17 00:12:27 +00:00
torzdf
ec505f2ad9 Tensorflow 1.14 Support
Fix Keras Tensorboard callback for TF1.14
Default install on CPU to TF 1.14.0
Default Conda install to TF 1.14.0
Move pynvx for macOS to conditional requirements.txt
2019-08-17 00:11:58 +00:00
kilroythethird
f8edae5887 Added s3fd-amd + minor fixes (#837) 2019-08-15 20:04:48 +01:00
torzdf
31c51e8eb2 DFL SAE 2019-08-12 22:34:32 +01:00
torzdf
1cb67c585e Move gaussian_blur to losses (fixes plaidml race condition) 2019-08-08 00:43:44 +01:00
torzdf
f7ecae2997 Add "mask_blur" option for training 2019-08-08 00:09:30 +01:00
torzdf
40f8ac8768 Fix penalized loss for multiscale decoders 2019-08-07 13:46:36 +00:00
kilroythethird
62c1d4346f Catch 0 size images earlier + plaidml version + minor gui update (#829) 2019-08-07 11:15:05 +01:00
kilroythethird
192ac5852f temporary restore removed model configs (#827) 2019-08-06 13:15:16 -07:00
torzdf
28cc7c254d config: Update helptext for conv_aware_init 2019-08-06 16:38:37 +00:00
Kyle
a3585fe5c9 int typing 2019-08-04 15:28:31 -05:00
torzdf
af41940c94 Merge branch 'master' into staging 2019-08-04 13:23:38 +00:00
torzdf
ee2e081446 Disable VRAM saving features for plaidML users
- Disable non-compatible vram saving features for plaidML users
- Move VRAMSavings to own class in /model/_base.py
2019-08-04 13:22:30 +00:00
torzdf
14bd0487bf Merge branch 'master' into staging 2019-08-03 17:03:39 +00:00
torzdf
502df1e4a9 Bump S3FD VRam requiremets 2019-08-03 17:03:23 +00:00
torzdf
111d275078 Post PR Fixups
- train/_config.py: PEP8 Fixes. Slight description change on coverage
- models/_base.py:
   - Remove unused variables from Loss()
   - Delete legacy config items from state file
   - Save state file on Legacy update
   - PEP8
- Remove _defaults.py for models with no config options
2019-08-03 12:09:13 +00:00
kvrooman
b7b1bd5c6f documentation, pep8, style, clarity updates - Prep for Segmentation (#812)
* documentation, pep8, style, clarity updates

* Update cli.py

* Update _config.py

remove extra mask and coverage

mask type as dropdown

* Update training_data.py

move coverage / LR to global
cut down on loss description

style change
losses working in PR

* simpler logging

* legacy update
2019-08-03 12:38:43 +01:00
torzdf
a1462c98bc Bugfix: Correctly name models on reload 2019-08-02 09:24:49 +00:00
Artem Ivanov
493bd4c719 Manual Balance Plugin - brightness contrast adjustments (#818)
* Update manual_balance.py
* Update manual_balance_defaults.py

- Renamed the parameters to `contrast` and `brightness`
- Values range is altered to run from -100.0 to +100.0
2019-07-31 16:35:19 +01:00
torzdf
1d0d721452 bugfix: Frame ranges for ffmpeg/gif writers 2019-07-30 16:59:50 +00:00
Artem Ivanov
c6319ca4f9 Model output size assertions fix (#816)
* added sanity check for RealFace output size to be divisible by 32
2019-07-29 23:30:13 +01:00
torzdf
8b2f166eb9 Update helptext for CA Initialization 2019-07-25 23:23:30 +00:00
torzdf
0d4f5cf485 Bugfixes: PingPong Training
Print loss correctly for PingPong Training
Don't load Analysis stats for PingPong Training
2019-07-25 22:15:12 +00:00