Skip to content

Commit

Permalink
support selet reference face from one image
Browse files Browse the repository at this point in the history
  • Loading branch information
lldacing committed Feb 18, 2025
1 parent 7d7f6a0 commit d5cc097
Show file tree
Hide file tree
Showing 6 changed files with 603 additions and 13 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Must uninstall or disable `ComfyUI-PuLID-Flux` and other PuLID-Flux nodes before
Need upgrade ComfyUI Version>=0.3.7

## Update logs
### 2025.02.18
- Supported selecting a face from multiple faces as a reference.
### 2025.01.27
- Changed the model path of facexlib to `ComfyUI/models/facexlib/`.
- When automatically downloading, modify the path of Antelope v2 model to `ComfyUI/models/insightface/models/antelopev2/`.
Expand All @@ -18,6 +20,7 @@ Need upgrade ComfyUI Version>=0.3.7
## Preview (Image with WorkFlow)
![save api extended](examples/PuLID_with_speedup.png)
![save api extended](examples/PuLID_with_attn_mask.png)
![save api extended](examples/PuLID_select_ref_face.png)

## Install

Expand Down Expand Up @@ -73,6 +76,18 @@ Failed to build insightface
- If you want use with [Comfy-WaveSpeed](https://github.com/chengzeyi/Comfy-WaveSpeed), must put it before node `ApplyFBCacheOnModel`.
- FixPulidFluxPatch (Deprecated)
- If you want use with [TeaCache](https://github.com/ali-vilab/TeaCache), must link it after node `ApplyPulidFlux`, and link node [`FluxForwardOverrider` and `ApplyTeaCachePatch`](https://github.com/lldacing/ComfyUI_Patches_ll) after it.
- PulidFluxOptions
- `input_faces_order` - Sorting rule for detected bboxes.
- `left-right`: Sort the left boundary of bbox by column from left to right.
- `right-left`: Reverse order of `left-right` (Sort the left boundary of bbox by column from right to left).
- `top-bottom`: Sort the top boundary of bbox by row from top to bottom.
- `bottom-top`: Reverse order of `top-bottom` (Sort the top boundary of bbox by row from bottom to top).
- `small-large`: Sort the area of bbox from small to large.
- `large-small`: Sort the area of bbox from large to small.
- `input_faces_index` - The target index of the sorted bboxes.
- PulidFluxFaceDetector
- Can check the facial features applied in `ApplyPulidFlux`.
- The `embed_face` and `align_face` should be the same face, but they produce different detectors, and the number detected may be not consistent, so they may be not the same face.

## Thanks

Expand Down
15 changes: 15 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
ComfyUI主体版本需要>=0.3.7

## 更新日志
### 2025.02.18
- 支持从含有多张脸的图片中选择一张脸作为参考。
### 2025.01.27
- 修改 facexlib 的模型路径为 `ComfyUI/models/facexlib/`.
- 自动下载时 修改 Antelopev2 模型的路径为 `ComfyUI/models/insightface/models/antelopev2/`.
Expand All @@ -18,6 +20,7 @@ ComfyUI主体版本需要>=0.3.7
## 预览 (图片含工作流)
![save api extended](examples/PuLID_with_speedup.png)
![save api extended](examples/PuLID_with_attn_mask.png)
![save api extended](examples/PuLID_select_ref_face.png)

## 安装

Expand Down Expand Up @@ -69,6 +72,18 @@ Failed to build insightface
- 使用 [Comfy-WaveSpeed](https://github.com/chengzeyi/Comfy-WaveSpeed)加速, 必须加在[`ApplyFBCacheOnModel`](https://github.com/lldacing/ComfyUI_Patches_ll)之前.
- FixPulidFluxPatch (已弃用)
- 如果想使用 [TeaCache](https://github.com/ali-vilab/TeaCache)加速, 必须加在 `ApplyPulidFlux` 节点之后, 并在后面连接节点 [`FluxForwardOverrider` and `ApplyTeaCachePatch`](https://github.com/lldacing/ComfyUI_Patches_ll).
- PulidFluxOptions
- `input_faces_order` - 对检测到的脸部边界框的排序规则。
- `left-right`: 按列从左到右对bbox的左边界进行排序。
- `right-left`: `left-right`的倒序(按列从右到左对bbox的左边界进行排序)。
- `top-bottom`: 按行从上到下对bbox的顶部边界进行排序。
- `bottom-top`: `top-bottom`的倒序(按行从下到上对bbox的顶部边界进行排序)。
- `small-large`: 按bbox的面积从小到大排序。
- `large-small`: 按bbox的面积从大到小排序。
- `input_faces_index` - 从排序后的bbox选取的索引号。
- PulidFluxFaceDetector
- 用来检查在`ApplyPulidFlux`实际使用的面部特征。
- `embed_face``align_face` 理论上应该是同一张脸,但它们产生不同的探测器,可能检测到的数量不一致,因此两张图可能不是同一张脸。

## 感谢

Expand Down
Binary file added examples/PuLID_select_ref_face.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d5cc097

Please sign in to comment.