Commit Graph

40 Commits (52b108089d7f40802748ddaf6dd3931ccb1943a5)

Author SHA1 Message Date
google-labs-jules[bot] 37486f03e7 feat: Implement hair swapping and enhance realism
This commit introduces the capability to swap hair along with the face from a source image to a target image/video or live webcam feed.

Key changes include:

1.  **Hair Segmentation:**
    - Integrated the `isjackwild/segformer-b0-finetuned-segments-skin-hair-clothing` model from Hugging Face using the `transformers` library.
    - Added `modules/hair_segmenter.py` with a `segment_hair` function to produce a binary hair mask from an image.
    - Updated `requirements.txt` with `transformers`.

2.  **Combined Face-Hair Mask:**
    - Implemented `create_face_and_hair_mask` in `modules/processors/frame/face_swapper.py` to generate a unified mask for both face (from landmarks) and segmented hair from the source image.

3.  **Enhanced Swapping Logic:**
    - Modified `swap_face` and related processing functions (`process_frame`, `process_frame_v2`, `process_frames`, `process_image`) to utilize the full source image (`source_frame_full`).
    - The `swap_face` function now performs the standard face swap and then:
        - Segments hair from the `source_frame_full`.
        - Warps the hair and its mask to the target face's position using an affine transformation estimated from facial landmarks.
        - Applies color correction (`apply_color_transfer`) to the warped hair.
        - Blends the hair onto the target frame, preferably using `cv2.seamlessClone` for improved realism.
    - Existing mouth mask logic is preserved and applied to the final composited frame.

4.  **Webcam Integration:**
    - Updated the webcam processing loop in `modules/ui.py` (`create_webcam_preview`) to correctly load and pass the `source_frame_full` to the frame processors.
    - This enables hair swapping in live webcam mode.
    - Added error handling for source image loading in webcam mode.

This set of changes addresses your request for more realistic face swaps that include hair. Further testing and refinement of blending parameters may be beneficial for optimal results across all scenarios.
2025-05-21 18:47:31 +00:00
Kenneth Estanislao 181144ce33
Update requirements.txt 2025-04-20 03:02:23 +08:00
Kenneth Estanislao 40e47a469c
Update requirements.txt 2025-04-19 03:41:00 +08:00
Kenneth Estanislao 18b259da70 Update requirements.txt
improves speed by 10 to 40%
2025-04-17 02:44:24 +08:00
Kenneth Estanislao 3dda4f2179
Update requirements.txt 2025-04-14 17:45:07 +08:00
Kenneth Estanislao 71735e4f60 Update requirements.txt
update requirements.txt
2025-04-13 03:36:51 +08:00
Harmeet Singh 1fad1cd43a
Update requirements.txt
Made changes for apple silicon. 

Or getting
ERROR: Could not find a version that satisfies the requirement torch==2.5.1+cu118 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.6.0)
ERROR: No matching distribution found for torch==2.5.1+cu118
2025-02-11 18:44:23 +05:30
Kenneth Estanislao 2f67e2f159
Update requirements.txt 2025-02-09 14:17:49 +08:00
Kenneth Estanislao a3af249ea6
Update requirements.txt 2025-02-07 19:31:02 +08:00
Kenneth Estanislao 5bc3ada632
Update requirements.txt 2025-02-06 15:37:55 +08:00
Kenneth Estanislao 4d2aea37b7
Update requirements.txt 2025-02-06 00:43:20 +08:00
carpusherw f3adfd194d Fix requirements.txt 2025-02-05 12:16:08 +08:00
Kenneth Estanislao e5f04cf917 Revert "Update requirements.txt"
This reverts commit d45dedc9a6.
2025-02-05 12:08:19 +08:00
Kenneth Estanislao 67394a3157 Revert "Update requirements.txt"
This reverts commit f82cebf86e.
2025-02-05 12:08:10 +08:00
Kenneth Estanislao f82cebf86e
Update requirements.txt 2025-02-03 18:03:27 +08:00
Kenneth Estanislao d45dedc9a6
Update requirements.txt 2025-02-03 16:38:18 +08:00
Kenneth Estanislao e862ff1456
Update requirements.txt
updated from CUDA 11.8 to CUDA 12.1
2025-02-01 12:21:55 +08:00
Kenneth Estanislao 79e1ce5093 Update requirements.txt
update pillow

In _imagingcms.c in Pillow before 10.3.0, a buffer overflow exists because strcpy is used instead of strncpy.
2025-01-28 14:22:05 +08:00
KRSHH d8a5cdbc19
removed comment from requirements.txt 2025-01-03 19:21:39 +05:30
Makaru 82d5d34912
Update requirements.txt 2025-01-03 20:42:38 +08:00
Makaru 60e82ea200
Update requirements.txt 2025-01-03 20:26:54 +08:00
KRSHH 7fb6b54c0b
Add Pygrabber 2024-12-13 19:05:38 +05:30
KRSHH c75f941716
Removed Package Repetition 2024-10-22 17:24:06 +05:30
Kenneth Estanislao 95742c8fd5 Merge pull request #686 from GhoulBoii/main
BOUNTY - Webcam Merged (tested)
2024-10-04 14:46:06 +08:00
Kenneth Estanislao bbfdf83267
Update requirements.txt 2024-09-19 00:38:41 +08:00
bkosowski 069e9b46e6 Downgrade onnxruntime version to 1.16.0 to fix requirements installation 2024-09-18 15:58:50 +02:00
Kenneth Estanislao c6e00796c8 Merge pull request #588 from KRSHH/main
Enhance UI with drag and drop, modern look using customtkinter, and improved webcam mapping
2024-09-16 23:30:12 +08:00
Kenneth Estanislao 9bf2080ac8 Revert "Merge pull request #588 from KRSHH/main"
This reverts commit 8c6d0134a8, reversing
changes made to 621c3f035e.
2024-09-16 22:18:59 +08:00
K b505ae7b90
Add customtkinter in requirements.txt 2024-09-16 00:33:49 +05:30
CH. Krish 373134cfa1
Add tkinterdnd2 to requirements.txt 2024-09-15 23:02:25 +05:30
David Girón 99704f3a18
fix: requirements ResolutionImpossible 2024-08-30 09:07:40 +02:00
dependabot[bot] 5384ea6236
Bump tensorflow from 2.12.0 to 2.12.1
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.12.0 to 2.12.1.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.12.0...v2.12.1)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-31 03:29:52 +00:00
SamuraiBarbi 63793e9034
Update requirements.txt
Changing numpy version requirement to 1.23.5 due to the current requirements for the package version have conflicting dependencies.
2024-07-29 15:35:02 -04:00
Joep de Jong db97940adb
Fix face_enhancer issues 2024-07-07 14:33:32 +02:00
Kenneth Estanislao c21ebb1b67 Update requirements.txt 2024-07-05 01:07:18 +08:00
Kenneth Estanislao 70abd7df17 some minor updates
Just updated the modules to make it a bit secure/faster.
2024-05-08 00:56:19 +08:00
Kenneth Estanislao eb6ec778cf Update requirements.txt
loosen the numpy version for it to be more elastic
2024-01-15 23:07:39 +08:00
Kenneth Estanislao 2a65f3d3b3 Update requirements.txt
realigning for masterfusion
2023-12-14 22:36:50 +08:00
Kenneth Estanislao 7af8c7e493 updated some requirements 2023-12-14 14:59:22 +08:00
Kenneth Estanislao 4f44d90e08 changes in the .gitignore 2023-09-25 17:30:21 +08:00