Spaces:
Configuration error
Configuration error
Commit
•
efda462
1
Parent(s):
49c7b85
Upload 10 files
Browse files- .editorconfig +8 -0
- .flake8 +3 -0
- .gitignore +3 -0
- LICENSE.md +3 -0
- README.md +113 -13
- facefusion.ini +74 -0
- install.py +12 -0
- mypy.ini +7 -0
- requirements.txt +9 -0
- run.py +6 -0
.editorconfig
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
root = true
|
2 |
+
|
3 |
+
[*]
|
4 |
+
end_of_line = lf
|
5 |
+
insert_final_newline = true
|
6 |
+
indent_size = 4
|
7 |
+
indent_style = tab
|
8 |
+
trim_trailing_whitespace = true
|
.flake8
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
[flake8]
|
2 |
+
select = E3, E4, F
|
3 |
+
per-file-ignores = facefusion/core.py:E402
|
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
.assets
|
2 |
+
.idea
|
3 |
+
.vscode
|
LICENSE.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
MIT license
|
2 |
+
|
3 |
+
Copyright (c) 2024 Henry Ruhs
|
README.md
CHANGED
@@ -1,13 +1,113 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FaceFusion
|
2 |
+
==========
|
3 |
+
|
4 |
+
> Next generation face swapper and enhancer.
|
5 |
+
|
6 |
+
[![Build Status](https://img.shields.io/github/actions/workflow/status/facefusion/facefusion/ci.yml.svg?branch=master)](https://github.com/facefusion/facefusion/actions?query=workflow:ci)
|
7 |
+
![License](https://img.shields.io/badge/license-MIT-green)
|
8 |
+
|
9 |
+
|
10 |
+
Preview
|
11 |
+
-------
|
12 |
+
|
13 |
+
![Preview](https://raw.githubusercontent.com/facefusion/facefusion/master/.github/preview.png?sanitize=true)
|
14 |
+
|
15 |
+
|
16 |
+
Installation
|
17 |
+
------------
|
18 |
+
|
19 |
+
Be aware, the [installation](https://docs.facefusion.io/installation) needs technical skills and is not recommended for beginners. In case you are not comfortable using a terminal, our [Windows Installer](https://buymeacoffee.com/henryruhs/e/251939) can have you up and running in minutes.
|
20 |
+
|
21 |
+
|
22 |
+
Usage
|
23 |
+
-----
|
24 |
+
|
25 |
+
Run the command:
|
26 |
+
|
27 |
+
```
|
28 |
+
python run.py [options]
|
29 |
+
|
30 |
+
options:
|
31 |
+
-h, --help show this help message and exit
|
32 |
+
-c CONFIG_PATH, --config CONFIG_PATH choose the config file to override defaults
|
33 |
+
-s SOURCE_PATHS, --source SOURCE_PATHS choose single or multiple source images or audios
|
34 |
+
-t TARGET_PATH, --target TARGET_PATH choose single target image or video
|
35 |
+
-o OUTPUT_PATH, --output OUTPUT_PATH specify the output file or directory
|
36 |
+
-v, --version show program's version number and exit
|
37 |
+
|
38 |
+
misc:
|
39 |
+
--force-download force automate downloads and exit
|
40 |
+
--skip-download omit automate downloads and remote lookups
|
41 |
+
--headless run the program without a user interface
|
42 |
+
--log-level {error,warn,info,debug} adjust the message severity displayed in the terminal
|
43 |
+
|
44 |
+
execution:
|
45 |
+
--execution-device-id EXECUTION_DEVICE_ID specify the device used for processing
|
46 |
+
--execution-providers EXECUTION_PROVIDERS [EXECUTION_PROVIDERS ...] accelerate the model inference using different providers (choices: cpu, ...)
|
47 |
+
--execution-thread-count [1-128] specify the amount of parallel threads while processing
|
48 |
+
--execution-queue-count [1-32] specify the amount of frames each thread is processing
|
49 |
+
|
50 |
+
memory:
|
51 |
+
--video-memory-strategy {strict,moderate,tolerant} balance fast frame processing and low VRAM usage
|
52 |
+
--system-memory-limit [0-128] limit the available RAM that can be used while processing
|
53 |
+
|
54 |
+
face analyser:
|
55 |
+
--face-analyser-order {left-right,right-left,top-bottom,bottom-top,small-large,large-small,best-worst,worst-best} specify the order in which the face analyser detects faces
|
56 |
+
--face-analyser-age {child,teen,adult,senior} filter the detected faces based on their age
|
57 |
+
--face-analyser-gender {female,male} filter the detected faces based on their gender
|
58 |
+
--face-detector-model {many,retinaface,scrfd,yoloface,yunet} choose the model responsible for detecting the face
|
59 |
+
--face-detector-size FACE_DETECTOR_SIZE specify the size of the frame provided to the face detector
|
60 |
+
--face-detector-score [0.0-0.95] filter the detected faces base on the confidence score
|
61 |
+
--face-landmarker-score [0.0-0.95] filter the detected landmarks base on the confidence score
|
62 |
+
|
63 |
+
face selector:
|
64 |
+
--face-selector-mode {many,one,reference} use reference based tracking or simple matching
|
65 |
+
--reference-face-position REFERENCE_FACE_POSITION specify the position used to create the reference face
|
66 |
+
--reference-face-distance [0.0-1.45] specify the desired similarity between the reference face and target face
|
67 |
+
--reference-frame-number REFERENCE_FRAME_NUMBER specify the frame used to create the reference face
|
68 |
+
|
69 |
+
face mask:
|
70 |
+
--face-mask-types FACE_MASK_TYPES [FACE_MASK_TYPES ...] mix and match different face mask types (choices: box, occlusion, region)
|
71 |
+
--face-mask-blur [0.0-0.95] specify the degree of blur applied the box mask
|
72 |
+
--face-mask-padding FACE_MASK_PADDING [FACE_MASK_PADDING ...] apply top, right, bottom and left padding to the box mask
|
73 |
+
--face-mask-regions FACE_MASK_REGIONS [FACE_MASK_REGIONS ...] choose the facial features used for the region mask (choices: skin, left-eyebrow, right-eyebrow, left-eye, right-eye, glasses, nose, mouth, upper-lip, lower-lip)
|
74 |
+
|
75 |
+
frame extraction:
|
76 |
+
--trim-frame-start TRIM_FRAME_START specify the the start frame of the target video
|
77 |
+
--trim-frame-end TRIM_FRAME_END specify the the end frame of the target video
|
78 |
+
--temp-frame-format {bmp,jpg,png} specify the temporary resources format
|
79 |
+
--keep-temp keep the temporary resources after processing
|
80 |
+
|
81 |
+
output creation:
|
82 |
+
--output-image-quality [0-100] specify the image quality which translates to the compression factor
|
83 |
+
--output-image-resolution OUTPUT_IMAGE_RESOLUTION specify the image output resolution based on the target image
|
84 |
+
--output-video-encoder {libx264,libx265,libvpx-vp9,h264_nvenc,hevc_nvenc,h264_amf,hevc_amf} specify the encoder use for the video compression
|
85 |
+
--output-video-preset {ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow} balance fast video processing and video file size
|
86 |
+
--output-video-quality [0-100] specify the video quality which translates to the compression factor
|
87 |
+
--output-video-resolution OUTPUT_VIDEO_RESOLUTION specify the video output resolution based on the target video
|
88 |
+
--output-video-fps OUTPUT_VIDEO_FPS specify the video output fps based on the target video
|
89 |
+
--skip-audio omit the audio from the target video
|
90 |
+
|
91 |
+
frame processors:
|
92 |
+
--frame-processors FRAME_PROCESSORS [FRAME_PROCESSORS ...] load a single or multiple frame processors. (choices: face_debugger, face_enhancer, face_swapper, frame_colorizer, frame_enhancer, lip_syncer, ...)
|
93 |
+
--face-debugger-items FACE_DEBUGGER_ITEMS [FACE_DEBUGGER_ITEMS ...] load a single or multiple frame processors (choices: bounding-box, face-landmark-5, face-landmark-5/68, face-landmark-68, face-landmark-68/5, face-mask, face-detector-score, face-landmarker-score, age, gender)
|
94 |
+
--face-enhancer-model {codeformer,gfpgan_1.2,gfpgan_1.3,gfpgan_1.4,gpen_bfr_256,gpen_bfr_512,gpen_bfr_1024,gpen_bfr_2048,restoreformer_plus_plus} choose the model responsible for enhancing the face
|
95 |
+
--face-enhancer-blend [0-100] blend the enhanced into the previous face
|
96 |
+
--face-swapper-model {blendswap_256,inswapper_128,inswapper_128_fp16,simswap_256,simswap_512_unofficial,uniface_256} choose the model responsible for swapping the face
|
97 |
+
--frame-colorizer-model {ddcolor,ddcolor_artistic,deoldify,deoldify_artistic,deoldify_stable} choose the model responsible for colorizing the frame
|
98 |
+
--frame-colorizer-blend [0-100] blend the colorized into the previous frame
|
99 |
+
--frame-colorizer-size {192x192,256x256,384x384,512x512} specify the size of the frame provided to the frame colorizer
|
100 |
+
--frame-enhancer-model {clear_reality_x4,lsdir_x4,nomos8k_sc_x4,real_esrgan_x2,real_esrgan_x2_fp16,real_esrgan_x4,real_esrgan_x4_fp16,real_hatgan_x4,span_kendata_x4,ultra_sharp_x4} choose the model responsible for enhancing the frame
|
101 |
+
--frame-enhancer-blend [0-100] blend the enhanced into the previous frame
|
102 |
+
--lip-syncer-model {wav2lip_gan} choose the model responsible for syncing the lips
|
103 |
+
|
104 |
+
uis:
|
105 |
+
--open-browser open the browser once the program is ready
|
106 |
+
--ui-layouts UI_LAYOUTS [UI_LAYOUTS ...] launch a single or multiple UI layouts (choices: benchmark, default, webcam, ...)
|
107 |
+
```
|
108 |
+
|
109 |
+
|
110 |
+
Documentation
|
111 |
+
-------------
|
112 |
+
|
113 |
+
Read the [documentation](https://docs.facefusion.io) for a deep dive.
|
facefusion.ini
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[general]
|
2 |
+
source_paths =
|
3 |
+
target_path =
|
4 |
+
output_path =
|
5 |
+
|
6 |
+
[misc]
|
7 |
+
force_download =
|
8 |
+
skip_download =
|
9 |
+
headless =
|
10 |
+
log_level =
|
11 |
+
|
12 |
+
[execution]
|
13 |
+
execution_device_id =
|
14 |
+
execution_providers =
|
15 |
+
execution_thread_count =
|
16 |
+
execution_queue_count =
|
17 |
+
|
18 |
+
[memory]
|
19 |
+
video_memory_strategy =
|
20 |
+
system_memory_limit =
|
21 |
+
|
22 |
+
[face_analyser]
|
23 |
+
face_analyser_order =
|
24 |
+
face_analyser_age =
|
25 |
+
face_analyser_gender =
|
26 |
+
face_detector_model =
|
27 |
+
face_detector_size =
|
28 |
+
face_detector_score =
|
29 |
+
face_landmarker_score =
|
30 |
+
|
31 |
+
[face_selector]
|
32 |
+
face_selector_mode =
|
33 |
+
reference_face_position =
|
34 |
+
reference_face_distance =
|
35 |
+
reference_frame_number =
|
36 |
+
|
37 |
+
[face_mask]
|
38 |
+
face_mask_types =
|
39 |
+
face_mask_blur =
|
40 |
+
face_mask_padding =
|
41 |
+
face_mask_regions =
|
42 |
+
|
43 |
+
[frame_extraction]
|
44 |
+
trim_frame_start =
|
45 |
+
trim_frame_end =
|
46 |
+
temp_frame_format =
|
47 |
+
keep_temp =
|
48 |
+
|
49 |
+
[output_creation]
|
50 |
+
output_image_quality =
|
51 |
+
output_image_resolution =
|
52 |
+
output_video_encoder =
|
53 |
+
output_video_preset =
|
54 |
+
output_video_quality =
|
55 |
+
output_video_resolution =
|
56 |
+
output_video_fps =
|
57 |
+
skip_audio =
|
58 |
+
|
59 |
+
[frame_processors]
|
60 |
+
frame_processors =
|
61 |
+
face_debugger_items =
|
62 |
+
face_enhancer_model =
|
63 |
+
face_enhancer_blend =
|
64 |
+
face_swapper_model =
|
65 |
+
frame_colorizer_model =
|
66 |
+
frame_colorizer_blend =
|
67 |
+
frame_colorizer_size =
|
68 |
+
frame_enhancer_model =
|
69 |
+
frame_enhancer_blend =
|
70 |
+
lip_syncer_model =
|
71 |
+
|
72 |
+
[uis]
|
73 |
+
open_browser =
|
74 |
+
ui_layouts =
|
install.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
|
3 |
+
import os
|
4 |
+
import subprocess
|
5 |
+
|
6 |
+
os.environ['PIP_BREAK_SYSTEM_PACKAGES'] = '1'
|
7 |
+
subprocess.call([ 'pip', 'install', 'inquirer', '-q' ])
|
8 |
+
|
9 |
+
from facefusion import installer
|
10 |
+
|
11 |
+
if __name__ == '__main__':
|
12 |
+
installer.cli()
|
mypy.ini
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[mypy]
|
2 |
+
check_untyped_defs = True
|
3 |
+
disallow_any_generics = True
|
4 |
+
disallow_untyped_calls = True
|
5 |
+
disallow_untyped_defs = True
|
6 |
+
ignore_missing_imports = True
|
7 |
+
strict_optional = False
|
requirements.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
filetype==1.2.0
|
2 |
+
gradio==3.50.2
|
3 |
+
numpy==1.26.4
|
4 |
+
onnx==1.16.0
|
5 |
+
onnxruntime==1.17.3
|
6 |
+
opencv-python==4.9.0.80
|
7 |
+
psutil==5.9.8
|
8 |
+
tqdm==4.66.4
|
9 |
+
scipy==1.13.0
|
run.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
|
3 |
+
from facefusion import core
|
4 |
+
|
5 |
+
if __name__ == '__main__':
|
6 |
+
core.cli()
|