BFS Best Face Swap

提供商Alissonerdx
分类image-to-image
许可证mit
下载量2.6K
星标36

简介

BFS Best Face Swap 是一款基于 MIT 协议的开源换脸模型,专注于高保真度的面部特征迁移。与传统的简单滤镜不同,它在保持目标人物面部结构的同时,能更自然地融合光影与皮肤纹理,有效降低了换脸后常见的“违和感”。该模型上手门槛极低,非常适合需要快速生成高质量人像素材的创作者。如果你在使用 Stable Diffusion 等工具时觉得内置的换脸插件效果不够细腻,BFS 提供了一个更轻量且精准的替代方案,适用于电商模特替换、虚拟角色创作等实际场景。

核心亮点

  • 高保真面部迁移,光影融合自然不违和
  • MIT 开源协议,开发者可自由集成与商用
  • 操作门槛低,快速生成高质量人像素材
  • 完美适配虚拟角色创作与电商模特替换

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("Alissonerdx/BFS-Best-Face-Swap")
tokenizer = AutoTokenizer.from_pretrained("Alissonerdx/BFS-Best-Face-Swap")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download Alissonerdx/BFS-Best-Face-Swap

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download Alissonerdx/BFS-Best-Face-Swap config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('Alissonerdx/BFS-Best-Face-Swap')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/Alissonerdx/BFS-Best-Face-Swap

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Alissonerdx/BFS-Best-Face-Swap

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('Alissonerdx/BFS-Best-Face-Swap')
tokenizer = AutoTokenizer.from_pretrained('Alissonerdx/BFS-Best-Face-Swap')

模型下载

我们推荐使用命令行或者 ModelScope SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 ModelScope:

操作指引
pip install modelscope

命令行下载

下载完整模型库

下载完整模型库
modelscope download --model Alissonerdx/BFS-Best-Face-Swap

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)
modelscope download --model Alissonerdx/BFS-Best-Face-Swap README.md --local_dir ./dir

更多更丰富的命令行下载选项,可参见具体文档

SDK 下载

SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('Alissonerdx/BFS-Best-Face-Swap')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://www.modelscope.cn/Alissonerdx/BFS-Best-Face-Swap.git

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/Alissonerdx/BFS-Best-Face-Swap.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook 快速开发

下载并安装 ModelScope library

下载并安装 ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

模型加载和推理

模型加载和推理
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'Alissonerdx/BFS-Best-Face-Swap')

完整文档

来源: HuggingFace

---
license: mit
base_model:

  • black-forest-labs/FLUX.2-klein-9B

  • black-forest-labs/FLUX.2-klein-4B

  • black-forest-labs/FLUX.2-klein-base-4B

  • black-forest-labs/FLUX.2-klein-base-9B

  • black-forest-labs/FLUX.2-klein-9b-fp8

  • black-forest-labs/FLUX.2-klein-4b-fp8

  • Qwen/Qwen-Image-Edit-2511

  • krea/Krea-2-Raw

pipeline_tag: image-to-image
tags:
  • lora

  • qwen-image-edit

  • face-swap

  • head-swap

  • body-swap

  • image-editing

  • ai-generated

  • comfyui

  • bfs

  • flux 2

  • flux

  • klein

  • krea2

language:
  • en

library_name: diffusers
---

🧬 BFS — Best Face Swap (Qwen Image Edit, Flux 2 Klein, Krea 2)

The BFS (Best Face Swap) LoRA series was created for Qwen Image Edit 2509/2511, Flux 2 Klein 4b/9b, and Krea 2, designed to perform high-fidelity face, head, and full-person swaps with natural tone blending and consistent lighting.

Each version focuses on a different level of replacement, from subtle face swaps to full head transfers.
Use each LoRA with its matching base model and workflow. Krea 2 head/body workflows are included in the workflows folder.

👉 Workflows for all BFS versions can be downloaded here:
Head/Face Swap Workflow — Qwen Image Edit 2509 (Civitai)

---

🔹 Versions Overview

| Version | File(s) | Description |
|---|---|---|
| BFS Face V1 – 2509 | bfs_face_v1_qwen_image_edit_2509.safetensors | Swaps only the face. Preserves target hair, lighting, and background. |
| BFS Head V1 – 2509 | bfs_head_v1_qwen_image_edit_2509.safetensors | Full head swap with natural blending between head/hair and target body. |
| BFS Head V2 – 2509 | bfs_head_v2_qwen_image_edit_2509.safetensors | Improved skin tone matching, pose alignment, and anatomical consistency. |
| BFS Head V3 – 2509 (Recommended) | bfs_head_v3_qwen_image_edit_2509.safetensors | Stable and accurate. Input order is inverted (body first, then face). |
| BFS Head V4 – 2509/2511 | bfs_head_v4_qwen_image_edit_2509.safetensors | Stronger expression transfer and robustness. Inverted input order. |
| BFS Head V5 – 2511 (Recommended) | bfs_head_v5_2511_original.safetensors<br>bfs_head_v5_2511_merged_version_rank_16_fp16.safetensors<br>bfs_head_v5_2511_merged_version_rank_32_fp32.safetensors | Latest release for 2511 workflows. Inverted input order. See details below. |
| BFS Head V1 – Flux 2 Klein 4/9b (Recommended) | bfs_head_v1_flux-klein_4b.safetensors<br>bfs_head_v1_flux-klein_9b_step3500_rank128.safetensors<br>bfs_head_v1_flux-klein_9b_step3750_rank64.safetensors | Inverted input order. See details below. |
| BFS Head Swap V1.1 – Krea 2 | bfs_head_swap_v1.1_krea2.safetensors | Updated Krea 2 head swap release. Replaces the previous V1 file. |
| BFS Body Swap V1 – Krea 2 (Experimental) | bfs_body_swap_v1_krea2.safetensors | Replaces the person with the reference person. Pose transfer may not always match exactly. |

---

🧠 BFS Head V5 details (2511)

This release includes multiple variants:

  • 100% original: direct result of training for 5,500+ steps on model 2511
  • Merged versions: a merge of BFS Head V4 (2509) into the 2511-trained original

In my evaluation, the merged version performs better, especially at reproducing a wider range of expressions.
It is not perfect yet, but it indicates we are moving in the right direction.

---

🧪 Krea 2 Head and Body Swap

BFS Head Swap V1.1

This is the updated Krea 2 head swap release and replaces bfs_head_swap_v1_krea2.safetensors.

Trigger prompt:

code
head_swap: replace the head with the reference head.

Workflow: workflows/Head Swap Krea 2 - V1 Simple Workflow.json

BFS Body Swap V1 (Experimental)

This is an experimental version. The pose will not always be copied exactly from the original image.

Trigger prompt:

code
body_swap: replace the person with the reference person.

To also change the background, append this below the trigger prompt:

code
BG: [describe the new background]

You can combine the body swap LoRA with the Krea 2 head swap LoRA to improve head identity. As a starting point, use both LoRAs at 0.5 strength, then adjust based on your own tests.

Workflow: workflows/Body Swap Krea 2 - V1 Simple Workflow.json

Feel free to experiment and post your results.

#### Body Swap examples

<p align="center">
<img src="images/bfs_body_swap_v1_krea2_example_yoga.png" width="49%" />
<img src="images/bfs_body_swap_v1_krea2_example_seated.png" width="49%" />
<img src="images/bfs_body_swap_v1_krea2_example_restaurant.png" width="49%" />
<img src="images/bfs_body_swap_v1_krea2_example_kitchen.png" width="49%" />
<img src="images/bfs_body_swap_v1_krea2_example_closeup.png" width="49%" />
<img src="images/bfs_body_swap_v1_krea2_example_outdoors.png" width="49%" />
</p>

---

🖼️ Input Structure (Control Images)

| Version | Image 1 | Image 2 | Notes |
|---|---|---|---|
| Face V1 | Face | Body | Standard order. Swaps face only. |
| Head V1 | Face | Body | Standard order. Full head swap with blending. |
| Head V2 | Face | Body | Standard order. Improved tone and alignment. |
| Head V3 | Body | Face | ⚠️ Inverted order — send body first, then face. |
| Head V4 | Body | Face | ⚠️ Inverted order — send body first, then face. |
| Head V5 | Body | Face | ⚠️ Inverted order — send body first, then face. |
| Head V1 Flux 2 Klein 4/9b | Body | Face | ⚠️ Inverted order — send body first, then face. |
| Krea 2 Head Swap V1.1 | Base image | Reference head | Use the included Krea 2 head workflow. |
| Krea 2 Body Swap V1 | Base image | Reference person | Experimental full-person replacement. |
---

💬 Prompts

🧠 BFS Face V1

Base prompt:

code
face swap face from Image 1 to Image 2.

Alternative:

code
face swap face from Image 1 to Image 2. swap only the face (not the hair), match the skin tone to Image 2, keep Image 2 pose and lighting.

---

🧩 BFS Head V1 – 2509 (Likely works with 2511)

Base prompt:

code
head swap from Image 1 to Image 2

Alternatives:

code
head swap from Image 1 to Image 2 with perfect skin match
Head swap from Image 1 to Image 2, keep all facial details and hair from Image 1, blend naturally with Image 2’s body.
head swap face from Image 1 to Image 2, keep all facial details and hair from Image 1, blend naturally with Image 2’s body, remove all hair of Image 2 and replace by hair from Image 1 and keep the same expression and head proportion as in Image 2

---

🧬 BFS Head V2 – 2509 (Likely works with 2511)

code
head swap, transfer head from Image 1 to Image 2

---

⚡ BFS Head V3 – 2509 (Recommended) (Likely works with 2511)

code
head_swap: start with Picture 1 as the base image, keeping its lighting, environment, and background. remove the head from Picture 1 completely and replace it with the head from Picture 2. ensure the head and body have correct anatomical proportions, and blend the skin tones, shadows, and lighting naturally so the final result appears as one coherent, realistic person.

---

⚡ BFS Head V4 – 2509 (Likely works with 2511)

code
h34d_sw4p: replace the head of Picture 1 by the head from Picture 2, strictly preserving the identity, facial features (eyes, nose, mouth), and skin texture of Picture 2. ensure the new head mimics the identical expression, angle, and rotation found in Picture 1.

---

⚡ BFS Head V5 – 2511 (Recommended)

code
head_swap: start with Picture 1 as the base image, keeping its lighting, environment, and background. remove the head from Picture 1 completely and replace it with the head from Picture 2, strictly preserving the hair, eye color, and nose structure of Picture 2. copy the eye direction, head rotation, and micro-expressions from Picture 1. high quality, sharp details, 4k

⚡ BFS Hea