67 Commits

Author SHA1 Message Date
torzdf fa79d4dcee Initializers to Torch (#1549)
* Update requirements

* Remove docker

* ICNR init to torch

* conv-aware: Output as Tensor rather than Variable

* Bugfix: Omit type object from automodsumm

* bugfix: Tensorboard unit test. Switch Sequential for Functional

* Suppress broken Keras test

* revert failing test
2026-05-29 11:40:03 +01:00
torzdf 83fdd5f938 Train: Migrate data loading to Torch (#1540) 2026-04-16 19:19:53 +01:00
torzdf d21781264d Extraction Overhaul (#1533)
* Extract refactor
2026-03-20 23:52:37 +00:00
torzdf 837bc2d51d Faceswap 3 (#1516)
* FaceSwap 3 (#1515)
* Update extract pipeline
* Update requirements + setup for nvidia
* Remove allow-growth option
* tf.keras to keras updates
* lib.model.losses - Port + fix all loss functions for Keras3
* lib.model - port initializers, layers. normalization to Keras3
* lib.model.autoclip to Keras 3
* Update mixed precision layer storage
* model file to .keras format
* Restructure nn_blocks to initialize layers in __init__
* Tensorboard
  - Trainer: Add Torch compatible Tensorboard callbacks
  - GUI event reader remove TF dependency
* Loss logging
  - Flush TB logs on save
  - Replace TB live iterator for GUI
* Backup models on total loss drop rather than per side
* Update all models to Keras3 Compat
* Remove lib.model.session
* Update clip ViT to Keras 3
* plugins.extract.mask.unet-dfl - Fix for Keras3/Torch backend
* Port AdaBelief to Keras 3
* setup.py:
  - Add --dev flag for dev tool install
* Fix Keras 3 syntax
* Fix LR Finder for Keras 3
* Fix mixed precision switching for Keras  3
* Add more optimizers + open up config setting
* train: Remove updating FS1 weights to FS2 models
* Alignments: Remove support for legacy .json files
* tools.model:
  - Remove TF Saved Format saving
  - Fix Backup/Restore + Nan-Scan
* Fix inference model creation for Keras 3
* Preview tool: Fix for Keras3
* setup.py: Configure keras backend
* train: Migration of FS2 models to FS3
* Training: Default coverage to 100%
* Remove DirectML backend
* Update setup for MacOS
* GUI: Force line reading to UTF-8
* Remove redundant Tensorflow references
* Remove redundant code
* Legacy model loading: Fix TFLamdaOp scalar ops and DepthwiseConv2D
* Add vertical offset option for training
* Github actions: Add more python versions
* Add python version to workflow names
* Github workflow: Exclude Python 3.12 for macOS
* Implement custom training loop
* Fs3 - Add RTX5xxx and ROCm 6.1-6.4 support (#1511)
* setup.py: Add Cuda/ROCm version select options
* bump minimum python version to 3.11
* Switch from setup.cgf to pyproject.toml
* Documentation: Update all docs to use automodapi
* Allow sysinfo to run with missing packages + correctly install tk under Linux
* Bugfix: dot naming convention in clip models
* lib.config: Centralise globally rather than passing as object
- Add torch DataParallel for multi-gpu training
  - GUI: Group switches together when generating cli args
  - CLI: Remove deprecated multi-character argparse args
  - Refactor:
    - Centralise tensorboard reading/writing + unit tests
    - Create trainer plugin interfaces + add original + distributed
* Update installers
2025-12-21 02:45:11 +00:00
torzdf 381b06f6d3 training: Add Learning Rate Warmup 2025-11-21 17:52:45 +00:00
torzdf 696692dc08 Fixups
- Deprecations - display correct long argument
  - Minor spelling + linting
2024-04-21 16:22:42 +01:00
torzdf 1c081aea7d Add ability to export and import alignment data (#1383)
* tools.alignments - add export job

* plugins.extract: Update __repr__ for ExtractorBatch dataclass

* plugins.extract: Initial implementation of external import plugins

* plugins.extract: Disable lm masks on ROI alignment data import

* lib.align: Add `landmark_type` property to AlignedFace and return dummy data for ROI Landmarks pose estimate

* plugins.extract: Add centering config item for align import and fix filename mapping for images

* plugins.extract: Log warning on downstream plugins on limited alignment data

* tools: Fix plugins for 4 point ROI landmarks (alignments, sort, mask)

* tools.manual: Fix for 2D-4 ROI landmarks

* training: Fix for 4 point ROI landmarks

* lib.convert: Average color plugin. Avoid divide by zero errors

* extract - external:
  - Default detector to 'external' when importing alignments
  - Handle different frame origin co-ordinates

* alignments: Store video extension in alignments file

* plugins.extract.external: Handle video file keys

* plugins.extract.external: Output warning if missing data

* locales + docs

* plugins.extract.align.external: Roll the corner points to top-left for different origins

* Clean up

* linting fix
2024-04-15 12:19:15 +01:00
torzdf 95b4431c57 Deprecate multi-character cli switches 2024-04-05 13:51:57 +01:00
torzdf 983901466f linting: Reduce Class min-public-methods and fix spacing 2024-04-03 14:37:48 +01:00
torzdf a9d87ae007 linting: Remove pylint hint for logger 2024-04-03 14:03:54 +01:00
torzdf e80ae046d5 Convert - Patch writer (#1352)
* Add cli-args and config opts for patch writer
* Add supporting code to convert funcs
* writers
  - move frame count functions to _base
  - Add kwargs for pre_encode
* scripts/lib convert - add code for patch writer
* lib.image.encode_image - Add cv2.imencode args
* patch_defaults: Add face index location option
* Add patch writer with PNG support
* Send correct matrix to patch plugin
* Add canvas origin option
* Add Tiff format to Patch Writer
* Docs and locales
* Add ROI to output
* convert: choose warp border by face count
2023-09-28 11:55:38 +01:00
torzdf a660eda8e1 Convert: Add face scale option 2023-09-09 18:40:36 +01:00
torzdf cf0efff6ba Learning Rate finder (#1341)
* Add LR Finder support structure

* Move trainer.Feeder to lib.training.generator

* Expose model.io

* Add lr_finder

* Update docs and locales

* Pre-PR fixups
  - Fix training graph not displaying
  - CI fixes
  - Switch lr finder progress to tqdm
  - Exit lr finder early on NaN
  - Display lr finder progress in GUI
2023-08-22 17:07:36 +01:00
torzdf 6a3b674bef Rebase code (#1326)
* Remove tensorflow_probability requirement

* setup.py - fix progress bars

* requirements.txt: Remove pre python 3.9 packages

* update apple requirements.txt

* update INSTALL.md

* Remove python<3.9 code

* setup.py - fix Windows Installer

* typing: python3.9 compliant

* Update pytest and readthedocs python versions

* typing fixes

* Python Version updates
  - Reduce max version to 3.10
  - Default to 3.10 in installers
  - Remove incompatible 3.11 tests

* Update dependencies

* Downgrade imageio dep for Windows

* typing: merge optional unions and fixes

* Updates
  - min python version 3.10
  - typing to python 3.10 spec
  - remove pre-tf2.10 code
  - Add conda tests

* train: re-enable optimizer saving

* Update dockerfiles

* Update setup.py
  - Apple Conda deps to setup.py
  - Better Cuda + dependency handling

* bugfix: Patch logging to prevent Autograph errors

* Update dockerfiles

* Setup.py - Setup.py - stdout to utf-8

* Add more OSes to github Actions

* suppress mac-os end to end test
2023-06-27 11:27:47 +01:00
torzdf 03f5c671bc Remove plaidML support (#1325)
* Remove PlaidML reference from readme files

* Remove AMD option from installers

* remove amd requirements and update setup.py

* remove plaidml test from CI workflow

* gpustats: remove plaidml backend

* plaid removals:
  - faceswap.py - python version check
  - setup.cfg - plaidml typing ignore
  - lib.keras_utils - All plaid code
  - lib.launcher.py - All plaidml checks and configuration

* remove tf2.2 specific code from GUI event reader

* lib.model - remove all plaidml implementations

* plugins.extract - remove plaidml code

* plugins.train remove plaidml code

* lib.convert - remove plaidml code

* tools.model: remove plaidml code

* Remove plaidML tests from unit tests

* remove plaidml_utils and docsting cleanups

* Remove plaidML refs from configs

* fix keras imports
2023-06-21 12:57:33 +01:00
torzdf e0eda1cf80 bugfix: Extract memory leak 2023-06-16 13:31:45 +01:00
torzdf 1d19aea281 bugfix - numexpr. ignore OMP_NUM_THREADS EnvVar 2023-01-18 15:39:05 +00:00
torzdf 80f63280ca Bugfixes
- plugin.train.unbalanced - decoder b
  - gui.stats - crash when log folder deleted
  - setup.py - install gcc=12.1.0 on linux (scipy dep)
  - setup.py - don't test ROCm unless valid
  - typofix - cli_args extract singleprocess help
typing
  - lib.gui.analysis.event_reader
  - lib.gpu_stats.directml - make platform specific
unit tests
  - lib.gui.analysis.event_reader
2023-01-13 23:29:51 +00:00
torzdf 28cb2fcffb Unhide options for ROCm 2023-01-11 14:34:30 +00:00
torzdf dc94ed9cad DirectML Support (#1291)
* DML Support
  - Add requirements. Update setup.py. Update Windows Installer
  - Add 'directml' backend. Update backend supporting logic
  - GPUStats - Add GPU querying from Win SDK for DML backend
  - Windows PlaidML - Deprecation Warning
  - Remove deprecated '-d' training flag
  - Logging in DML functions
- Unittest
  - Windows Unit Test
  - lib.utils
2023-01-06 14:45:57 +00:00
torzdf d750af1e92 bump TF to version 2.10 2022-12-20 15:30:26 +00:00
torzdf 84ae6006bb Bugfix - TF Version check 2022-12-19 11:26:32 +00:00
torzdf 9e2026f6fe Extract: Implement re-align/2nd pass
- implement configurable re-align function in extract
  - update locales + documentation
  - re-factor align._base and split to separate modules
  - move normalization method to plugin parent
  - bugfix: FAN use zeros for pre-processing crop
  - lint AlignedFilter
2022-11-22 00:37:29 +00:00
torzdf e3b457693e bugfix - extract filters: spaces in folder names 2022-11-10 01:41:40 +00:00
torzdf 0f5d2e887c Face-filter updates:
- Allow selecting folder as well as multiple images
  - Lower default threshold and update helptext
  - bugfix: detector error when using all aligned faces
  - Standardize output folder name
2022-11-04 18:43:55 +00:00
torzdf 1d1face00d Update Face Filter
- Remove old face filter
  - plugins.extract.pipeline: Expose plugins directly
  - Change `is_aligned` from plugin level to ExtractMedia level
  - Allow extract pipeline to take faceswap aligned images
  - Add ability for recognition plugins to accept aligned faces as input
  - Add face filter to recognition plugin
  - Move extractor pipeline IO ops to own class
2022-10-31 18:25:32 +00:00
torzdf f1e3339fbe Add vggface2 to extraction pipeline 2022-10-10 13:09:02 +01:00
torzdf a8f22cc019 Extract updates:
- Default CPU detector to MTCNN
  - add basic Aligner false positive filters
  - Typing: align + plugins
  - Use specific AlignerBatch class for alignment
  -
2022-09-18 19:44:41 +01:00
torzdf 8a803e24c4 bugfix: Suppress OMP error on CPU Windows version 2022-09-18 18:25:33 +01:00
torzdf 13cfb3f39e extract: Add batch processing mode 2022-08-31 19:48:47 +01:00
torzdf 2beceffad9 Data Augmentation update (#1263)
- lib.detected_face
    - Subclass Masks for Landmark based masks
    - Add training mask propery + methods to DetectedFace
  - lib.training_training
    - subclass TrainingDataGenerator for training and preview data
    - Split cache into own module
    - Reduce thread count to 1 to prevent image corruption + data re-use
    - Process on largest model input/output size rather than stored image size
    - Size and crop masks during caching stage
    - Implement ring buffer for data flow
    - Fix preview reload bug
  - augmentation
    - typing
    - switch color aug order
    - better initialization
    - Fix warp + landmark warp to correctly apply at different image scales
    - Slightly improved warp caching
    - Don't store whether image is_preview. Handle all data as training images implicitly
  - plugins.trainer: Typing and fixes to work with trainingdata refactor
2022-08-21 18:59:45 +01:00
torzdf 629c02a61e Add "custom" mask 2022-08-05 14:09:05 +01:00
torzdf 26e26c6288 Update TF to 2.9
- Update TF to 2.7 to 2.9
    - Bump dependencies
    - Remove decode from pynvml calls
    - force keras predict functions to non-verbose
    - update tests
    - update Tensorboard logging
    - Update docs
2022-08-02 17:12:26 +01:00
torzdf 54398559ff Set default distribution strategy to 'default' 2022-07-20 12:29:14 +01:00
torzdf 2ea05623bd Update Distibution Strategies:
- Add Central Storage Stategy
  - Deprecate 'distributed' cli argument
2022-07-19 18:23:16 +01:00
torzdf 7b9fc0454d Live Preview - Replace cv2 with matplotlib viewer 2022-07-01 13:07:01 +01:00
torzdf 6e0360150d bugfix: Correctly show installed TF Version on AMD error 2022-06-29 18:10:47 +01:00
torzdf 20a657d6cf Bump minimum TF Version 2022-06-07 10:54:51 +01:00
torzdf bdbbad4d31 Refactor lib.gpu_stats (#1218)
* inital gpu_stats refactor

* Add dummy CPU Backend

* Update Sphinx documentation
2022-05-11 17:36:07 +01:00
torzdf aa39234538 Update all Keras Imports to be conditional (#1214)
* Remove custom keras importer

* first round keras imports fix

* launcher.py: Remove KerasFinder references

* 2nd round keras imports update (lib and extract)

* 3rd round keras imports update (train)

* remove KerasFinder from tests

* 4th round keras imports update (tests)
2022-05-03 20:18:39 +01:00
torzdf c1512fd41d Update code to support Tensorflow versions up to 2.8 (#1213)
* Update maximum tf version in setup + requirements

* - bump max version of tf version in launcher
- standardise tf version check

* update keras get_custom_objects  for tf>2.6

* bugfix: force black text in GUI file dialogs (linux)

* dssim loss - Move to stock tf.ssim function

* Update optimizer imports for compatibility

* fix logging for tf2.8

* Fix GUI graphing for TF2.8

* update tests

* bump requirements.txt versions

* Remove limit on nvidia-ml-py

* Graphing bugfixes
  - Prevent live graph from displaying if data not yet available

* bugfix: Live graph. Collect loss labels correctly

* fix: live graph - swallow inconsistent loss errors

* Bugfix: Prevent live graph from clearing during training

* Fix graphing for AMD
2022-05-02 14:30:43 +01:00
torzdf cf4b567cc6 Tensorflow 2.6 Support (#1182)
* lib.cli.launcher - Bump max tf version to 2.6

* Remove pathlib requirement

* Update requirements files

* Update setup.py

* bugfix - GUI: Supress errors when attempting to load previews in extract

* GUI: Suppress ptxas error messages for Windows
2021-09-05 02:25:12 +01:00
torzdf 6c439944cd Masks updates
- Add head centering support to training
  - Update helptext/tooltips
2021-05-17 18:20:08 +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 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 6ce09dbac6 Help text - Add "predicted" help tesk to convert mask option 2021-02-20 02:14:00 +00:00
torzdf 1f3e1b0656 Add Locale support for cli arguments 2021-02-18 23:53:01 +00:00