comfyui-simswap

comfyui-simswap
★ 14

换脸人脸替换SimSwapComfyUI
在ComfyUI中集成SimSwap的简易实现,可在工作流内快速进行人脸换脸并保留身份特征,便于集成与部署。
💡 在ComfyUI流程中快速替换人脸并保留原始身份特征。
🍴 8 Forks💻 Python🔄 2024-07-31
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/8b0992d318c3
📦 requirements.txt
insightface==0.7.3
onnx>=1.14.0
opencv-python>=4.7.0.72
numpy
segment_anything
📄 README

Simswap Node for ComfyUI

A hacky implementation of Simswap based on Comfyui ReActor Node 0.5.1 and Simswap

I just put this together so that I could use Simswap in my workflows. It’s probably bloated with lots of unnecessary code and probably does not work optimally. A lot of the options for Simswap are not exposed and the default values are being used. But it is able to use the simswap model, uniface and also ghost.

Installation

git clone this repo into your comfyui/custom_nodes directory

Models

Download the simswap models from here and place them under comfyui/models/simswap: https://huggingface.co/netrunner-exe/Insight-Swap-models-onnx/tree/main

Download the arcface model from here and place it under comfyui/models/simswap: https://github.com/neuralchen/SimSwap/blob/main/docs/guidance/preparation.md

Download the mask from here and place it under comfyui/models/simswap: https://github.com/zllrunning/face-makeup.PyTorch/blob/master/cp/79999_iter.pth

Download the 512 Net_G model from here and place it under comfyui/models/simswap: https://github.com/neuralchen/SimSwap/releases/download/512_beta/512.zip

^ It should look like comfyui/models/simswap/512/550000_net_G.pth

Edit: I just noticed the insightface model link was broken so I replaced it.

Download the insightface models from here: https://huggingface.co/immich-app/antelopev2/tree/main

You need to rename them both and place them in comfyui/models/simswap/antelope

The recognition model should be named glintr100.onnx

The detection model should be named scrfd_10g_bnkps.onnx

Test

Load up comfyui – place the node and try it out! So far my best results were with ghost_unet_3block, restore face set to gfpgan, codeformer weight to 1.00 and restore face visibility to 0.8.

Final Notes

My objective for this was just to get the simswap model working in ComfyUI for my own workflows. I will not be maintaining it or adding to it. If anyone wants to take over the repo then feel free to contact me. Also feel free to put in your own pull requests!

Thanks and Credits

Thanks to all the creators mentioned in the Reactor Credits, to neuralchen and to Gourrief.

Click to expand

|file|source|license|

|—-|——|——-|

|buffalo_l.zip | DeepInsight | |

| codeformer-v0.1.0.pth | sczhou | |

| GFPGANv1.3.pth | TencentARC | |

| GFPGANv1.4.pth | TencentARC | |

| inswapper_128.onnx | DeepInsight | |

| inswapper_128_fp16.onnx | Hillobar | |

BasicSR@XPixelGroup

facexlib@xinntao

@s0md3v, @henryruhs – the original Roop App

@ssitu – the first version of ComfyUI_roop extension

neuralchen – The official implementation of Simswap

Gourrief – The original implementation of ReActor

And thanks to anyone else that was involved in the creation of this node that I failed to mention.