1
0
Fork 0
mirror of https://github.com/deepfakes/faceswap synced 2025-06-09 04:36:50 -04:00
Commit graph

47 commits

Author SHA1 Message Date
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
3ce448ba90 plugins.convert.ffmpef - Explicit stream selection on mux audio 2019-11-22 22:08:24 +00:00
torzdf
bf2510dfc4 Force imageio to use ffmpeg 2019-09-29 00:33:28 +01:00
torzdf
f0833012a1
De-Multiprocess Convert (#857)
* Convert: Swap MP pool for Thread pool
2019-09-02 22:55:36 +01:00
torzdf
105af8a02a GUI Tweaks 2019-08-25 11:07:34 +01:00
Kyle
a3585fe5c9 int typing 2019-08-04 15:28:31 -05: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
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
torzdf
a757a4aa88 GUI: Preview for convert
Display preview when outputting to a stream container (e.g. video, gif)
2019-07-08 11:29:17 +00:00
torzdf
2f0fe704af Fixups
GUI: Fix thumbnail calculation + add borders
cv2-dnn aligner: Remove debug code
Convert: FFMpeg plugin - retry muxing audio on failure and properly error handle
2019-07-06 16:27:11 +00:00
torzdf
677903b13b Change ffmpeg macro_block_size to 8 2019-06-26 00:06:36 +00:00
torzdf
71bcd863e1 Bugfixes and minor changes
Fix: Occasional memory leak in convert
Fix: Dynamic config loading in Windows
Change: Better folder naming for snapshots
2019-06-11 17:26:43 +00:00
torzdf
0eff0a1719 Config Changes + Bugfixes
Bugfix: Fully disable keypress monitor for GUI
Bugfix: Preview - Handle missing alignments file
Config changes:
    - Separate plugin defaults into their own files
    - Move mask_type to global training config
    - Add ability to pass in custom config files
2019-06-11 01:13:42 +00:00
torzdf
d447c7d535 Bugfixes
- Set previews to minimum of batchsize and number of images
- Add manual balance help text
- Remove illegal character from convert _config.py
2019-06-09 11:13:42 +00:00
torzdf
26836a4907 Bugfixes
Facefilter - Variable reference before assignment
masks - Facehull initialize to 255.0 instead of 1.0
Alignments tool - Stop tool from ignoring upper case extensions
pep8 fixes
2019-05-31 17:48:53 +01:00
torzdf
6b7efa436f Convert: Add manual balance color adjustment plugin 2019-05-31 11:32:09 +01:00
torzdf
236c35f11a
Convert settings tool (#737)
* Initial prediction pipeline and display

* Patch faces from convert pipeline. Load configs

* Add tkinter canvas for image display

* Radio buttons to config gui. Standardise config gui. Remove dssim loss from realface

* Add action frame

* Live update cli options

* Live update config changes

* Quicker frame loading. Refresh faces button callback

* remove debug code

* Add saving and reloading config buttons

* Reduce lag with threading

* Busy indicator + geometry updates

* Fix options canvas resizing

* Add global config saving and resetting

* tools to own tab

* Rename tool to 'preview'

* geometry tweak

* pep8 fixes
2019-05-30 18:15:25 +01:00
torzdf
7010154c10 Remove em dash 2019-04-28 13:43:10 +00:00
torzdf
47b4319103 Bugfixes [convert[: Correct output folder. Correct tqdm for skipped frames. 2019-04-22 00:02:39 +00:00
torzdf
27a685383e
Convert refactor (#703)
* Separate predict and implement pool

* Add check and raise error to multithreading

Box functions to config. Add crop box option.

* All masks to mask module. Refactor convert masks

Predicted mask passed from model. Cli update

* Intesect box with mask and fixes

* Use raw NN output for convert

Use raw mask for face adjustments. Split adjustments to pre and post warp

* Separate out adjustments. Add unmask sharpen

* Set sensible defaults. Pre PR Testing

* Fix queue sizes. Move masked.py to lib

* Fix Skip Frames. Fix GUI Config popup

* Sensible queue limits. Add a less resource intensive single processing mode

* Fix predicted mask. Amend smooth box defaults

* Deterministic ordering for video output

* Video to Video convert implemented

* Fixups

- Remove defaults from folders across all stages
- Move match-hist and aca into color adjustments selectable
- Handle crashes properly for pooled processes
- Fix output directory does not exist error when creating a new output folder
- Force output to frames if input is not a video

* Add Color Transfer adjustment method

Wrap info text in GUI plugin configure popup

* Refactor image adjustments. Easier to create plugins

Start implementing config options for video encoding

* Add video encoding config options

Allow video encoding for frames input (must pass in a reference video)
Move video and image output writers to plugins

* Image writers config options

Move scaling to cli
Move draw_transparent to images config
Add config options for cv2 writer
Add Pillow image writer

* Add gif filetype to Pillow. Fix draw transparent for Pillow

* Add Animated GIF writer

standardize opencv/pillow defaults

* [speedup] Pre-encode supported writers in the convert pool (opencv, pillow)

Move scaling to convert pool
Remove dfaker mask

* Fix default writer

* Bugfixes

* Better custom argparse formatting
2019-04-21 19:19:06 +00:00
khilos
9aaf83aba2 histogram fix
histogram fix
2019-04-03 03:40:07 -05:00
khilos
7ae44c7606 fix on gaussian sharpen 2019-03-12 20:50:18 -05:00
khilos
9bca886905 Update masked.py
seamless error
2019-03-10 00:08:53 -06:00
khilos
cfc0f78cda Create masked.py
reapply
2019-03-09 22:12:15 -06:00
khilos
2c474d8692 Delete masked.py
attribute
2019-03-09 22:10:27 -06:00
kvrooman
4f541e269e prevent transparent images from erroring 2019-02-28 14:02:57 -06:00
kvrooman
1dc8a949fd fixing -dt
fixing -dt issue
2019-02-28 13:53:44 -06:00
khilos
4fdb2afb01 fix draw_transparent 2019-02-26 08:15:23 -06:00
torzdf
2a61aa2bbd bugfix: Remove alpha channel from Avg Color Adjust calculation 2019-02-26 11:59:44 +00:00
bryanlyon
5ff6d520a7
Fix -dt by starting with a 4 channel mask already in place. (#605)
* Fix -dt by starting with a 4 channel mask already in place.

* Adapting reviews from kvrooman

* Correct variable names and ensure actual operation
2019-02-13 12:16:09 -08:00
kvrooman
803ca479b6 fix to bad spacing 2019-02-11 12:10:18 -06:00
kvrooman
d35c4fc615 shape calls 2019-02-11 10:24:32 -06:00
kvrooman
a2f22eedcf width 2019-02-11 10:23:09 -06:00
kvrooman
bf91bc721f auto smooth edges size and clarify naming 2019-02-11 10:21:56 -06:00
torzdf
a719e6655e Remove smoothed mask 2019-02-11 14:28:19 +00:00
torzdf
c817835d6e Add adjust's 'smooth-mask' (smooth-box) back as option 2019-02-11 14:21:01 +00:00
torzdf
48cfcbaee5 Auto apply rect to hull masks. Some minor convert changes 2019-02-11 13:42:50 +00:00
torzdf
cd00859c40
model_refactor (#571) (#572)
* model_refactor (#571)

* original model to new structure

* IAE model to new structure

* OriginalHiRes to new structure

* Fix trainer for different resolutions

* Initial config implementation

* Configparse library added

* improved training data loader

* dfaker model working

* Add logging to training functions

* Non blocking input for cli training

* Add error handling to threads. Add non-mp queues to queue_handler

* Improved Model Building and NNMeta

* refactor lib/models

* training refactor. DFL H128 model Implementation

* Dfaker - use hashes

* Move timelapse. Remove perceptual loss arg

* Update INSTALL.md. Add logger formatting. Update Dfaker training

* DFL h128 partially ported

* Add mask to dfaker (#573)

* Remove old models. Add mask to dfaker

* dfl mask. Make masks selectable in config (#575)

* DFL H128 Mask. Mask type selectable in config.

* remove gan_v2_2

* Creating Input Size config for models

Creating Input Size config for models

Will be used downstream in converters.

Also name change of image_shape to input_shape to clarify ( for future models with potentially different output_shapes)

* Add mask loss options to config

* MTCNN options to config.ini. Remove GAN config. Update USAGE.md

* Add sliders for numerical values in GUI

* Add config plugins menu to gui. Validate config

* Only backup model if loss has dropped. Get training working again

* bugfixes

* Standardise loss printing

* GUI idle cpu fixes. Graph loss fix.

* mutli-gpu logging bugfix

* Merge branch 'staging' into train_refactor

* backup state file

* Crash protection: Only backup if both total losses have dropped

* Port OriginalHiRes_RC4 to train_refactor (OriginalHiRes)

* Load and save model structure with weights

* Slight code update

* Improve config loader. Add subpixel opt to all models. Config to state

* Show samples... wrong input

* Remove AE topology. Add input/output shapes to State

* Port original_villain (birb/VillainGuy) model to faceswap

* Add plugin info to GUI config pages

* Load input shape from state. IAE Config options.

* Fix transform_kwargs.
Coverage to ratio.
Bugfix mask detection

* Suppress keras userwarnings.
Automate zoom.
Coverage_ratio to model def.

* Consolidation of converters & refactor (#574)

* Consolidation of converters & refactor

Initial Upload of alpha

Items
- consolidate convert_mased & convert_adjust into one converter
-add average color adjust to convert_masked
-allow mask transition blur size to be a fixed integer of pixels and a fraction of the facial mask size
-allow erosion/dilation size to be a fixed integer of pixels and a fraction of the facial mask size
-eliminate redundant type conversions to avoid multiple round-off errors
-refactor loops for vectorization/speed
-reorganize for clarity & style changes

TODO
- bug/issues with warping the new face onto a transparent old image...use a cleanup mask for now
- issues with mask border giving black ring at zero erosion .. investigate
- remove GAN ??
- test enlargment factors of umeyama standard face .. match to coverage factor
- make enlargment factor a model parameter
- remove convert_adjusted and referencing code when finished

* Update Convert_Masked.py

default blur size of 2 to match original...
description of enlargement tests
breakout matrxi scaling into def

* Enlargment scale as a cli parameter

* Update cli.py

* dynamic interpolation algorithm

Compute x & y scale factors from the affine matrix on the fly by QR decomp.
Choose interpolation alogrithm for the affine warp based on an upsample or downsample for each image

* input size
input size from config

* fix issues with <1.0 erosion

* Update convert.py

* Update Convert_Adjust.py

more work on the way to merginf

* Clean up help note on sharpen

* cleanup seamless

* Delete Convert_Adjust.py

* Update umeyama.py

* Update training_data.py

* swapping

* segmentation stub

* changes to convert.str

* Update masked.py

* Backwards compatibility fix for models
Get converter running

* Convert:
Move masks to class.
bugfix blur_size
some linting

* mask fix

* convert fixes

- missing facehull_rect re-added
- coverage to %
- corrected coverage logic
- cleanup of gui option ordering

* Update cli.py

* default for blur

* Update masked.py

* added preliminary low_mem version of OriginalHighRes model plugin

* Code cleanup, minor fixes

* Update masked.py

* Update masked.py

* Add dfl mask to convert

* histogram fix & seamless location

* update

* revert

* bugfix: Load actual configuration in gui

* Standardize nn_blocks

* Update cli.py

* Minor code amends

* Fix Original HiRes model

* Add masks to preview output for mask trainers
refactor trainer.__base.py

* Masked trainers converter support

* convert bugfix

* Bugfix: Converter for masked (dfl/dfaker) trainers

* Additional Losses (#592)

* initial upload

* Delete blur.py

* default initializer = He instead of Glorot (#588)

* Allow kernel_initializer to be overridable

* Add ICNR Initializer option for upscale on all models.

* Hopefully fixes RSoDs with original-highres model plugin

* remove debug line

* Original-HighRes model plugin Red Screen of Death fix, take #2

* Move global options to _base. Rename Villain model

* clipnorm and res block biases

* scale the end of res block

* res block

* dfaker pre-activation res

* OHRES pre-activation

* villain pre-activation

* tabs/space in nn_blocks

* fix for histogram with mask all set to zero

* fix to prevent two networks with same name

* GUI: Wider tooltips. Improve TQDM capture

* Fix regex bug

* Convert padding=48 to ratio of image size

* Add size option to alignments tool extract

* Pass through training image size to convert from model

* Convert: Pull training coverage from model

* convert: coverage, blur and erode to percent

* simplify matrix scaling

* ordering of sliders in train

* Add matrix scaling to utils. Use interpolation in lib.aligner transform

* masked.py Import get_matrix_scaling from utils

* fix circular import

* Update masked.py

* quick fix for matrix scaling

* testing thus for now

* tqdm regex capture bugfix

* Minor ammends

* blur size cleanup

* Remove coverage option from convert (Now cascades from model)

* Implement convert for all model types

* Add mask option and coverage option to all existing models

* bugfix for model loading on convert

* debug print removal

* Bugfix for masks in dfl_h128 and iae

* Update preview display. Add preview scaling to cli

* mask notes

* Delete training_data_v2.py

errant file

* training data variables

* Fix timelapse function

* Add new config items to state file for legacy purposes

* Slight GUI tweak

* Raise exception if problem with loaded model

* Add Tensorboard support (Logs stored in model directory)

* ICNR fix

* loss bugfix

* convert bugfix

* Move ini files to config folder. Make TensorBoard optional

* Fix training data for unbalanced inputs/outputs

* Fix config "none" test

* Keep helptext in .ini files when saving config from GUI

* Remove frame_dims from alignments

* Add no-flip and warp-to-landmarks cli options

* Revert OHR to RC4_fix version

* Fix lowmem mode on OHR model

* padding to variable

* Save models in parallel threads

* Speed-up of res_block stability

* Automated Reflection Padding

* Reflect Padding as a training option

Includes auto-calculation of proper padding shapes, input_shapes, output_shapes

Flag included in config now

* rest of reflect padding

* Move TB logging to cli. Session info to state file

* Add session iterations to state file

* Add recent files to menu. GUI code tidy up

* [GUI] Fix recent file list update issue

* Add correct loss names to TensorBoard logs

* Update live graph to use TensorBoard and remove animation

* Fix analysis tab. GUI optimizations

* Analysis Graph popup to Tensorboard Logs

* [GUI] Bug fix for graphing for models with hypens in name

* [GUI] Correctly split loss to tabs during training

* [GUI] Add loss type selection to analysis graph

* Fix store command name in recent files. Switch to correct tab on open

* [GUI] Disable training graph when 'no-logs' is selected

* Fix graphing race condition

* rename original_hires model to unbalanced
2019-02-09 18:35:12 +00:00
torzdf
900eb6c26f
Revert "attempted fix of a crash in apply_new_face function (#586)" (#589)
This reverts commit 3aeb358f44.
2019-01-15 13:28:46 +00:00
d8888
3aeb358f44 attempted fix of a crash in apply_new_face function (#586)
* 1. fixed following error message when using seamless clone of openCV, if new_image
cannot be fitted into base_image in apply_new_face function
2. point structure in openCV should be (x,y) rather than (y,x)

* exchange variable name of maskx, masky so that these name corresponds to
X, Y
2019-01-13 22:49:35 +00:00
torzdf
7f53911453
Logging (#541)
* Convert prints to logger. Further logging improvements. Tidy  up

* Fix system verbosity. Allow SystemExit

* Fix reload extract bug

* Child Traceback handling

* Safer shutdown procedure

* Add shutdown event to queue manager

* landmarks_as_xy > property. GUI notes + linting. Aligner bugfix

* fix FaceFilter. Enable nFilter when no Filter is supplied

* Fix blurry face filter

* Continue on IO error. Better error handling

* Explicitly print stack trace tocrash log

* Windows Multiprocessing bugfix

* Add git info and conda version to crash log

* Windows/Anaconda mp bugfix

* Logging fixes for training
2018-12-04 13:31:49 +00:00
torzdf
0ab340f8ea add draw transparent to adjust. Disable seamless clone with -dt flag 2018-11-09 11:40:24 +00:00
torzdf
2783c27e00
Fix convert-adjust (#531)
* Add dimensions to alignments + refactor

* Add frame_dims + funcs to DetectFaces. Add alignments lib

* Convert Adjust working

* Refactor and tidy up
2018-11-07 20:21:22 +00:00
torzdf
ca63242996
Extraction - Speed improvements (#522) (#523)
* Extraction - Speed improvements (#522)

* Initial Plugin restructure

* Detectors to plugins. Detector speed improvements

* Re-implement dlib aligner, remove models, FAN to TF. Parallel processing

* Update manual, update convert, implement parallel/serial switching

* linting + fix cuda check (setup.py). requirements update keras 2.2.4

* Add extract size option. Fix dlib hog init

* GUI: Increase tooltip width

* Update alignment tool to support new DetectedFace

* Add skip existing faces option

* Fix sort tool to new plugin structure

* remove old align plugin

* fix convert -skip faces bug

* Fix convert skipping no faces frames

* Convert - draw onto transparent layer

* Fix blur threshold bug

* fix skip_faces convert bug

* Fix training
2018-10-27 10:12:08 +01:00