MCPcopy Index your code
hub / github.com/GraftingRayman/Comfyui-reactor-node

github.com/GraftingRayman/Comfyui-reactor-node @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,308 symbols 3,633 edges 151 files 424 documented · 32%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

logo

Version

Support Me on Boosty

<sup>
  Support This Project
</sup>


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

By using this Node you understand the responsibility)


What's new | Installation | Usage | Troubleshooting | Updating | Disclaimer | Credits | Note!


demo

What's new in the latest update

0.5.2 ALPHA1

  • New node "Unload ReActor Models" - is useful for complex WFs when you need to free some VRAM utilized by ReActor
  • Support of ORT CoreML and ROCM EPs, just install onnxruntime version you need
  • Install script improvements to install latest versions of ORT-GPU

Previous versions

0.5.1

  • Support of GPEN 1024/2048 restoration models (available in the HF dataset https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models)
  • 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)

0.5.1-whatsnew-01

Full size demo preview

  • Sorting facemodels alphabetically
  • A lot of fixes and improvements

0.5.0 BETA4

  • Spandrel lib support for GFPGAN

0.5.0 BETA3

  • Fixes: "RAM issue", "No detection" for MaskingHelper

0.5.0 BETA2

  • 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"
  • Huge performance boost of the image analyzer's module! 10x speed up! Working with videos is now a pleasure!

0.5.0-whatsnew-05

0.5.0 BETA1

  • SWAPPED_FACE output for the Masking Helper Node
  • FIX: Empty A-channel for Masking Helper IMAGE output (causing errors with some nodes) was removed

0.5.0 ALPHA1

  • ReActorBuildFaceModel Node got "face_model" output to provide a blended face model directly to the main Node:

Basic workflow 💾

  • Face Masking feature is available now, just add the "ReActorMaskHelper" Node to the workflow and connect it as shown below:

0.5.0-whatsnew-01

If you don't have the "face_yolov8m.pt" Ultralytics model - you can download it from the Assets and put it into the "ComfyUI\models\ultralytics\bbox" directory

As well as "sam_vit_b_01ec64.pth" model - download (if you don't have it) and put it into the "ComfyUI\models\sams" directory;

Use this Node to gain the best results of the face swapping process:

0.5.0-whatsnew-02

  • 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):

0.5.0-whatsnew-03

  • 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)!

0.5.0-whatsnew-04

  • Little speed boost when analyzing target images (unfortunately it is still quite slow in compare to swapping and restoring...)

0.4.2

  • GPEN-BFR-512 and RestoreFormer_Plus_Plus face restoration models support

You can download models here: https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models

Put them into the ComfyUI\models\facerestore_models folder

0.4.2-whatsnew-04

  • 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;

Experiment and create new faces or blend faces of one person to gain better accuracy and likeness!

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:

0.4.2-whatsnew-01

Result example (the new face was created from 4 faces of different actresses):

0.4.2-whatsnew-02

Basic workflow 💾

0.4.1

  • 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)
  • Issue https://github.com/Gourieff/comfyui-reactor-node/issues/173 fix

  • 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)

  • (Windows) Installation can be done for Python from the System's PATH
  • Different fixes and improvements

  • Face Restore Visibility and CodeFormer Weight (Fidelity) options are now available! Don't forget to reload the Node in your existing workflow

0.4.1-whatsnew-01

0.4.0

  • Input "input_image" goes first now, it gives a correct bypass and also it is right to have the main input first;
  • 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:

0.4.0-whatsnew-01 0.4.0-whatsnew-02

  • Ability to build and save face models directly from an image:

0.4.0-whatsnew-03

  • Both the inputs are optional, just connect one of them according to your workflow; if both is connected - image has a priority.
  • Different fixes making this extension better.

Thanks to everyone who finds bugs, suggests new features and supports this project!

Installation

SD WebUI: AUTOMATIC1111 or SD.Next

  1. Close (stop) your SD-WebUI/Comfy Server if it's running
  2. (For Windows Users):
  3. Install Visual Studio 2022 (Community version - you need this step to build Insightface)
  4. OR only VS C++ Build Tools and select "Desktop Development with C++" under "Workloads -> Desktop & Mobile"
  5. OR if you don't want to install VS or VS C++ BT - follow this steps (sec. I)
  6. Go to the extensions\sd-webui-comfyui\ComfyUI\custom_nodes
  7. Open Console or Terminal and run git clone https://github.com/Gourieff/ComfyUI-ReActor
  8. Go to the SD WebUI root folder, open Console or Terminal and run (Windows users).\venv\Scripts\activate or (Linux/MacOS)venv/bin/activate
  9. python -m pip install -U pip
  10. cd extensions\sd-webui-comfyui\ComfyUI\custom_nodes\comfyui-reactor-node
  11. python install.py
  12. Please, wait until the installation process will be finished
  13. (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:

https://huggingface.co/datasets/Gourieff/ReActor/tree/main/models/facerestore_models 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 ReActor or by using a search: webui-demo webui-demo

Standalone (Portable) ComfyUI for Windows

  1. Do the following:
  2. Install Visual Studio 2022 (Community version - you need this step to build Insightface)
  3. OR only VS C++ Build Tools and select "Desktop Development with C++" under "Workloads -> Desktop & Mobile"
  4. OR if you don't want to install VS or VS C++ BT - follow this steps (sec. I)
  5. Choose between two options:
  6. (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.
  7. (Manually) Go to ComfyUI\custom_nodes, open Console and run git clone https://github.com/Gourieff/ComfyUI-ReActor
  8. Go to ComfyUI\custom_nodes\comfyui-reactor-node and run install.bat
  9. If you don't have the "face_yolov8m.pt" Ultralytics model - you can download it from the Assets and put it into the "ComfyUI\models\ultralytics\bbox" directory

As well as one or both of "Sams" models from here - download (if you don't have them) and put into the "ComfyUI\models\sams" directory 5. Run ComfyUI and find there ReActor Nodes inside the menu ReActor or by using a search

Core symbols most depended-on inside this repo

get
called by 130
r_basicsr/utils/registry.py
get_root_logger
called by 36
r_basicsr/utils/logger.py
repeat
called by 31
r_basicsr/utils/diffjpeg.py
keys
called by 22
r_basicsr/utils/registry.py
backward
called by 19
r_basicsr/archs/dfdnet_util.py
imfrombytes
called by 17
r_basicsr/utils/img_util.py
normalize
called by 14
scripts/r_archs/vqgan_arch.py
build_loss
called by 14
r_basicsr/losses/__init__.py

Shape

Method 693
Function 357
Class 258

Languages

Python99%
C++1%

Modules by API surface

r_basicsr/archs/swinir_arch.py55 symbols
r_basicsr/archs/stylegan2_arch.py53 symbols
nodes.py53 symbols
r_basicsr/utils/diffjpeg.py48 symbols
r_facelib/detection/yolov5face/models/common.py42 symbols
scripts/r_archs/vqgan_arch.py33 symbols
scripts/r_masking/core.py31 symbols
r_basicsr/data/degradations.py30 symbols
r_basicsr/models/base_model.py26 symbols
r_facelib/detection/retinaface/retinaface_net.py25 symbols
r_basicsr/archs/hifacegan_util.py25 symbols
r_basicsr/ops/dcn/deform_conv.py24 symbols

For agents

$ claude mcp add Comfyui-reactor-node \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact