Spaces:
Configuration error
Configuration error
Upload 4 files
Browse files- README.md +478 -0
- README_RU.md +487 -0
- pyproject.toml +15 -0
- reactor_patcher.py +161 -0
README.md
ADDED
@@ -0,0 +1,478 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div align="center">
|
2 |
+
|
3 |
+
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_EN.png?raw=true" alt="logo" width="180px"/>
|
4 |
+
|
5 |
+

|
6 |
+
|
7 |
+
<!--<sup>
|
8 |
+
<font color=brightred>
|
9 |
+
|
10 |
+
## !!! [Important Update](#latestupdate) !!!<br>Don't forget to add the Node again in existing workflows
|
11 |
+
|
12 |
+
</font>
|
13 |
+
</sup>-->
|
14 |
+
|
15 |
+
<a href="https://boosty.to/artgourieff" target="_blank">
|
16 |
+
<img src="https://lovemet.ru/img/boosty.jpg" width="108" alt="Support Me on Boosty"/>
|
17 |
+
<br>
|
18 |
+
<sup>
|
19 |
+
Support This Project
|
20 |
+
</sup>
|
21 |
+
</a>
|
22 |
+
|
23 |
+
<hr>
|
24 |
+
|
25 |
+
[](https://github.com/Gourieff/comfyui-reactor-node/commits/main)
|
26 |
+

|
27 |
+
[](https://github.com/Gourieff/comfyui-reactor-node/issues?cacheSeconds=0)
|
28 |
+
[](https://github.com/Gourieff/comfyui-reactor-node/issues?q=is%3Aissue+is%3Aclosed)
|
29 |
+

|
30 |
+
|
31 |
+
English | [Русский](/README_RU.md)
|
32 |
+
|
33 |
+
# ReActor Node for ComfyUI
|
34 |
+
|
35 |
+
</div>
|
36 |
+
|
37 |
+
### The Fast and Simple Face Swap Extension Node for ComfyUI, based on [ReActor](https://github.com/Gourieff/sd-webui-reactor) SD-WebUI Face Swap Extension
|
38 |
+
|
39 |
+
> This Node goes without NSFW filter (uncensored, use it on your own [responsibility](#disclaimer))
|
40 |
+
|
41 |
+
<div align="center">
|
42 |
+
|
43 |
+
---
|
44 |
+
[**What's new**](#latestupdate) | [**Installation**](#installation) | [**Usage**](#usage) | [**Troubleshooting**](#troubleshooting) | [**Updating**](#updating) | [**Disclaimer**](#disclaimer) | [**Credits**](#credits) | [**Note!**](#note)
|
45 |
+
|
46 |
+
---
|
47 |
+
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<div align="center">
|
51 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/demo.gif?raw=true" alt="demo" width="100%"/>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<a name="latestupdate">
|
55 |
+
|
56 |
+
## What's new in the latest update
|
57 |
+
|
58 |
+
### 0.5.2 <sub><sup>BETA1</sup></sub>
|
59 |
+
|
60 |
+
- ReSwapper models support. Although Inswapper still has the best similarity, but ReSwapper is evolving - thanks @somanchiu https://github.com/somanchiu/ReSwapper for the ReSwapper models and the ReSwapper project! This is a good step for the Community in the Inswapper's alternative creation!
|
61 |
+
|
62 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.2-whatsnew-03.jpg?raw=true" alt="0.5.2-whatsnew-03" width="100%"/>
|
63 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.2-whatsnew-04.jpg?raw=true" alt="0.5.2-whatsnew-04" width="100%"/>
|
64 |
+
|
65 |
+
You can download ReSwapper models here:
|
66 |
+
https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models<br>
|
67 |
+
Just put them into the "models/reswapper" directory.
|
68 |
+
|
69 |
+
### 0.5.2 <sub><sup>ALPHA1</sup></sub>
|
70 |
+
|
71 |
+
- New node "Unload ReActor Models" - is useful for complex WFs when you need to free some VRAM utilized by ReActor
|
72 |
+
|
73 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.2-whatsnew-01.jpg?raw=true" alt="0.5.2-whatsnew-01" width="100%"/>
|
74 |
+
|
75 |
+
- Support of ORT CoreML and ROCM EPs, just install onnxruntime version you need
|
76 |
+
- Install script improvements to install latest versions of ORT-GPU
|
77 |
+
|
78 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.2-whatsnew-02.jpg?raw=true" alt="0.5.2-whatsnew-02" width="100%"/>
|
79 |
+
|
80 |
+
<details>
|
81 |
+
<summary><a>Previous versions</a></summary>
|
82 |
+
|
83 |
+
### 0.5.1
|
84 |
+
|
85 |
+
- Support of GPEN 1024/2048 restoration models (available in the HF dataset https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models)
|
86 |
+
- ReActorFaceBoost Node - an attempt to improve the quality of swapped faces. The idea is to restore and scale the swapped face (according to the `face_size` parameter of the restoration model) BEFORE pasting it to the target image (via inswapper algorithms), more information is [here (PR#321)](https://github.com/Gourieff/comfyui-reactor-node/pull/321)
|
87 |
+
|
88 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.1-whatsnew-01.jpg?raw=true" alt="0.5.1-whatsnew-01" width="100%"/>
|
89 |
+
|
90 |
+
[Full size demo preview](https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.1-whatsnew-02.png)
|
91 |
+
|
92 |
+
- Sorting facemodels alphabetically
|
93 |
+
- A lot of fixes and improvements
|
94 |
+
|
95 |
+
### [0.5.0 <sub><sup>BETA4</sup></sub>](https://github.com/Gourieff/comfyui-reactor-node/releases/tag/v0.5.0)
|
96 |
+
|
97 |
+
- Spandrel lib support for GFPGAN
|
98 |
+
|
99 |
+
### 0.5.0 <sub><sup>BETA3</sup></sub>
|
100 |
+
|
101 |
+
- Fixes: "RAM issue", "No detection" for MaskingHelper
|
102 |
+
|
103 |
+
### 0.5.0 <sub><sup>BETA2</sup></sub>
|
104 |
+
|
105 |
+
- You can now build a blended face model from a batch of face models you already have, just add the "Make Face Model Batch" node to your workflow and connect several models via "Load Face Model"
|
106 |
+
- Huge performance boost of the image analyzer's module! 10x speed up! Working with videos is now a pleasure!
|
107 |
+
|
108 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-05.png?raw=true" alt="0.5.0-whatsnew-05" width="100%"/>
|
109 |
+
|
110 |
+
### 0.5.0 <sub><sup>BETA1</sup></sub>
|
111 |
+
|
112 |
+
- SWAPPED_FACE output for the Masking Helper Node
|
113 |
+
- FIX: Empty A-channel for Masking Helper IMAGE output (causing errors with some nodes) was removed
|
114 |
+
|
115 |
+
### 0.5.0 <sub><sup>ALPHA1</sup></sub>
|
116 |
+
|
117 |
+
- ReActorBuildFaceModel Node got "face_model" output to provide a blended face model directly to the main Node:
|
118 |
+
|
119 |
+
Basic workflow [💾](https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/workflows/ReActor--Build-Blended-Face-Model--v2.json)
|
120 |
+
|
121 |
+
- Face Masking feature is available now, just add the "ReActorMaskHelper" Node to the workflow and connect it as shown below:
|
122 |
+
|
123 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-01.jpg?raw=true" alt="0.5.0-whatsnew-01" width="100%"/>
|
124 |
+
|
125 |
+
If you don't have the "face_yolov8m.pt" Ultralytics model - you can download it from the [Assets](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/detection/bbox/face_yolov8m.pt) and put it into the "ComfyUI\models\ultralytics\bbox" directory
|
126 |
+
<br>
|
127 |
+
As well as ["sam_vit_b_01ec64.pth"](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/sams/sam_vit_b_01ec64.pth) model - download (if you don't have it) and put it into the "ComfyUI\models\sams" directory;
|
128 |
+
|
129 |
+
Use this Node to gain the best results of the face swapping process:
|
130 |
+
|
131 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-02.jpg?raw=true" alt="0.5.0-whatsnew-02" width="100%"/>
|
132 |
+
|
133 |
+
- ReActorImageDublicator Node - rather useful for those who create videos, it helps to duplicate one image to several frames to use them with VAE Encoder (e.g. live avatars):
|
134 |
+
|
135 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-03.jpg?raw=true" alt="0.5.0-whatsnew-03" width="100%"/>
|
136 |
+
|
137 |
+
- ReActorFaceSwapOpt (a simplified version of the Main Node) + ReActorOptions Nodes to set some additional options such as (new) "input/source faces separate order". Yes! You can now set the order of faces in the index in the way you want ("large to small" goes by default)!
|
138 |
+
|
139 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-04.jpg?raw=true" alt="0.5.0-whatsnew-04" width="100%"/>
|
140 |
+
|
141 |
+
- Little speed boost when analyzing target images (unfortunately it is still quite slow in compare to swapping and restoring...)
|
142 |
+
|
143 |
+
### [0.4.2](https://github.com/Gourieff/comfyui-reactor-node/releases/tag/v0.4.2)
|
144 |
+
|
145 |
+
- GPEN-BFR-512 and RestoreFormer_Plus_Plus face restoration models support
|
146 |
+
|
147 |
+
You can download models here: https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models
|
148 |
+
<br>Put them into the `ComfyUI\models\facerestore_models` folder
|
149 |
+
|
150 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.2-whatsnew-04.jpg?raw=true" alt="0.4.2-whatsnew-04" width="100%"/>
|
151 |
+
|
152 |
+
- Due to popular demand - you can now blend several images with persons into one face model file and use it with "Load Face Model" Node or in SD WebUI as well;
|
153 |
+
|
154 |
+
Experiment and create new faces or blend faces of one person to gain better accuracy and likeness!
|
155 |
+
|
156 |
+
Just add the ImpactPack's "Make Image Batch" Node as the input to the ReActor's one and load images you want to blend into one model:
|
157 |
+
|
158 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.2-whatsnew-01.jpg?raw=true" alt="0.4.2-whatsnew-01" width="100%"/>
|
159 |
+
|
160 |
+
Result example (the new face was created from 4 faces of different actresses):
|
161 |
+
|
162 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.2-whatsnew-02.jpg?raw=true" alt="0.4.2-whatsnew-02" width="75%"/>
|
163 |
+
|
164 |
+
Basic workflow [💾](https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/workflows/ReActor--Build-Blended-Face-Model--v1.json)
|
165 |
+
|
166 |
+
### [0.4.1](https://github.com/Gourieff/comfyui-reactor-node/releases/tag/v0.4.1)
|
167 |
+
|
168 |
+
- CUDA 12 Support - don't forget to run (Windows) `install.bat` or (Linux/MacOS) `install.py` for ComfyUI's Python enclosure or try to install ORT-GPU for CU12 manually (https://onnxruntime.ai/docs/install/#install-onnx-runtime-gpu-cuda-12x)
|
169 |
+
- Issue https://github.com/Gourieff/comfyui-reactor-node/issues/173 fix
|
170 |
+
|
171 |
+
- Separate Node for the Face Restoration postprocessing (FR https://github.com/Gourieff/comfyui-reactor-node/issues/191), can be found inside ReActor's menu (RestoreFace Node)
|
172 |
+
- (Windows) Installation can be done for Python from the System's PATH
|
173 |
+
- Different fixes and improvements
|
174 |
+
|
175 |
+
- Face Restore Visibility and CodeFormer Weight (Fidelity) options are now available! Don't forget to reload the Node in your existing workflow
|
176 |
+
|
177 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.1-whatsnew-01.jpg?raw=true" alt="0.4.1-whatsnew-01" width="100%"/>
|
178 |
+
|
179 |
+
### [0.4.0](https://github.com/Gourieff/comfyui-reactor-node/releases/tag/v0.4.0)
|
180 |
+
|
181 |
+
- Input "input_image" goes first now, it gives a correct bypass and also it is right to have the main input first;
|
182 |
+
- You can now save face models as "safetensors" files (`ComfyUI\models\reactor\faces`) and load them into ReActor implementing different scenarios and keeping super lightweight face models of the faces you use:
|
183 |
+
|
184 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.0-whatsnew-01.jpg?raw=true" alt="0.4.0-whatsnew-01" width="100%"/>
|
185 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.0-whatsnew-02.jpg?raw=true" alt="0.4.0-whatsnew-02" width="100%"/>
|
186 |
+
|
187 |
+
- Ability to build and save face models directly from an image:
|
188 |
+
|
189 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.0-whatsnew-03.jpg?raw=true" alt="0.4.0-whatsnew-03" width="50%"/>
|
190 |
+
|
191 |
+
- Both the inputs are optional, just connect one of them according to your workflow; if both is connected - `image` has a priority.
|
192 |
+
- Different fixes making this extension better.
|
193 |
+
|
194 |
+
Thanks to everyone who finds bugs, suggests new features and supports this project!
|
195 |
+
|
196 |
+
</details>
|
197 |
+
|
198 |
+
## Installation
|
199 |
+
|
200 |
+
<details>
|
201 |
+
<summary>SD WebUI: <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/">AUTOMATIC1111</a> or <a href="https://github.com/vladmandic/automatic">SD.Next</a></summary>
|
202 |
+
|
203 |
+
1. Close (stop) your SD-WebUI/Comfy Server if it's running
|
204 |
+
2. (For Windows Users):
|
205 |
+
- Install [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Community version - you need this step to build Insightface)
|
206 |
+
- OR only [VS C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and select "Desktop Development with C++" under "Workloads -> Desktop & Mobile"
|
207 |
+
- OR if you don't want to install VS or VS C++ BT - follow [this steps (sec. I)](#insightfacebuild)
|
208 |
+
3. Go to the `extensions\sd-webui-comfyui\ComfyUI\custom_nodes`
|
209 |
+
4. Open Console or Terminal and run `git clone https://github.com/Gourieff/comfyui-reactor-node`
|
210 |
+
5. Go to the SD WebUI root folder, open Console or Terminal and run (Windows users)`.\venv\Scripts\activate` or (Linux/MacOS)`venv/bin/activate`
|
211 |
+
6. `python -m pip install -U pip`
|
212 |
+
7. `cd extensions\sd-webui-comfyui\ComfyUI\custom_nodes\comfyui-reactor-node`
|
213 |
+
8. `python install.py`
|
214 |
+
9. Please, wait until the installation process will be finished
|
215 |
+
10. (From the version 0.3.0) Download additional facerestorers models from the link below and put them into the `extensions\sd-webui-comfyui\ComfyUI\models\facerestore_models` directory:<br>
|
216 |
+
https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models
|
217 |
+
11. Run SD WebUI and check console for the message that ReActor Node is running:
|
218 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/console_status_running.jpg?raw=true" alt="console_status_running" width="759"/>
|
219 |
+
|
220 |
+
12. Go to the ComfyUI tab and find there ReActor Node inside the menu `ReActor` or by using a search:
|
221 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/webui-demo.png?raw=true" alt="webui-demo" width="100%"/>
|
222 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/search-demo.png?raw=true" alt="webui-demo" width="1043"/>
|
223 |
+
|
224 |
+
</details>
|
225 |
+
|
226 |
+
<details>
|
227 |
+
<summary>Standalone (Portable) <a href="https://github.com/comfyanonymous/ComfyUI">ComfyUI</a> for Windows</summary>
|
228 |
+
|
229 |
+
1. Do the following:
|
230 |
+
- Install [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Community version - you need this step to build Insightface)
|
231 |
+
- OR only [VS C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and select "Desktop Development with C++" under "Workloads -> Desktop & Mobile"
|
232 |
+
- OR if you don't want to install VS or VS C++ BT - follow [this steps (sec. I)](#insightfacebuild)
|
233 |
+
2. Choose between two options:
|
234 |
+
- (ComfyUI Manager) Open ComfyUI Manager, click "Install Custom Nodes", type "ReActor" in the "Search" field and then click "Install". After ComfyUI will complete the process - please restart the Server.
|
235 |
+
- (Manually) Go to `ComfyUI\custom_nodes`, open Console and run `git clone https://github.com/Gourieff/comfyui-reactor-node`
|
236 |
+
3. Go to `ComfyUI\custom_nodes\comfyui-reactor-node` and run `install.bat`
|
237 |
+
4. If you don't have the "face_yolov8m.pt" Ultralytics model - you can download it from the [Assets](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/detection/bbox/face_yolov8m.pt) and put it into the "ComfyUI\models\ultralytics\bbox" directory
|
238 |
+
<br>
|
239 |
+
As well as one or both of "Sams" models from [here](https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/sams) - download (if you don't have them) and put into the "ComfyUI\models\sams" directory
|
240 |
+
5. Run ComfyUI and find there ReActor Nodes inside the menu `ReActor` or by using a search
|
241 |
+
|
242 |
+
</details>
|
243 |
+
|
244 |
+
## Usage
|
245 |
+
|
246 |
+
You can find ReActor Nodes inside the menu `ReActor` or by using a search (just type "ReActor" in the search field)
|
247 |
+
|
248 |
+
List of Nodes:
|
249 |
+
- ••• Main Nodes •••
|
250 |
+
- ReActorFaceSwap (Main Node)
|
251 |
+
- ReActorFaceSwapOpt (Main Node with the additional Options input)
|
252 |
+
- ReActorOptions (Options for ReActorFaceSwapOpt)
|
253 |
+
- ReActorFaceBoost (Face Booster Node)
|
254 |
+
- ReActorMaskHelper (Masking Helper)
|
255 |
+
- ••• Operations with Face Models •••
|
256 |
+
- ReActorSaveFaceModel (Save Face Model)
|
257 |
+
- ReActorLoadFaceModel (Load Face Model)
|
258 |
+
- ReActorBuildFaceModel (Build Blended Face Model)
|
259 |
+
- ReActorMakeFaceModelBatch (Make Face Model Batch)
|
260 |
+
- ••• Additional Nodes •••
|
261 |
+
- ReActorRestoreFace (Face Restoration)
|
262 |
+
- ReActorImageDublicator (Dublicate one Image to Images List)
|
263 |
+
- ImageRGBA2RGB (Convert RGBA to RGB)
|
264 |
+
|
265 |
+
Connect all required slots and run the query.
|
266 |
+
|
267 |
+
### Main Node Inputs
|
268 |
+
|
269 |
+
- `input_image` - is an image to be processed (target image, analog of "target image" in the SD WebUI extension);
|
270 |
+
- Supported Nodes: "Load Image", "Load Video" or any other nodes providing images as an output;
|
271 |
+
- `source_image` - is an image with a face or faces to swap in the `input_image` (source image, analog of "source image" in the SD WebUI extension);
|
272 |
+
- Supported Nodes: "Load Image" or any other nodes providing images as an output;
|
273 |
+
- `face_model` - is the input for the "Load Face Model" Node or another ReActor node to provide a face model file (face embedding) you created earlier via the "Save Face Model" Node;
|
274 |
+
- Supported Nodes: "Load Face Model", "Build Blended Face Model";
|
275 |
+
|
276 |
+
### Main Node Outputs
|
277 |
+
|
278 |
+
- `IMAGE` - is an output with the resulted image;
|
279 |
+
- Supported Nodes: any nodes which have images as an input;
|
280 |
+
- `FACE_MODEL` - is an output providing a source face's model being built during the swapping process;
|
281 |
+
- Supported Nodes: "Save Face Model", "ReActor", "Make Face Model Batch";
|
282 |
+
|
283 |
+
### Face Restoration
|
284 |
+
|
285 |
+
Since version 0.3.0 ReActor Node has a buil-in face restoration.<br>Just download the models you want (see [Installation](#installation) instruction) and select one of them to restore the resulting face(s) during the faceswap. It will enhance face details and make your result more accurate.
|
286 |
+
|
287 |
+
### Face Indexes
|
288 |
+
|
289 |
+
By default ReActor detects faces in images from "large" to "small".<br>You can change this option by adding ReActorFaceSwapOpt node with ReActorOptions.
|
290 |
+
|
291 |
+
And if you need to specify faces, you can set indexes for source and input images.
|
292 |
+
|
293 |
+
Index of the first detected face is 0.
|
294 |
+
|
295 |
+
You can set indexes in the order you need.<br>
|
296 |
+
E.g.: 0,1,2 (for Source); 1,0,2 (for Input).<br>This means: the second Input face (index = 1) will be swapped by the first Source face (index = 0) and so on.
|
297 |
+
|
298 |
+
### Genders
|
299 |
+
|
300 |
+
You can specify the gender to detect in images.<br>
|
301 |
+
ReActor will swap a face only if it meets the given condition.
|
302 |
+
|
303 |
+
### Face Models
|
304 |
+
|
305 |
+
Since version 0.4.0 you can save face models as "safetensors" files (stored in `ComfyUI\models\reactor\faces`) and load them into ReActor implementing different scenarios and keeping super lightweight face models of the faces you use.
|
306 |
+
|
307 |
+
To make new models appear in the list of the "Load Face Model" Node - just refresh the page of your ComfyUI web application.<br>
|
308 |
+
(I recommend you to use ComfyUI Manager - otherwise you workflow can be lost after you refresh the page if you didn't save it before that).
|
309 |
+
|
310 |
+
## Troubleshooting
|
311 |
+
|
312 |
+
<a name="insightfacebuild">
|
313 |
+
|
314 |
+
### **I. (For Windows users) If you still cannot build Insightface for some reasons or just don't want to install Visual Studio or VS C++ Build Tools - do the following:**
|
315 |
+
|
316 |
+
1. (ComfyUI Portable) From the root folder check the version of Python:<br>run CMD and type `python_embeded\python.exe -V`
|
317 |
+
2. Download prebuilt Insightface package [for Python 3.10](https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp310-cp310-win_amd64.whl) or [for Python 3.11](https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp311-cp311-win_amd64.whl) (if in the previous step you see 3.11) or [for Python 3.12](https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp312-cp312-win_amd64.whl) (if in the previous step you see 3.12) and put into the stable-diffusion-webui (A1111 or SD.Next) root folder (where you have "webui-user.bat" file) or into ComfyUI root folder if you use ComfyUI Portable
|
318 |
+
3. From the root folder run:
|
319 |
+
- (SD WebUI) CMD and `.\venv\Scripts\activate`
|
320 |
+
- (ComfyUI Portable) run CMD
|
321 |
+
4. Then update your PIP:
|
322 |
+
- (SD WebUI) `python -m pip install -U pip`
|
323 |
+
- (ComfyUI Portable) `python_embeded\python.exe -m pip install -U pip`
|
324 |
+
5. Then install Insightface:
|
325 |
+
- (SD WebUI) `pip install insightface-0.7.3-cp310-cp310-win_amd64.whl` (for 3.10) or `pip install insightface-0.7.3-cp311-cp311-win_amd64.whl` (for 3.11) or `pip install insightface-0.7.3-cp312-cp312-win_amd64.whl` (for 3.12)
|
326 |
+
- (ComfyUI Portable) `python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl` (for 3.10) or `python_embeded\python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl` (for 3.11) or `python_embeded\python.exe -m pip install insightface-0.7.3-cp312-cp312-win_amd64.whl` (for 3.12)
|
327 |
+
6. Enjoy!
|
328 |
+
|
329 |
+
### **II. "AttributeError: 'NoneType' object has no attribute 'get'"**
|
330 |
+
|
331 |
+
This error may occur if there's smth wrong with the model file `inswapper_128.onnx`
|
332 |
+
|
333 |
+
Try to download it manually from [here](https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnx)
|
334 |
+
and put it to the `ComfyUI\models\insightface` replacing existing one
|
335 |
+
|
336 |
+
### **III. "reactor.execute() got an unexpected keyword argument 'reference_image'"**
|
337 |
+
|
338 |
+
This means that input points have been changed with the latest update<br>
|
339 |
+
Remove the current ReActor Node from your workflow and add it again
|
340 |
+
|
341 |
+
### **IV. ControlNet Aux Node IMPORT failed error when using with ReActor Node**
|
342 |
+
|
343 |
+
1. Close ComfyUI if it runs
|
344 |
+
2. Go to the ComfyUI root folder, open CMD there and run:
|
345 |
+
- `python_embeded\python.exe -m pip uninstall -y opencv-python opencv-contrib-python opencv-python-headless`
|
346 |
+
- `python_embeded\python.exe -m pip install opencv-python==4.7.0.72`
|
347 |
+
3. That's it!
|
348 |
+
|
349 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/reactor-w-controlnet.png?raw=true" alt="reactor+controlnet" />
|
350 |
+
|
351 |
+
### **V. "ModuleNotFoundError: No module named 'basicsr'" or "subprocess-exited-with-error" during future-0.18.3 installation**
|
352 |
+
|
353 |
+
- Download https://github.com/Gourieff/Assets/raw/main/comfyui-reactor-node/future-0.18.3-py3-none-any.whl<br>
|
354 |
+
- Put it to ComfyUI root And run:
|
355 |
+
|
356 |
+
python_embeded\python.exe -m pip install future-0.18.3-py3-none-any.whl
|
357 |
+
|
358 |
+
- Then:
|
359 |
+
|
360 |
+
python_embeded\python.exe -m pip install basicsr
|
361 |
+
|
362 |
+
### **VI. "fatal: fetch-pack: invalid index-pack output" when you try to `git clone` the repository"**
|
363 |
+
|
364 |
+
Try to clone with `--depth=1` (last commit only):
|
365 |
+
|
366 |
+
git clone --depth=1 https://github.com/Gourieff/comfyui-reactor-node
|
367 |
+
|
368 |
+
Then retrieve the rest (if you need):
|
369 |
+
|
370 |
+
git fetch --unshallow
|
371 |
+
|
372 |
+
## Updating
|
373 |
+
|
374 |
+
Just put .bat or .sh script from this [Repo](https://github.com/Gourieff/sd-webui-extensions-updater) to the `ComfyUI\custom_nodes` directory and run it when you need to check for updates
|
375 |
+
|
376 |
+
### Disclaimer
|
377 |
+
|
378 |
+
This software is meant to be a productive contribution to the rapidly growing AI-generated media industry. It will help artists with tasks such as animating a custom character or using the character as a model for clothing etc.
|
379 |
+
|
380 |
+
The developers of this software are aware of its possible unethical applications and are committed to take preventative measures against them. We will continue to develop this project in the positive direction while adhering to law and ethics.
|
381 |
+
|
382 |
+
Users of this software are expected to use this software responsibly while abiding the local law. If face of a real person is being used, users are suggested to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. **Developers and Contributors of this software are not responsible for actions of end-users.**
|
383 |
+
|
384 |
+
By using this extension you are agree not to create any content that:
|
385 |
+
- violates any laws;
|
386 |
+
- causes any harm to a person or persons;
|
387 |
+
- propagates (spreads) any information (both public or personal) or images (both public or personal) which could be meant for harm;
|
388 |
+
- spreads misinformation;
|
389 |
+
- targets vulnerable groups of people.
|
390 |
+
|
391 |
+
This software utilizes the pre-trained models `buffalo_l` and `inswapper_128.onnx`, which are provided by [InsightFace](https://github.com/deepinsight/insightface/). These models are included under the following conditions:
|
392 |
+
|
393 |
+
[From insighface license](https://github.com/deepinsight/insightface/tree/master/python-package): The InsightFace’s pre-trained models are available for non-commercial research purposes only. This includes both auto-downloading models and manually downloaded models.
|
394 |
+
|
395 |
+
Users of this software must strictly adhere to these conditions of use. The developers and maintainers of this software are not responsible for any misuse of InsightFace’s pre-trained models.
|
396 |
+
|
397 |
+
Please note that if you intend to use this software for any commercial purposes, you will need to train your own models or find models that can be used commercially.
|
398 |
+
|
399 |
+
### Models Hashsum
|
400 |
+
|
401 |
+
#### Safe-to-use models have the following hash:
|
402 |
+
|
403 |
+
inswapper_128.onnx
|
404 |
+
```
|
405 |
+
MD5:a3a155b90354160350efd66fed6b3d80
|
406 |
+
SHA256:e4a3f08c753cb72d04e10aa0f7dbe3deebbf39567d4ead6dce08e98aa49e16af
|
407 |
+
```
|
408 |
+
|
409 |
+
1k3d68.onnx
|
410 |
+
|
411 |
+
```
|
412 |
+
MD5:6fb94fcdb0055e3638bf9158e6a108f4
|
413 |
+
SHA256:df5c06b8a0c12e422b2ed8947b8869faa4105387f199c477af038aa01f9a45cc
|
414 |
+
```
|
415 |
+
|
416 |
+
2d106det.onnx
|
417 |
+
|
418 |
+
```
|
419 |
+
MD5:a3613ef9eb3662b4ef88eb90db1fcf26
|
420 |
+
SHA256:f001b856447c413801ef5c42091ed0cd516fcd21f2d6b79635b1e733a7109dbf
|
421 |
+
```
|
422 |
+
|
423 |
+
det_10g.onnx
|
424 |
+
|
425 |
+
```
|
426 |
+
MD5:4c10eef5c9e168357a16fdd580fa8371
|
427 |
+
SHA256:5838f7fe053675b1c7a08b633df49e7af5495cee0493c7dcf6697200b85b5b91
|
428 |
+
```
|
429 |
+
|
430 |
+
genderage.onnx
|
431 |
+
|
432 |
+
```
|
433 |
+
MD5:81c77ba87ab38163b0dec6b26f8e2af2
|
434 |
+
SHA256:4fde69b1c810857b88c64a335084f1c3fe8f01246c9a191b48c7bb756d6652fb
|
435 |
+
```
|
436 |
+
|
437 |
+
w600k_r50.onnx
|
438 |
+
|
439 |
+
```
|
440 |
+
MD5:80248d427976241cbd1343889ed132b3
|
441 |
+
SHA256:4c06341c33c2ca1f86781dab0e829f88ad5b64be9fba56e56bc9ebdefc619e43
|
442 |
+
```
|
443 |
+
|
444 |
+
**Please check hashsums if you download these models from unverified (or untrusted) sources**
|
445 |
+
|
446 |
+
<a name="credits">
|
447 |
+
|
448 |
+
## Thanks and Credits
|
449 |
+
|
450 |
+
<details>
|
451 |
+
<summary><a>Click to expand</a></summary>
|
452 |
+
|
453 |
+
<br>
|
454 |
+
|
455 |
+
|file|source|license|
|
456 |
+
|----|------|-------|
|
457 |
+
|[buffalo_l.zip](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/buffalo_l.zip) | [DeepInsight](https://github.com/deepinsight/insightface) |  |
|
458 |
+
| [codeformer-v0.1.0.pth](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/facerestore_models/codeformer-v0.1.0.pth) | [sczhou](https://github.com/sczhou/CodeFormer) |  |
|
459 |
+
| [GFPGANv1.3.pth](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/facerestore_models/GFPGANv1.3.pth) | [TencentARC](https://github.com/TencentARC/GFPGAN) |  |
|
460 |
+
| [GFPGANv1.4.pth](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/facerestore_models/GFPGANv1.4.pth) | [TencentARC](https://github.com/TencentARC/GFPGAN) |  |
|
461 |
+
| [inswapper_128.onnx](https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnx) | [DeepInsight](https://github.com/deepinsight/insightface) |  |
|
462 |
+
| [inswapper_128_fp16.onnx](https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128_fp16.onnx) | [Hillobar](https://github.com/Hillobar/Rope) |  |
|
463 |
+
|
464 |
+
[BasicSR](https://github.com/XPixelGroup/BasicSR) - [@XPixelGroup](https://github.com/XPixelGroup) <br>
|
465 |
+
[facexlib](https://github.com/xinntao/facexlib) - [@xinntao](https://github.com/xinntao) <br>
|
466 |
+
|
467 |
+
[@s0md3v](https://github.com/s0md3v), [@henryruhs](https://github.com/henryruhs) - the original Roop App <br>
|
468 |
+
[@ssitu](https://github.com/ssitu) - the first version of [ComfyUI_roop](https://github.com/ssitu/ComfyUI_roop) extension
|
469 |
+
|
470 |
+
</details>
|
471 |
+
|
472 |
+
<a name="note">
|
473 |
+
|
474 |
+
### Note!
|
475 |
+
|
476 |
+
**If you encounter any errors when you use ReActor Node - don't rush to open an issue, first try to remove current ReActor node in your workflow and add it again**
|
477 |
+
|
478 |
+
**ReActor Node gets updates from time to time, new functions appear and old node can work with errors or not work at all**
|
README_RU.md
ADDED
@@ -0,0 +1,487 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div align="center">
|
2 |
+
|
3 |
+
<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_RU.png?raw=true" alt="logo" width="180px"/>
|
4 |
+
|
5 |
+

|
6 |
+
|
7 |
+
<!--<sup>
|
8 |
+
<font color=brightred>
|
9 |
+
|
10 |
+
## !!! [Важные изменения](#latestupdate) !!!<br>Не забудьте добавить Нод заново в существующие воркфлоу
|
11 |
+
|
12 |
+
</font>
|
13 |
+
</sup>-->
|
14 |
+
|
15 |
+
<a href="https://boosty.to/artgourieff" target="_blank">
|
16 |
+
<img src="https://lovemet.ru/img/boosty.jpg" width="108" alt="Поддержать проект на Boosty"/>
|
17 |
+
<br>
|
18 |
+
<sup>
|
19 |
+
Поддержать проект
|
20 |
+
</sup>
|
21 |
+
</a>
|
22 |
+
|
23 |
+
<hr>
|
24 |
+
|
25 |
+
[](https://github.com/Gourieff/comfyui-reactor-node/commits/main)
|
26 |
+

|
27 |
+
[](https://github.com/Gourieff/comfyui-reactor-node/issues?cacheSeconds=0)
|
28 |
+
[](https://github.com/Gourieff/comfyui-reactor-node/issues?q=is%3Aissue+is%3Aclosed)
|
29 |
+

|
30 |
+
|
31 |
+
[English](/README.md) | Русский
|
32 |
+
|
33 |
+
# ReActor Node для ComfyUI
|
34 |
+
|
35 |
+
</div>
|
36 |
+
|
37 |
+
### Нод (node) для быстрой и простой замены лиц на любых изображениях для работы с ComfyUI, основан на [ReActor](https://github.com/Gourieff/sd-webui-reactor) SD-WebUI Face Swap Extension
|
38 |
+
|
39 |
+
> Данный Нод идёт без фильтра цензуры (18+, используйте под вашу собственную [ответственность](#disclaimer))
|
40 |
+
|
41 |
+
<div align="center">
|
42 |
+
|
43 |
+
---
|
44 |
+
[**Что нового**](#latestupdate) | [**Установка**](#installation) | [**Использование**](#usage) | [**Устранение проблем**](#troubleshooting) | [**Обновление**](#updating) | [**Ответственность**](#disclaimer) | [**Благодарности**](#credits) | [**Заметка**](#note)
|
45 |
+
|
46 |
+
---
|
47 |
+
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<div align="center">
|
51 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/demo.gif?raw=true" alt="logo" width="100%"/>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<a name="latestupdate">
|
55 |
+
|
56 |
+
## Что нового в последнем обновлении
|
57 |
+
|
58 |
+
### 0.5.2 <sub><sup>BETA1</sup></sub>
|
59 |
+
|
60 |
+
- Поддержка моделей ReSwapper. Несмотря на то, что Inswapper по-прежнему даёт лучшее сходство, но ReSwapper развивается - спасибо @somanchiu https://github.com/somanchiu/ReSwapper за эти модели и проект ReSwapper! Это хороший шаг для Сообщества в создании альтернативы Инсваппера!
|
61 |
+
|
62 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.2-whatsnew-03.jpg?raw=true" alt="0.5.2-whatsnew-03" width="100%"/>
|
63 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.2-whatsnew-04.jpg?raw=true" alt="0.5.2-whatsnew-04" width="100%"/>
|
64 |
+
|
65 |
+
Скачать модели ReSwapper можно отсюда:
|
66 |
+
https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models<br>
|
67 |
+
Сохраните их в директорию "models/reswapper".
|
68 |
+
|
69 |
+
### 0.5.2 <sub><sup>ALPHA1</sup></sub>
|
70 |
+
|
71 |
+
- Новый нод "Unload ReActor Models" - полезен для сложных воркфлоу, когда вам нужно освободить ОЗУ, занятую РеАктором
|
72 |
+
|
73 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.2-whatsnew-01.jpg?raw=true" alt="0.5.2-whatsnew-01" width="100%"/>
|
74 |
+
|
75 |
+
- Поддержка ORT CoreML and ROCM EPs, достаточно установить ту версию onnxruntime, которая соответствует вашему GPU
|
76 |
+
- Некоторые улучшения скрипта установки для поддержки последней версии ORT-GPU
|
77 |
+
|
78 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.2-whatsnew-02.jpg?raw=true" alt="0.5.2-whatsnew-02" width="100%"/>
|
79 |
+
|
80 |
+
<details>
|
81 |
+
<summary><a>Предыдущие версии</a></summary>
|
82 |
+
|
83 |
+
### 0.5.1
|
84 |
+
|
85 |
+
- Поддержка моделей восстановления лиц GPEN 1024/2048 (доступны в датасете на HF https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models)
|
86 |
+
- Нод ReActorFaceBoost - попытка улучшить качество заменённых лиц. Идея состоит в том, чтобы восстановить и увеличить заменённое лицо (в соответствии с параметром `face_size` модели реставрации) ДО того, как лицо будет вставлено в целевое изображения (через алгоритмы инсваппера), больше информации [здесь (PR#321)](https://github.com/Gourieff/comfyui-reactor-node/pull/321)
|
87 |
+
|
88 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.1-whatsnew-01.jpg?raw=true" alt="0.5.1-whatsnew-01" width="100%"/>
|
89 |
+
|
90 |
+
[Полноразмерное демо-превью](https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.1-whatsnew-02.png)
|
91 |
+
|
92 |
+
- Сортировка моделей лиц по алфавиту
|
93 |
+
- Множество исправлений и улучшений
|
94 |
+
|
95 |
+
### [0.5.0 <sub><sup>BETA4</sup></sub>](https://github.com/Gourieff/comfyui-reactor-node/releases/tag/v0.5.0)
|
96 |
+
|
97 |
+
- Поддержка библиотеки Spandrel при работе с GFPGAN
|
98 |
+
|
99 |
+
### 0.5.0 <sub><sup>BETA3</sup></sub>
|
100 |
+
|
101 |
+
- Исправления: "RAM issue", "No detection" для MaskingHelper
|
102 |
+
|
103 |
+
### 0.5.0 <sub><sup>BETA2</sup></sub>
|
104 |
+
|
105 |
+
- Появилась возможность строить смешанные модели лиц из пачки уже имеющихся моделей - добавьте для этого нод "Make Face Model Batch" в свой воркфлоу и загрузите несколько моделей через ноды "Load Face Model"
|
106 |
+
- Огромный буст производительности модуля анализа изображений! 10-кратный прирост скорости! Работа с видео теперь в удовольствие!
|
107 |
+
|
108 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-05.png?raw=true" alt="0.5.0-whatsnew-05" width="100%"/>
|
109 |
+
|
110 |
+
### 0.5.0 <sub><sup>BETA1</sup></sub>
|
111 |
+
|
112 |
+
- Добавлен выход SWAPPED_FACE для нода Masking Helper
|
113 |
+
- FIX: Удалён пустой A-канал на выходе IMAGE нода Masking Helper (вызывавший ошибки с некоторым нодами)
|
114 |
+
|
115 |
+
### 0.5.0 <sub><sup>ALPHA1</sup></sub>
|
116 |
+
|
117 |
+
- Нод ReActorBuildFaceModel получил выход "face_model" для отправки совмещенной модели лиц непосредственно в основной Нод:
|
118 |
+
|
119 |
+
Basic workflow [💾](https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/workflows/ReActor--Build-Blended-Face-Model--v2.json)
|
120 |
+
|
121 |
+
- Функции маски лица теперь доступна и в версии для Комфи, просто добавьте нод "ReActorMaskHelper" в воркфлоу и соедините узлы, как показано ниже:
|
122 |
+
|
123 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-01.jpg?raw=true" alt="0.5.0-whatsnew-01" width="100%"/>
|
124 |
+
|
125 |
+
Если модель "face_yolov8m.pt" у вас отсутствует - можете скачать её [отсюда](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/detection/bbox/face_yolov8m.pt) и положить в папку "ComfyUI\models\ultralytics\bbox"
|
126 |
+
<br>
|
127 |
+
То же самое и с ["sam_vit_b_01ec64.pth"](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/sams/sam_vit_b_01ec64.pth) - скачайте (если отсутствует) и положите в папку "ComfyUI\models\sams";
|
128 |
+
|
129 |
+
Данный нод поможет вам получить куда более аккуратный результат при замене лиц:
|
130 |
+
|
131 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-02.jpg?raw=true" alt="0.5.0-whatsnew-02" width="100%"/>
|
132 |
+
|
133 |
+
- Нод ReActorImageDublicator - полезен тем, кто создает видео, помогает продублировать одиночное изображение в несколько копий, чтобы использовать их, к примеру, с VAE энкодером:
|
134 |
+
|
135 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-03.jpg?raw=true" alt="0.5.0-whatsnew-03" width="100%"/>
|
136 |
+
|
137 |
+
- ReActorFaceSwapOpt (упрощенная версия основного нода) + нод ReActorOptions для установки дополнительных опций, как (новые) "отдельный порядок лиц для input/source". Да! Теперь можно установить любой порядок "чтения" индекса лиц на изображении, в т.ч. от большего к меньшему (по умолчанию)!
|
138 |
+
|
139 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.5.0-whatsnew-04.jpg?raw=true" alt="0.5.0-whatsnew-04" width="100%"/>
|
140 |
+
|
141 |
+
- Небольшое улучшение скорости анализа целевых изображений (input)
|
142 |
+
|
143 |
+
### [0.4.2](https://github.com/Gourieff/comfyui-reactor-node/releases/tag/v0.4.2)
|
144 |
+
|
145 |
+
- Добавлена поддержка GPEN-BFR-512 и RestoreFormer_Plus_Plus моделей восстановления лиц
|
146 |
+
|
147 |
+
Скачать можно здесь: https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models
|
148 |
+
<br>Добавьте модели в папку `ComfyUI\models\facerestore_models`
|
149 |
+
|
150 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.2-whatsnew-04.jpg?raw=true" alt="0.4.2-whatsnew-04" width="100%"/>
|
151 |
+
|
152 |
+
- По многочисленным просьбам появилась возможность строить смешанные модели лиц и в ComfyUI тоже и использовать их с нодом "Load Face Model" Node или в SD WebUI;
|
153 |
+
|
154 |
+
Экспериментируйте и создавайте новые лица или совмещайте разные лица нужного вам персонажа, чтобы добиться лучшей точности и схожести с оригиналом!
|
155 |
+
|
156 |
+
Достаточно добавить нод "Make Image Batch" (ImpactPack) на вход нового нода РеАктора и загрузить в пачку необходимые вам изображения для построения смешанной модели:
|
157 |
+
|
158 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.2-whatsnew-01.jpg?raw=true" alt="0.4.2-whatsnew-01" width="100%"/>
|
159 |
+
|
160 |
+
Пример результата (на основе лиц 4-х актрис создано новое лицо):
|
161 |
+
|
162 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.2-whatsnew-02.jpg?raw=true" alt="0.4.2-whatsnew-02" width="75%"/>
|
163 |
+
|
164 |
+
Базовый воркфлоу [💾](https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/workflows/ReActor--Build-Blended-Face-Model--v1.json)
|
165 |
+
|
166 |
+
### [0.4.1](https://github.com/Gourieff/comfyui-reactor-node/releases/tag/v0.4.1)
|
167 |
+
|
168 |
+
- Поддержка CUDA 12 - не забудьте запустить (Windows) `install.bat` или (Linux/MacOS) `install.py` для используемого Python окружения или попробуйте установить ORT-GPU для CU12 вручную (https://onnxruntime.ai/docs/install/#install-onnx-runtime-gpu-cuda-12x)
|
169 |
+
- Исправление Issue https://github.com/Gourieff/comfyui-reactor-node/issues/173
|
170 |
+
|
171 |
+
- Отдельный Нод для восстаноления лиц (FR https://github.com/Gourieff/comfyui-reactor-node/issues/191), располагается внутри меню ReActor (нод RestoreFace)
|
172 |
+
- (Windows) Установка зависимостей теперь может быть выполнена в Python из PATH ОС
|
173 |
+
- Разные исправления и улучшения
|
174 |
+
|
175 |
+
- Face Restore Visibility и CodeFormer Weight (Fidelity) теперь доступны; не забудьте заново добавить Нод в ваших существующих воркфлоу
|
176 |
+
|
177 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.1-whatsnew-01.jpg?raw=true" alt="0.4.1-whatsnew-01" width="100%"/>
|
178 |
+
|
179 |
+
### [0.4.0](https://github.com/Gourieff/comfyui-reactor-node/releases/tag/v0.4.0)
|
180 |
+
|
181 |
+
- Вход "input_image" теперь идёт первым, это даёт возможность корректного байпаса, а также это правильно с точки зрения расположения входов (главный вход - первый);
|
182 |
+
- Теперь можно сохранять модели лиц в качестве файлов "safetensors" (`ComfyUI\models\reactor\faces`) и загружать их в ReActor, реализуя разные сценарии использования, а также храня супер легкие модели лиц, которые вы чаще всего используете:
|
183 |
+
|
184 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.0-whatsnew-01.jpg?raw=true" alt="0.4.0-whatsnew-01" width="100%"/>
|
185 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.0-whatsnew-02.jpg?raw=true" alt="0.4.0-whatsnew-02" width="100%"/>
|
186 |
+
|
187 |
+
- Возможность сохранять модели лиц напрямую из изображения:
|
188 |
+
|
189 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/0.4.0-whatsnew-03.jpg?raw=true" alt="0.4.0-whatsnew-03" width="50%"/>
|
190 |
+
|
191 |
+
- Оба входа опциональны, присоедините один из них в соответствии с вашим воркфлоу; если присоеденены оба - вход `image` имеет приоритет.
|
192 |
+
- Различные исправления, делающие это расширение лучше.
|
193 |
+
|
194 |
+
Спасибо ��сем, кто находит ошибки, предлагает новые функции и поддерживает данный проект!
|
195 |
+
|
196 |
+
</details>
|
197 |
+
|
198 |
+
<a name="installation">
|
199 |
+
|
200 |
+
## Установка
|
201 |
+
|
202 |
+
<details>
|
203 |
+
<summary>SD WebUI: <a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/">AUTOMATIC1111</a> или <a href="https://github.com/vladmandic/automatic">SD.Next</a></summary>
|
204 |
+
|
205 |
+
1. Закройте (остановите) SD-WebUI Сервер, если запущен
|
206 |
+
2. (Для пользователей Windows):
|
207 |
+
- Установите [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Например, версию Community - этот шаг нужен для правильной компиляции библиотеки Insightface)
|
208 |
+
- ИЛИ только [VS C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/), выберите "Desktop Development with C++" в разделе "Workloads -> Desktop & Mobile"
|
209 |
+
- ИЛИ если же вы не хотите устанавливать что-либо из вышеуказанного - выполните [данные шаги (раздел. I)](#insightfacebuild)
|
210 |
+
3. Перейдите в `extensions\sd-webui-comfyui\ComfyUI\custom_nodes`
|
211 |
+
4. Откройте Консоль или Терминал и выполните `git clone https://github.com/Gourieff/comfyui-reactor-node`
|
212 |
+
5. Перейдите в корневую директорию SD WebUI, откройте Консоль или Терминал и выполните (для пользователей Windows)`.\venv\Scripts\activate` или (для пользователей Linux/MacOS)`venv/bin/activate`
|
213 |
+
6. `python -m pip install -U pip`
|
214 |
+
7. `cd extensions\sd-webui-comfyui\ComfyUI\custom_nodes\comfyui-reactor-node`
|
215 |
+
8. `python install.py`
|
216 |
+
9. Пожалуйста, дождитесь полного завершения установки
|
217 |
+
10. (Начиная с версии 0.3.0) Скачайте дополнительные модели восстановления лиц (по ссылке ниже) и сохраните их в папку `extensions\sd-webui-comfyui\ComfyUI\models\facerestore_models`:<br>
|
218 |
+
https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models
|
219 |
+
11. Запустите SD WebUI и проверьте консоль на сообщение, что ReActor Node работает:
|
220 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/console_status_running.jpg?raw=true" alt="console_status_running" width="759"/>
|
221 |
+
|
222 |
+
12. Перейдите во вкладку ComfyUI и найдите там ReActor Node внутри меню `ReActor` или через поиск:
|
223 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/webui-demo.png?raw=true" alt="webui-demo" width="100%"/>
|
224 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/search-demo.png?raw=true" alt="webui-demo" width="1043"/>
|
225 |
+
|
226 |
+
</details>
|
227 |
+
|
228 |
+
<details>
|
229 |
+
<summary>Портативная версия <a href="https://github.com/comfyanonymous/ComfyUI">ComfyUI</a> для Windows</summary>
|
230 |
+
|
231 |
+
1. Сделайте следующее:
|
232 |
+
- Установите [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Например, версию Community - этот шаг нужен для правильной компиляции библиотеки Insightface)
|
233 |
+
- ИЛИ только [VS C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/), выберите "Desktop Development with C++" в разделе "Workloads -> Desktop & Mobile"
|
234 |
+
- ИЛИ если же вы не хотите устанавливать что-либо из вышеуказанного - выполните [данные шаги (раздел. I)](#insightfacebuild)
|
235 |
+
2. Выберите из двух вариантов:
|
236 |
+
- (ComfyUI Manager) Откройте ComfyUI Manager, нажвите "Install Custom Nodes", введите "ReActor" в поле "Search" и далее нажмите "Install". После того, как ComfyUI завершит установку, перезагрузите сервер.
|
237 |
+
- (Вручную) Перейдите в `ComfyUI\custom_nodes`, откройте Консоль и выполните `git clone https://github.com/Gourieff/comfyui-reactor-node`
|
238 |
+
3. Перейдите `ComfyUI\custom_nodes\comfyui-reactor-node` и запустите `install.bat`, дождитесь окончания установки
|
239 |
+
4. Если модель "face_yolov8m.pt" у вас отсутствует - можете скачать её [отсюда](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/detection/bbox/face_yolov8m.pt) и положить в папку "ComfyUI\models\ultralytics\bbox"
|
240 |
+
<br>
|
241 |
+
То же самое и с "Sams" моделями, скачайте одну или обе [отсюда](https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/sams) - и положите в папку "ComfyUI\models\sams"
|
242 |
+
5. Запустите ComfyUI и найдите ReActor Node внутри меню `ReActor` или через поиск
|
243 |
+
|
244 |
+
</details>
|
245 |
+
|
246 |
+
<a name="usage">
|
247 |
+
|
248 |
+
## Использование
|
249 |
+
|
250 |
+
Вы можете найти ноды ReActor внутри меню `ReActor` или через поиск (достаточно ввести "ReActor" в поисковой строке)
|
251 |
+
|
252 |
+
Список нодов:
|
253 |
+
- ••• Main Nodes •••
|
254 |
+
- ReActorFaceSwap (Основной нод)
|
255 |
+
- ReActorFaceSwapOpt (Основной нод с доп. входом Options)
|
256 |
+
- ReActorOptions (Опции для ReActorFaceSwapOpt)
|
257 |
+
- ReActorFaceBoost (Нод Face Booster)
|
258 |
+
- ReActorMaskHelper (Masking Helper)
|
259 |
+
- ••• Operations with Face Models •••
|
260 |
+
- ReActorSaveFaceModel (Save Face Model)
|
261 |
+
- ReActorLoadFaceModel (Load Face Model)
|
262 |
+
- ReActorBuildFaceModel (Build Blended Face Model)
|
263 |
+
- ReActorMakeFaceModelBatch (Make Face Model Batch)
|
264 |
+
- ••• Additional Nodes •••
|
265 |
+
- ReActorRestoreFace (Face Restoration)
|
266 |
+
- ReActorImageDublicator (Dublicate one Image to Images List)
|
267 |
+
- ImageRGBA2RGB (Convert RGBA to RGB)
|
268 |
+
|
269 |
+
Соедините все необходимые слоты (slots) и запустите очередь (query).
|
270 |
+
|
271 |
+
### Входы основного Нода
|
272 |
+
|
273 |
+
- `input_image` - это изображение, на котором надо поменять лицо или лица (целевое изображение, аналог "target image" в версии для SD WebUI);
|
274 |
+
- Поддерживаемые ноды: "Load Image", "Load Video" или любые другие ноды предоставляющие изображение в качестве выхода;
|
275 |
+
- `source_image` - это изображение с лицом или лицами для замены (изображение-источник, аналог "source image" в версии для SD WebUI);
|
276 |
+
- Поддерживаемые ноды: "Load Image" или любые другие ноды с выходом Image(s);
|
277 |
+
- `face_model` - это вход для выхода с нода "Load Face Model" или другого нода ReActor для загрузки модели лица (face model или face embedding), которое вы создали ранее через нод "Save Face Model";
|
278 |
+
- Поддерживаемые ноды: "Load Face Model", "Build Blended Face Model";
|
279 |
+
|
280 |
+
### Выходы основного Нода
|
281 |
+
|
282 |
+
- `IMAGE` - выход с готовым изображением (результатом);
|
283 |
+
- Поддерживаемые ноды: любые ноды с изображением на входе;
|
284 |
+
- `FACE_MODEL` - выход, предоставляющий модель лица, построенную в ходе замены;
|
285 |
+
- Поддерживаемые ноды: "Save Face Model", "ReActor", "Make Face Model Batch";
|
286 |
+
|
287 |
+
### Восстановление лиц
|
288 |
+
|
289 |
+
Начиная с версии 0.3.0 ReActor Node имеет встроенное восстановление лиц.<br>Скачайте нужные вам модели (см. инструкцию по [Установке](#installation)) и выберите одну из них, чтобы улучшить качество финального лица.
|
290 |
+
|
291 |
+
### Индексы Лиц (Face Indexes)
|
292 |
+
|
293 |
+
По умолчанию ReActor определяет лица на изображении в порядке от "большого" к "малому".<br>Вы можете поменять эту опцию, используя нод ReActorFaceSwapOpt вместе с ReActorOptions.
|
294 |
+
|
295 |
+
Если вам нужно заменить определенное лицо, вы можете указать индекс для исходного (source, с лицом) и входного (input, где будет замена лица) изображений.
|
296 |
+
|
297 |
+
Индекс первого обнаруженного лица - 0.
|
298 |
+
|
299 |
+
Вы можете задать индексы в том порядке, который вам нужен.<br>
|
300 |
+
Например: 0,1,2 (для Source); 1,0,2 (для Input).<br>Это означает, что: второе лицо из Input (индекс = 1) будет заменено первым лицом из Source (индекс = 0) и так далее.
|
301 |
+
|
302 |
+
### Определение Пола
|
303 |
+
|
304 |
+
Вы можете обозначить, какой пол нужно определять на изображении.<br>
|
305 |
+
ReActor заменит только то лицо, которое удовлетворяет заданному условию.
|
306 |
+
|
307 |
+
### Модели Лиц
|
308 |
+
Начиная с версии 0.4.0, вы можете сохранять модели лиц как файлы "safetensors" (хранятся в папке `ComfyUI\models\reactor\faces`) и загружать их в ReActor, ре��лизуя разные сценарии использования, а также храня супер легкие модели лиц, которые вы чаще всего используете.
|
309 |
+
|
310 |
+
Чтобы новые модели появились в списке моделей нода "Load Face Model" - обновите страницу of с ComfyUI.<br>
|
311 |
+
(Рекомендую использовать ComfyUI Manager - иначе ваше воркфлоу может быть потеряно после перезагрузки страницы, если вы не сохранили его).
|
312 |
+
|
313 |
+
<a name="troubleshooting">
|
314 |
+
|
315 |
+
## Устранение проблем
|
316 |
+
|
317 |
+
<a name="insightfacebuild">
|
318 |
+
|
319 |
+
### **I. (Для пользователей Windows) Если вы до сих пор не можете установить пакет Insightface по каким-то причинам или же просто не желаете устанавливать Visual Studio или VS C++ Build Tools - сделайте следующее:**
|
320 |
+
|
321 |
+
1. (ComfyUI Portable) Находясь в корневой директории, проверьте версию Python:<br>запустите CMD и выполните `python_embeded\python.exe -V`<br>Вы должны увидеть версию или 3.10, или 3.11, или 3.12
|
322 |
+
2. Скачайте готовый пакет Insightface [для версии 3.10](https://github.com/Gourieff/sd-webui-reactor/raw/main/example/insightface-0.7.3-cp310-cp310-win_amd64.whl) или [для 3.11](https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp311-cp311-win_amd64.whl) (если на предыдущем шаге вы увидели 3.11) или [для 3.12](https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp312-cp312-win_amd64.whl) (если на предыдущем шаге вы увидели 3.12) и сохраните его в корневую директорию stable-diffusion-webui (A1111 или SD.Next) - туда, где лежит файл "webui-user.bat" -ИЛИ- в корневую директорию ComfyUI, если вы используете ComfyUI Portable
|
323 |
+
3. Из корневой директории запустите:
|
324 |
+
- (SD WebUI) CMD и `.\venv\Scripts\activate`
|
325 |
+
- (ComfyUI Portable) CMD
|
326 |
+
4. Обновите PIP:
|
327 |
+
- (SD WebUI) `python -m pip install -U pip`
|
328 |
+
- (ComfyUI Portable) `python_embeded\python.exe -m pip install -U pip`
|
329 |
+
5. Затем установите Insightface:
|
330 |
+
- (SD WebUI) `pip install insightface-0.7.3-cp310-cp310-win_amd64.whl` (для 3.10) или `pip install insightface-0.7.3-cp311-cp311-win_amd64.whl` (для 3.11) или `pip install insightface-0.7.3-cp312-cp312-win_amd64.whl` (for 3.12)
|
331 |
+
- (ComfyUI Portable) `python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl` (для 3.10) или `python_embeded\python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl` (для 3.11) или `python_embeded\python.exe -m pip install insightface-0.7.3-cp312-cp312-win_amd64.whl` (for 3.12)
|
332 |
+
6. Готово!
|
333 |
+
|
334 |
+
### **II. "AttributeError: 'NoneType' object has no attribute 'get'"**
|
335 |
+
|
336 |
+
Эта ошибка появляется, если что-то не так с файлом модели `inswapper_128.onnx`
|
337 |
+
|
338 |
+
Скачайте вручную по ссылке [отсюда](https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnx)
|
339 |
+
и сохраните в директорию `ComfyUI\models\insightface`, заменив имеющийся файл
|
340 |
+
|
341 |
+
### **III. "reactor.execute() got an unexpected keyword argument 'reference_image'"**
|
342 |
+
|
343 |
+
Это означает, что поменялось обозначение входных точек (input points) всвязи с последним обновлением<br>
|
344 |
+
Удалите из вашего рабочего пространства имеющийся ReActor Node и добавьте его снова
|
345 |
+
|
346 |
+
### **IV. ControlNet Aux Node IMPORT failed - при использовании совместно с нодом ReActor**
|
347 |
+
|
348 |
+
1. Закройте или остановите ComfyUI сервер, если он запущен
|
349 |
+
2. Перейдите в корневую папку ComfyUI, откройте консоль CMD и выполните следующее:
|
350 |
+
- `python_embeded\python.exe -m pip uninstall -y opencv-python opencv-contrib-python opencv-python-headless`
|
351 |
+
- `python_embeded\python.exe -m pip install opencv-python==4.7.0.72`
|
352 |
+
3. Готово!
|
353 |
+
|
354 |
+
<img src="https://github.com/Gourieff/Assets/blob/main/comfyui-reactor-node/uploads/reactor-w-controlnet.png?raw=true" alt="reactor+controlnet" />
|
355 |
+
|
356 |
+
### **V. "ModuleNotFoundError: No module named 'basicsr'" или "subprocess-exited-with-error" при установке пакета future-0.18.3**
|
357 |
+
|
358 |
+
- Скачайте https://github.com/Gourieff/Assets/raw/main/comfyui-reactor-node/future-0.18.3-py3-none-any.whl<br>
|
359 |
+
- Ско��ируйте файл в корневую папку ComfyUI и выполните в консоли:
|
360 |
+
|
361 |
+
python_embeded\python.exe -m pip install future-0.18.3-py3-none-any.whl
|
362 |
+
|
363 |
+
- Затем:
|
364 |
+
|
365 |
+
python_embeded\python.exe -m pip install basicsr
|
366 |
+
|
367 |
+
### **VI. "fatal: fetch-pack: invalid index-pack output" при исполнении команды `git clone`"**
|
368 |
+
|
369 |
+
Попробуйте клонировать репозиторий с параметром `--depth=1` (только последний коммит):
|
370 |
+
|
371 |
+
git clone --depth=1 https://github.com/Gourieff/comfyui-reactor-node
|
372 |
+
|
373 |
+
Затем вытяните оставшееся (если требуется):
|
374 |
+
|
375 |
+
git fetch --unshallow
|
376 |
+
|
377 |
+
<a name="updating">
|
378 |
+
|
379 |
+
## Обновление
|
380 |
+
|
381 |
+
Положите .bat или .sh скрипт из [данного репозитория](https://github.com/Gourieff/sd-webui-extensions-updater) в папку `ComfyUI\custom_nodes` и запустите, когда желаете обновить ComfyUI и Ноды
|
382 |
+
|
383 |
+
<a name="disclaimer">
|
384 |
+
|
385 |
+
## Ответственность
|
386 |
+
|
387 |
+
Это программное обеспечение призвано стать продуктивным вкладом в быстрорастущую медиаиндустрию на основе генеративных сетей и искусственного интеллекта. Данное ПО поможет художникам в решении таких задач, как анимация собственного персонажа или использование персонажа в качестве модели для одежды и т.д.
|
388 |
+
|
389 |
+
Разработчики этого программного обеспечения осведомлены о возможных неэтичных применениях и обязуются принять против этого превентивные меры. Мы продолжим развивать этот проект в позитивном направлении, придерживаясь закона и этики.
|
390 |
+
|
391 |
+
Подразумевается, что пользователи этого программного обеспечения будут использовать его ответственно, соблюдая локальное законодательство. Если используется лицо реального человека, пользователь обязан получить согласие заинтересованного лица и четко указать, что это дипфейк при размещении контента в Интернете. **Разработчики и Со-авторы данного программного обеспечения не несут ответственности за действия конечных пользователей.**
|
392 |
+
|
393 |
+
Используя данное расширение, вы соглашаетесь не создавать материалы, которые:
|
394 |
+
- нарушают какие-либо действующие законы тех или иных государств или международных организаций;
|
395 |
+
- причиняют какой-либо вред человеку или лицам;
|
396 |
+
- пропагандируют любую информацию (как общедоступную, так и личную) или изображения (как общедоступные, так и личные), которые могут быть направлены на причинение вреда;
|
397 |
+
- используются для распространения дезинформации;
|
398 |
+
- нацелены на уязвимые группы людей.
|
399 |
+
|
400 |
+
Данное программное обеспечение использует предварительно обученные модели `buffalo_l` и `inswapper_128.onnx`, представленные разработчиками [InsightFace](https://github.com/deepinsight/insightface/). Эти модели распространяются при следующих условиях:
|
401 |
+
|
402 |
+
[Перевод из текста лицензии insighface](https://github.com/deepinsight/insightface/tree/master/python-package): Предварительно обученные модели InsightFace доступны только для некоммерческих исследовательских целей. Сюда входят как модели с автоматической загрузкой, так и модели, загруженные вручную.
|
403 |
+
|
404 |
+
Пользователи данного программного обеспечения должны строго соблюдать данные условия использования. Разработчики и Со-авторы данного программного продукта не несут ответственности за неправильное использование предварительно обученных моделей InsightFace.
|
405 |
+
|
406 |
+
Обратите внимание: если вы собираетесь использовать это программное обеспечение в каких-либо коммерческих целях, вам необходимо будет обучить свои собственные модели или найти модели, которые можно использовать в коммерческих целях.
|
407 |
+
|
408 |
+
### Хэш файлов моделей
|
409 |
+
|
410 |
+
#### Безопасные для использования модели имеют следующий хэш:
|
411 |
+
|
412 |
+
inswapper_128.onnx
|
413 |
+
```
|
414 |
+
MD5:a3a155b90354160350efd66fed6b3d80
|
415 |
+
SHA256:e4a3f08c753cb72d04e10aa0f7dbe3deebbf39567d4ead6dce08e98aa49e16af
|
416 |
+
```
|
417 |
+
|
418 |
+
1k3d68.onnx
|
419 |
+
|
420 |
+
```
|
421 |
+
MD5:6fb94fcdb0055e3638bf9158e6a108f4
|
422 |
+
SHA256:df5c06b8a0c12e422b2ed8947b8869faa4105387f199c477af038aa01f9a45cc
|
423 |
+
```
|
424 |
+
|
425 |
+
2d106det.onnx
|
426 |
+
|
427 |
+
```
|
428 |
+
MD5:a3613ef9eb3662b4ef88eb90db1fcf26
|
429 |
+
SHA256:f001b856447c413801ef5c42091ed0cd516fcd21f2d6b79635b1e733a7109dbf
|
430 |
+
```
|
431 |
+
|
432 |
+
det_10g.onnx
|
433 |
+
|
434 |
+
```
|
435 |
+
MD5:4c10eef5c9e168357a16fdd580fa8371
|
436 |
+
SHA256:5838f7fe053675b1c7a08b633df49e7af5495cee0493c7dcf6697200b85b5b91
|
437 |
+
```
|
438 |
+
|
439 |
+
genderage.onnx
|
440 |
+
|
441 |
+
```
|
442 |
+
MD5:81c77ba87ab38163b0dec6b26f8e2af2
|
443 |
+
SHA256:4fde69b1c810857b88c64a335084f1c3fe8f01246c9a191b48c7bb756d6652fb
|
444 |
+
```
|
445 |
+
|
446 |
+
w600k_r50.onnx
|
447 |
+
|
448 |
+
```
|
449 |
+
MD5:80248d427976241cbd1343889ed132b3
|
450 |
+
SHA256:4c06341c33c2ca1f86781dab0e829f88ad5b64be9fba56e56bc9ebdefc619e43
|
451 |
+
```
|
452 |
+
|
453 |
+
**Пожалуйста, сравните хэш, если вы скачиваете данные модели из непроверенных источников**
|
454 |
+
|
455 |
+
<a name="credits">
|
456 |
+
|
457 |
+
## Благодарности и авторы компонентов
|
458 |
+
|
459 |
+
<details>
|
460 |
+
<summary><a>Нажмите, чтобы посмотреть</a></summary>
|
461 |
+
|
462 |
+
<br>
|
463 |
+
|
464 |
+
|файл|источник|лицензия|
|
465 |
+
|----|--------|--------|
|
466 |
+
|[buffalo_l.zip](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/buffalo_l.zip) | [DeepInsight](https://github.com/deepinsight/insightface) |  |
|
467 |
+
| [codeformer-v0.1.0.pth](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/facerestore_models/codeformer-v0.1.0.pth) | [sczhou](https://github.com/sczhou/CodeFormer) |  |
|
468 |
+
| [GFPGANv1.3.pth](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/facerestore_models/GFPGANv1.3.pth) | [TencentARC](https://github.com/TencentARC/GFPGAN) |  |
|
469 |
+
| [GFPGANv1.4.pth](https://huggingface.co/datasets/Gourieff/ReActor/blob/main/models/facerestore_models/GFPGANv1.4.pth) | [TencentARC](https://github.com/TencentARC/GFPGAN) |  |
|
470 |
+
| [inswapper_128.onnx](https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnx) | [DeepInsight](https://github.com/deepinsight/insightface) |  |
|
471 |
+
| [inswapper_128_fp16.onnx](https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128_fp16.onnx) | [Hillobar](https://github.com/Hillobar/Rope) |  |
|
472 |
+
|
473 |
+
[BasicSR](https://github.com/XPixelGroup/BasicSR) - [@XPixelGroup](https://github.com/XPixelGroup) <br>
|
474 |
+
[facexlib](https://github.com/xinntao/facexlib) - [@xinntao](https://github.com/xinntao) <br>
|
475 |
+
|
476 |
+
[@s0md3v](https://github.com/s0md3v), [@henryruhs](https://github.com/henryruhs) - оригинальное приложение Roop <br>
|
477 |
+
[@ssitu](https://github.com/ssitu) - первая версия расширения с поддержкой ComfyUI [ComfyUI_roop](https://github.com/ssitu/ComfyUI_roop)
|
478 |
+
|
479 |
+
</details>
|
480 |
+
|
481 |
+
<a name="note">
|
482 |
+
|
483 |
+
### Обратите внимание!
|
484 |
+
|
485 |
+
**Если у вас возникли какие-либо ошибки при очередном использовании Нода ReActor - не торопитесь открывать Issue, для начала попробуйте удалить текущий Нод из вашего рабочего пространства и добавить его снова**
|
486 |
+
|
487 |
+
**ReActor Node периодически получает обновления, появляются новые функции, из-за чего имеющийся Нод может работать с ошибками или не работать вовсе**
|
pyproject.toml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
name = "comfyui-reactor-node"
|
3 |
+
description = "The Fast and Simple Face Swap Extension Node for ComfyUI, based on ReActor SD-WebUI Face Swap Extension"
|
4 |
+
version = "0.5.2-b1"
|
5 |
+
license = { file = "LICENSE" }
|
6 |
+
dependencies = ["insightface==0.7.3", "onnx>=1.14.0", "opencv-python>=4.7.0.72", "numpy==1.26.3", "segment_anything", "albumentations>=1.4.16", "ultralytics"]
|
7 |
+
|
8 |
+
[project.urls]
|
9 |
+
Repository = "https://github.com/Gourieff/comfyui-reactor-node"
|
10 |
+
# Used by Comfy Registry https://comfyregistry.org
|
11 |
+
|
12 |
+
[tool.comfy]
|
13 |
+
PublisherId = "gourieff"
|
14 |
+
DisplayName = "comfyui-reactor-node"
|
15 |
+
Icon = ""
|
reactor_patcher.py
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os.path as osp
|
2 |
+
import glob
|
3 |
+
import logging
|
4 |
+
import insightface
|
5 |
+
from insightface.model_zoo.model_zoo import ModelRouter, PickableInferenceSession
|
6 |
+
from insightface.model_zoo.retinaface import RetinaFace
|
7 |
+
from insightface.model_zoo.landmark import Landmark
|
8 |
+
from insightface.model_zoo.attribute import Attribute
|
9 |
+
from insightface.model_zoo.inswapper import INSwapper
|
10 |
+
from insightface.model_zoo.arcface_onnx import ArcFaceONNX
|
11 |
+
from insightface.app import FaceAnalysis
|
12 |
+
from insightface.utils import DEFAULT_MP_NAME, ensure_available
|
13 |
+
from insightface.model_zoo import model_zoo
|
14 |
+
import onnxruntime
|
15 |
+
import onnx
|
16 |
+
from onnx import numpy_helper
|
17 |
+
from scripts.reactor_logger import logger
|
18 |
+
|
19 |
+
|
20 |
+
def patched_get_model_log(self, **kwargs):
|
21 |
+
session = PickableInferenceSession(self.onnx_file, **kwargs)
|
22 |
+
print(f'Applied providers: {session._providers}, with options: {session._provider_options}')
|
23 |
+
inputs = session.get_inputs()
|
24 |
+
input_cfg = inputs[0]
|
25 |
+
input_shape = input_cfg.shape
|
26 |
+
outputs = session.get_outputs()
|
27 |
+
|
28 |
+
if len(outputs) >= 5:
|
29 |
+
return RetinaFace(model_file=self.onnx_file, session=session)
|
30 |
+
elif input_shape[2] == 192 and input_shape[3] == 192:
|
31 |
+
return Landmark(model_file=self.onnx_file, session=session)
|
32 |
+
elif input_shape[2] == 96 and input_shape[3] == 96:
|
33 |
+
return Attribute(model_file=self.onnx_file, session=session)
|
34 |
+
elif len(inputs) == 2 and input_shape[2] == 128 and input_shape[3] == 128:
|
35 |
+
return INSwapper(model_file=self.onnx_file, session=session)
|
36 |
+
elif len(inputs) == 2 and input_shape[2] == 256 and input_shape[3] == 256:
|
37 |
+
return INSwapper(model_file=self.onnx_file, session=session)
|
38 |
+
elif input_shape[2] == input_shape[3] and input_shape[2] >= 112 and input_shape[2] % 16 == 0:
|
39 |
+
return ArcFaceONNX(model_file=self.onnx_file, session=session)
|
40 |
+
else:
|
41 |
+
return None
|
42 |
+
|
43 |
+
def patched_get_model(self, **kwargs):
|
44 |
+
session = PickableInferenceSession(self.onnx_file, **kwargs)
|
45 |
+
inputs = session.get_inputs()
|
46 |
+
input_cfg = inputs[0]
|
47 |
+
input_shape = input_cfg.shape
|
48 |
+
outputs = session.get_outputs()
|
49 |
+
|
50 |
+
if len(outputs) >= 5:
|
51 |
+
return RetinaFace(model_file=self.onnx_file, session=session)
|
52 |
+
elif input_shape[2] == 192 and input_shape[3] == 192:
|
53 |
+
return Landmark(model_file=self.onnx_file, session=session)
|
54 |
+
elif input_shape[2] == 96 and input_shape[3] == 96:
|
55 |
+
return Attribute(model_file=self.onnx_file, session=session)
|
56 |
+
elif len(inputs) == 2 and input_shape[2] == 128 and input_shape[3] == 128:
|
57 |
+
return INSwapper(model_file=self.onnx_file, session=session)
|
58 |
+
elif len(inputs) == 2 and input_shape[2] == 256 and input_shape[3] == 256:
|
59 |
+
return INSwapper(model_file=self.onnx_file, session=session)
|
60 |
+
elif input_shape[2] == input_shape[3] and input_shape[2] >= 112 and input_shape[2] % 16 == 0:
|
61 |
+
return ArcFaceONNX(model_file=self.onnx_file, session=session)
|
62 |
+
else:
|
63 |
+
return None
|
64 |
+
|
65 |
+
|
66 |
+
def patched_faceanalysis_init(self, name=DEFAULT_MP_NAME, root='~/.insightface', allowed_modules=None, **kwargs):
|
67 |
+
onnxruntime.set_default_logger_severity(3)
|
68 |
+
self.models = {}
|
69 |
+
self.model_dir = ensure_available('models', name, root=root)
|
70 |
+
onnx_files = glob.glob(osp.join(self.model_dir, '*.onnx'))
|
71 |
+
onnx_files = sorted(onnx_files)
|
72 |
+
for onnx_file in onnx_files:
|
73 |
+
model = model_zoo.get_model(onnx_file, **kwargs)
|
74 |
+
if model is None:
|
75 |
+
print('model not recognized:', onnx_file)
|
76 |
+
elif allowed_modules is not None and model.taskname not in allowed_modules:
|
77 |
+
print('model ignore:', onnx_file, model.taskname)
|
78 |
+
del model
|
79 |
+
elif model.taskname not in self.models and (allowed_modules is None or model.taskname in allowed_modules):
|
80 |
+
self.models[model.taskname] = model
|
81 |
+
else:
|
82 |
+
print('duplicated model task type, ignore:', onnx_file, model.taskname)
|
83 |
+
del model
|
84 |
+
assert 'detection' in self.models
|
85 |
+
self.det_model = self.models['detection']
|
86 |
+
|
87 |
+
|
88 |
+
def patched_faceanalysis_prepare(self, ctx_id, det_thresh=0.5, det_size=(640, 640)):
|
89 |
+
self.det_thresh = det_thresh
|
90 |
+
assert det_size is not None
|
91 |
+
self.det_size = det_size
|
92 |
+
for taskname, model in self.models.items():
|
93 |
+
if taskname == 'detection':
|
94 |
+
model.prepare(ctx_id, input_size=det_size, det_thresh=det_thresh)
|
95 |
+
else:
|
96 |
+
model.prepare(ctx_id)
|
97 |
+
|
98 |
+
|
99 |
+
def patched_inswapper_init(self, model_file=None, session=None):
|
100 |
+
self.model_file = model_file
|
101 |
+
self.session = session
|
102 |
+
model = onnx.load(self.model_file)
|
103 |
+
graph = model.graph
|
104 |
+
self.emap = numpy_helper.to_array(graph.initializer[-1])
|
105 |
+
self.input_mean = 0.0
|
106 |
+
self.input_std = 255.0
|
107 |
+
if self.session is None:
|
108 |
+
self.session = onnxruntime.InferenceSession(self.model_file, None)
|
109 |
+
inputs = self.session.get_inputs()
|
110 |
+
self.input_names = []
|
111 |
+
for inp in inputs:
|
112 |
+
self.input_names.append(inp.name)
|
113 |
+
outputs = self.session.get_outputs()
|
114 |
+
output_names = []
|
115 |
+
for out in outputs:
|
116 |
+
output_names.append(out.name)
|
117 |
+
self.output_names = output_names
|
118 |
+
assert len(self.output_names) == 1
|
119 |
+
input_cfg = inputs[0]
|
120 |
+
input_shape = input_cfg.shape
|
121 |
+
self.input_shape = input_shape
|
122 |
+
self.input_size = tuple(input_shape[2:4][::-1])
|
123 |
+
|
124 |
+
|
125 |
+
def pathced_retinaface_prepare(self, ctx_id, **kwargs):
|
126 |
+
if ctx_id<0:
|
127 |
+
self.session.set_providers(['CPUExecutionProvider'])
|
128 |
+
nms_thresh = kwargs.get('nms_thresh', None)
|
129 |
+
if nms_thresh is not None:
|
130 |
+
self.nms_thresh = nms_thresh
|
131 |
+
det_thresh = kwargs.get('det_thresh', None)
|
132 |
+
if det_thresh is not None:
|
133 |
+
self.det_thresh = det_thresh
|
134 |
+
input_size = kwargs.get('input_size', None)
|
135 |
+
if input_size is not None and self.input_size is None:
|
136 |
+
self.input_size = input_size
|
137 |
+
|
138 |
+
|
139 |
+
def patch_insightface(get_model, faceanalysis_init, faceanalysis_prepare, inswapper_init, retinaface_prepare):
|
140 |
+
insightface.model_zoo.model_zoo.ModelRouter.get_model = get_model
|
141 |
+
insightface.app.FaceAnalysis.__init__ = faceanalysis_init
|
142 |
+
insightface.app.FaceAnalysis.prepare = faceanalysis_prepare
|
143 |
+
insightface.model_zoo.inswapper.INSwapper.__init__ = inswapper_init
|
144 |
+
insightface.model_zoo.retinaface.RetinaFace.prepare = retinaface_prepare
|
145 |
+
|
146 |
+
|
147 |
+
# original_functions = [ModelRouter.get_model, FaceAnalysis.__init__, FaceAnalysis.prepare, INSwapper.__init__, RetinaFace.prepare]
|
148 |
+
original_functions = [patched_get_model_log, FaceAnalysis.__init__, FaceAnalysis.prepare, INSwapper.__init__, RetinaFace.prepare]
|
149 |
+
patched_functions = [patched_get_model, patched_faceanalysis_init, patched_faceanalysis_prepare, patched_inswapper_init, pathced_retinaface_prepare]
|
150 |
+
|
151 |
+
|
152 |
+
def apply_patch(console_log_level):
|
153 |
+
if console_log_level == 0:
|
154 |
+
patch_insightface(*patched_functions)
|
155 |
+
logger.setLevel(logging.WARNING)
|
156 |
+
elif console_log_level == 1:
|
157 |
+
patch_insightface(*patched_functions)
|
158 |
+
logger.setLevel(logging.STATUS)
|
159 |
+
elif console_log_level == 2:
|
160 |
+
patch_insightface(*original_functions)
|
161 |
+
logger.setLevel(logging.INFO)
|