Commit Graph

445 Commits (348e6c424ee2e4616d4211c5016cd137c781180a)
 

Author SHA1 Message Date
rehanbgmi 348e6c424e Improve face swap FPS and blending, add profiling and config options 2025-05-26 15:17:31 +00:00
google-labs-jules[bot] 5f2e54552c feat: Add Windows setup and run scripts, update README
This commit introduces automation scripts for Windows users and updates the README.md accordingly.

New/Modified Windows Scripts:
- setup_windows.bat: New script to automate Python checks, ffmpeg warning, virtual environment (.venv) creation, pip upgrade, and dependency installation.
- run_windows.bat: New script to run the application with CPU execution provider by default, activating .venv.
- run-cuda.bat: Updated to use .venv and pass arguments.
- run-directml.bat: Updated to use .venv and pass arguments.

README.md Changes:
- Updated the "For Windows:" section under "Installation (Manual)" to detail the new automated setup using setup_windows.bat and the revised run scripts.
- Recommended Python 3.10 for Windows for best compatibility.
- Provided updated manual setup notes for Windows, including a PowerShell command for ffmpeg installation and using .venv for consistency.
- Ensured the general Python recommendation in the manual setup prerequisites also mentions Python 3.10.
2025-05-25 18:42:44 +00:00
google-labs-jules[bot] d2794038f7 Okay, I've made a change to prioritize AVFoundation for macOS camera access.
I modified `modules/video_capture.py` so that it will explicitly try using `cv2.CAP_AVFOUNDATION` when initializing `cv2.VideoCapture` on macOS. If AVFoundation fails to open the camera, it will then fall back to the default OpenCV backend.

This adjustment should improve camera compatibility and stability on macOS, especially in situations where the default backend might not be working as expected.
2025-05-25 18:26:15 +00:00
google-labs-jules[bot] 521cad145d fix: Update type hints for Python 3.9 compatibility
Replaces Python 3.10+ type hint syntax (e.g., Frame | None)
with Python 3.9 compatible syntax (e.g., Optional[Frame])
in modules/processors/frame/face_swapper.py.

This resolves a TypeError encountered when running on Python 3.9.
Specifically, the return type of _prepare_warped_source_material_and_mask
was updated.
2025-05-25 18:10:43 +00:00
google-labs-jules[bot] 3d8af5180d fix: Correct IndentationError in modules/ui.py
Removes a duplicated 'if not modules.globals.map_faces:' line within the create_webcam_preview function. This error was causing a syntax issue and preventing the application from running correctly, particularly in webcam mode.
2025-05-25 17:57:58 +00:00
google-labs-jules[bot] 2e617c9401 feat: Add setup and run scripts for macOS
This commit introduces shell scripts to automate the setup process and provide convenient ways to run the application on macOS.

New files added:
- setup_mac.sh: Checks for Python 3.9+ and ffmpeg, creates a virtual environment, installs pip dependencies from requirements.txt.
- run_mac.sh: Runs the application with the CPU execution provider by default.
- run_mac_cpu.sh: Explicitly runs with the CPU execution provider.
- run_mac_coreml.sh: Runs with the CoreML execution provider.
- run_mac_mps.sh: Runs with the MPS execution provider.

The README.md has also been updated with a new section detailing how to use these scripts for macOS users.

These scripts aim to simplify the initial setup and execution of the project on macOS, similar to the .bat files available for Windows.
2025-05-25 17:03:27 +00:00
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 d5a3fb0c47
Merge pull request #1268 from jiacheng-0/main
Update __init__.py
2025-05-13 00:57:09 +08:00
Teo Jia Cheng 9690070399 Update __init__.py 2025-05-13 00:14:49 +08:00
Kenneth Estanislao f3e83b985c
Merge pull request #1210 from KunjShah01/main
Update __init__.py
2025-05-12 15:14:58 +08:00
Kenneth Estanislao e3e3638b79
Merge pull request #1232 from gboeer/patch-1
Add german localization and fix minor typos
2025-05-12 15:14:32 +08:00
VilkkuKoo 4a7874a968
Added a Finnish translation (#1255)
* Added finnish translations

* Fixed a typo
2025-05-11 03:58:53 +05:30
Gordon Böer 75122da389
Create german localization 2025-05-07 13:30:22 +02:00
Gordon Böer 7063bba4b3
fix typos in zh.json 2025-05-07 13:24:54 +02:00
Gordon Böer bdbd7dcfbc
fix typos in ui.py 2025-05-07 13:23:31 +02:00
KUNJ SHAH a64940def7 update 2025-05-05 13:19:46 +00:00
KUNJ SHAH fe4a87e8f2 update 2025-05-05 13:19:29 +00:00
KUNJ SHAH 9ecd2dab83 changes 2025-05-05 13:10:00 +00:00
KUNJ SHAH c9f36eb350
Update __init__.py 2025-05-05 18:29:44 +05:30
Kenneth Estanislao b1f610d432
Update README.md 2025-05-05 08:30:44 +08:00
KRSHH d86c36dc47
Change Download URL 2025-05-04 23:44:01 +05:30
Kenneth Estanislao 532e7c05ee
Merge pull request #1155 from killerlux/patch-1
Added commands for linux
2025-05-03 10:16:02 +08:00
KRSHH 267a273cb2
Download for windows 2025-05-01 22:12:55 +05:30
KRSHH 938aa9eaf1
Delete media/download.png 2025-05-01 22:11:21 +05:30
KRSHH 37bac27302
Add files via upload 2025-05-01 22:10:52 +05:30
killerlux 84836932e6
Added cmomands for linux 2025-04-30 23:09:12 +02:00
Kenneth Estanislao e879d2ca64
Merge pull request #1094 from NeuroDonu/main
fix core.py for face_enhancer and add TRT support in face_enhancer
2025-04-30 22:28:46 +08:00
Kenneth Estanislao 181144ce33
Update requirements.txt 2025-04-20 03:02:23 +08:00
NeuroDonu 890beb0eae
fix & add trt support 2025-04-19 16:03:49 +03:00
NeuroDonu 75b5b096d6
fix 2025-04-19 16:03:24 +03:00
Kenneth Estanislao 40e47a469c
Update requirements.txt 2025-04-19 03:41:00 +08:00
KRSHH 874abb4e59
v2 prebuilt 2025-04-17 09:34:10 +05:30
Kenneth Estanislao 18b259da70 Update requirements.txt
improves speed by 10 to 40%
2025-04-17 02:44:24 +08:00
Kenneth Estanislao 01900dcfb5 Revert "Update metadata.py"
This reverts commit 90d5c28542.
2025-04-17 02:39:05 +08:00
Kenneth Estanislao 07e30fe781 Revert "Update face_swapper.py"
This reverts commit 104d8cf4d6.
2025-04-17 02:03:34 +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
Kenneth Estanislao 90d5c28542 Update metadata.py
- 40% faster than 1.8
- compatible with 50xx GPU
- onnxruntime 1.21
2025-04-13 03:34:10 +08:00
Kenneth Estanislao 104d8cf4d6 Update face_swapper.py
compatibility with inswapper 1.21
2025-04-13 01:13:40 +08:00
KRSHH ac3696b69d
remove prebuilt 2025-04-04 16:02:28 +05:30
Kenneth Estanislao 76fb209e6c
Update README.md 2025-03-29 03:28:22 +08:00
Kenneth Estanislao 2dcd552c4b
Update README.md 2025-03-29 03:23:49 +08:00
Kenneth Estanislao 66248a37b4
Merge pull request #990 from wpoPR/pr/improve-macos-installation-instructions
improve macOS Apple Silicon installation instructions
2025-03-24 18:26:28 +08:00
KRSHH aa9b7ed3b6 Add Tips and Tricks to README 2025-03-22 19:59:40 +05:30
Wesley Oliveira 51a4246050 adding uninstalling conflict python versions
follow sourcery-ai and add a note about uninstalling conflicting Python versions if users encounter issues.
2025-03-21 12:37:21 -03:00
Wesley Oliveira 3f1c072fac improve macOS Apple Silicon installation instructions
Followed the `README` but ran into some errors running it locally. Made a few tweaks and got it working on my M3 PRO. Found this PR (Failing to run on Apple Silicon Mac M3) and thought improving the instructions might help others. Hope this helps!

great tool guys, thx a lot
2025-03-20 16:47:01 -03:00
KRSHH f91f9203e7
Remove Mac Edition Temporarily 2025-03-19 03:00:32 +05:30
Kenneth Estanislao 80477676b4
Merge pull request #980 from aaddyy227/main
Fix face swapping crash due to None face embeddings
2025-03-16 00:03:39 +08:00
Adrian Zimbran c728994e6b fixed import and log message 2025-03-10 23:41:28 +02:00
Adrian Zimbran 65da3be2a4 Fix face swapping crash due to None face embeddings
- Add explicit checks for face detection results (source and target faces).
- Handle cases when face embeddings are not available, preventing AttributeError.
- Provide meaningful log messages for easier debugging in future scenarios.
2025-03-10 23:31:56 +02:00