Commit Graph

61 Commits

Author SHA1 Message Date
torzdf
70c064ca7d Minor fixups and linting 2024-04-03 15:14:32 +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
2a3845152b bugfix: Convert - patch writer. Fix TIFF metadata 2024-01-07 14:58:48 +00: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
8388241db9 bugfix: Always load images as 3 channel color 2023-09-01 22:36:31 +01:00
torzdf
5d00025884 bugfix: error loading images with special chars 2023-08-27 02:15:55 +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
Ching-Yuan Huang
8f08832c0f
Fixed UnicodeDecodeError (#1316)
* Update image.py

use encoding="utf8", in line303, 413, 524, 803, 1459
fix UnicodeDecodeError: 'cp950' codec can't decode byte 0x83 in position 52: illegal multibyte sequence

* Update image.py

fix : ValueError: binary mode doesn't take an encoding argument

---------

Co-authored-by: Ching-Yuan Huang <47504492+che610369@users.noreply.github.com>
2023-06-16 15:30:05 +01:00
torzdf
8a5ee6d9bf Bugfix: Patch extract memory leak in batch mode 2023-02-10 15:52:34 +00:00
torzdf
a1ef5edd39 tests:
- unit test: tools.alignments.media
  - Add mypy test
  - Typing fixes
2023-01-21 00:41:18 +00:00
torzdf
48c886b3dc Allow decoding errors 2022-12-18 19:02:17 +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
f5fa5b4337 Extract filter: Allow saving of filtered images 2022-09-19 00:13:41 +01:00
torzdf
98d01760e4 Overhaul sort:
- Standardize image data reading and writing
  - Optimize loading (just one pass required)
  - Make all sort groups binnable (to greater or lesser results)
  - Add sort by pitch
  - Deprecate multiple options
  - linting, docs + locales
2022-09-13 13:08:59 +01:00
torzdf
7da2cc3dd2 Training - Use custom preview pop-out 2022-09-07 11:49:52 +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
a5a598539c Manual tool - More robust handling of videos with duped frames 2022-05-18 00:30:56 +01:00
torzdf
e7fbcc1eeb bugfix: lib.image ImageIO. Ensure unique queues are created 2021-05-16 13:08:12 +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
mark-gargan
d0e9990870
Adding some defensive code to better identify which image is causing … (#1133)
* Adding some defensive code to better identify which image is causing issue when permission error is encountered.
2021-03-18 12:13:12 +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
2a4cfa0262 bugfix - lib.image.update_existing_metadata
- Correctly close png file
2021-02-24 10:50:28 +00:00
torzdf
0401dd15a5 tools.alignments - Update png header when removing faces 2021-02-23 19:23:11 +00:00
torzdf
a5e666fb79 Bugfix - Remove ability to execute arbritary code from png header data 2021-02-18 11:18:11 +00:00
torzdf
b20ad26b8b lib.image - png header, handle pre-existing iTXt entries on load 2021-02-15 16:46:17 +00:00
torzdf
02b2ec25c0 minor fix 2021-02-15 12:47:24 +00:00
torzdf
14564bbc85 typofix 2021-02-15 12:46:42 +00:00
torzdf
407b71377f Bugfix: lib.image.read_image_meta - Read file for dimensions if not a png 2021-02-15 12:27:00 +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
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
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
1363fa85eb lib.image - More information on image read errors 2020-08-25 10:25:12 +01:00
torzdf
0e63c2967b documentation update 2020-07-25 09:09:38 +01:00
torzdf
03d2d179a9 scripts.extract - Save jpg thumbnails to alignments file 2020-07-09 11:41:03 +00:00
torzdf
f19a04505c Core updates 2020-06-27 18:48:50 +00:00
torzdf
8d20fb8e8c Bugfix - lib.image - Make patched ffmpeg reader optional 2020-03-29 11:43:52 +01:00
torzdf
3d88630f4f
Core Update (#995)
* lib.alignments - Add Video Meta Data methods

* lib.image - Monkey Path ImageIO for video scanning
2020-03-23 13:15:21 +00:00
torzdf
ca4060f45f lib.image.read_image_batch - Force deterministic return order 2020-01-25 19:33:50 +00:00
torzdf
4e654eb328 plugins.train.trainer - Speed up mask caching 2019-12-09 12:50:27 +00:00
torzdf
efb0aeab91 Merge branch 'master' into staging 2019-12-08 10:54:50 +00:00
torzdf
ac1cf8fbe9 lib.alignments: improve re-extraction speed by 500% 2019-12-08 10:54:26 +00:00
torzdf
47ab001b0d Merge branch 'master' into staging 2019-12-07 19:25:30 +00:00
torzdf
8f21bb073d bugfix: lib.image - Get video filelist correctly 2019-12-07 19:25:17 +00:00
torzdf
ccddb553bc Merge branch 'master' into staging 2019-12-07 18:23:03 +00:00
torzdf
aca1f44472 bugfix - Extract - Generate dummy video filenames correctly 2019-12-07 18:14:32 +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
9db67cee43 bugfix - ImagesSaver - Auto prepend destination folder 2019-11-29 12:13:06 +00:00
torzdf
57b24dfedb Bugfix: Extract - Fix serial processing 2019-11-14 12:31:13 +00:00