Skip to content

alessandroperilli/comfyui-reactor-node

 
 

Repository files navigation

logo

Version


Commit activity Last commit Opened issues Closed issues License

English | Русский

ReActor Node for ComfyUI

The Fast and Simple Face Swap Extension Node for ComfyUI, based on ReActor SD-WebUI Face Swap Extension

This Node goes without NSFW filter (uncensored, use it on your own responsibility)

Support Me on Boosty
Support This Project
ReActor Node is an extension for ComfyUI that allows a very easy and accurate face-replacement (face swap) in images Support Me via PayPal
Donate to This Project
demo

Installation

SD WebUI: AUTOMATIC1111 or SD.Next
  1. Close (stop) your SD-WebUI/Comfy Server if it's running
  2. (For Windows Users):
  3. Go to the extensions\sd-webui-comfyui\ComfyUI\custom_nodes
  4. Open Console or Terminal and run git clone https://github.com/Gourieff/comfyui-reactor-node
  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
  6. python -m pip install -U pip
  7. cd extensions\sd-webui-comfyui\ComfyUI\custom_nodes\comfyui-reactor-node
  8. python install.py
  9. Please, wait until the installation process will be finished
  10. (From the version 0.3.0) Download facerestorers models from the links below and put them into the extensions\sd-webui-comfyui\ComfyUI\custom_nodes\comfyui-reactor-node\models\facerestore_models directory:
  11. Run SD WebUI and check console for the message that ReActor Node is running:
console_status_running
  1. Go to the ComfyUI tab and find there ReActor Node inside the menu image/postprocessing or by using a search:
webui-demo webui-demo
Standalone (Portable) ComfyUI for Windows
  1. Do the following:
  2. Go to the ComfyUI\custom_nodes directory
  3. Open Console and run git clone https://github.com/Gourieff/comfyui-reactor-node
  4. Run install.bat
  5. (From the version 0.3.0) Download facerestorers models from the links below and put them into the ComfyUI\models\facerestore_models directory:
  6. Run ComfyUI and find there ReActor Node inside the menu image/postprocessing or by using a search

Usage

Just connect all required nodes and run the query.

Face Restoration

From the version 0.3.0 ReActor Node has a buil-in face restoration.
Just download the models you want (see 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.

Face Indexes

ReActor detects faces in images in the following order:
left->right, top->bottom

And if you need to specify faces, you can set indexes for source and input images.

Index of the first detected face is 0.

You can set indexes in the order you need.
E.g.: 0,1,2 (for Source); 1,0,2 (for Input).
This means: the second Input face (index = 1) will be swapped by the first Source face (index = 0) and so on.

Genders

You can specify the gender to detect in images.
ReActor will swap a face only if it meets the given condition.

Troubleshooting

  1. (ComfyUI Portable) From the root folder check the version of Python:
    run CMD and type python_embeded\python.exe -V
  2. Download prebuilt Insightface package for Python 3.10 or for Python 3.11 (if in the previous step you see 3.11) 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
  3. From the root folder run:
    • (SD WebUI) CMD and .\venv\Scripts\activate
    • (ComfyUI Portable) run CMD
  4. Then update your PIP:
    • (SD WebUI) python -m pip install -U pip
    • (ComfyUI Portable) python_embeded\python.exe -m pip install -U pip
  5. Then install Insightface:
    • (SD WebUI) pip install insightface-0.7.3-cp310-cp310-win_amd64.whl
    • (ComfyUI Portable) python_embeded\python.exe -m pip install insightface-0.7.3-cp310-cp310-win_amd64.whl
  6. Enjoy!

II. "AttributeError: 'NoneType' object has no attribute 'get'"

This error may occur if there's smth wrong with the model file inswapper_128.onnx

Try to download it manually from here and put it to the ComfyUI\models\insightface replacing existing one

III. "reactor.execute() got an unexpected keyword argument 'reference_image'"

This means that input points have been changed with the latest update
Remove the current ReActor Node from your workflow and add it again

IV. ControlNet Aux Node IMPORT failed error when using with ReActor Node

  1. Close ComfyUI if it runs
  2. Go to the ComfyUI root folder, open CMD there and run:
    • python_embeded\python.exe -m pip uninstall -y opencv-python opencv-contrib-python opencv-python-headless
    • python_embeded\python.exe -m pip install opencv-python==4.7.0.72
  3. That's it!

reactor+controlnet

Updating

Just put .bat or .sh script from this Repo to the ComfyUI\custom_nodes directory and run it when you need to check for updates

Disclaimer

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.

The developers of this software are aware of its possible unethical applicaitons 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.

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.

By using this extension you are agree not to create any content that:

  • violates any laws;
  • causes any harm to a person or persons;
  • propogates (spreads) any information (both public or personal) or images (both public or personal) which could be meant for harm;
  • spreads misinformation;
  • targets vulnerable groups of people.

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

ReActor Node gets updates from time to time, new functions appears and old node can work with errors or not work at all

About

Fast and Simple Face Swap Extension Node for ComfyUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.8%
  • Batchfile 0.2%