update README

This commit is contained in:
jueming
2025-04-08 11:03:54 +08:00
parent cfedc90040
commit 6e5e4bcb26
3 changed files with 84 additions and 109 deletions
-86
View File
@@ -1,86 +0,0 @@
# ComfyUI_FaceEnhancer Installation Guide
This guide provides detailed instructions for installing and using the ComfyUI_FaceEnhancer custom node.
## Prerequisites
- Python 3.7 or higher
- CUDA-compatible GPU (recommended)
- ComfyUI already installed and working
## Step 1: Clone the Repository
Clone this repository into your ComfyUI's custom_nodes directory:
```bash
cd /path/to/ComfyUI/custom_nodes/
git clone https://github.com/YourUsername/ComfyUI_FaceEnhancer.git
cd ComfyUI_FaceEnhancer
```
## Step 2: Install Dependencies
Install the required dependencies:
```bash
pip install basicsr basicsr-fixed facexlib realesrgan
pip install -r requirements.txt
```
If you're using a specific CUDA version, you may want to install PyTorch with the appropriate CUDA version:
```bash
pip install --no-cache-dir torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
```
## Step 3: Download Pre-trained Model
Download the GFPGAN pre-trained model:
```bash
mkdir -p models
wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth -P models/
```
Note: If wget is not available on your system, you can manually download the model from the URL and place it in the `models` directory.
## Step 4: Restart ComfyUI
If ComfyUI is already running, restart it to load the new custom node.
## Usage
### Single Image Processing
1. Use the "Load Image" node to load your input image
2. Connect it to the "GFPGAN Face Enhancer" node
3. Configure the parameters:
- version: GFPGAN model version (1.4)
- scale: Upscaling factor (1-4)
- only_center_face: If true, only enhances the center face in the image
- bg_upsampler: Background upsampling method
- output_folder: Directory to save processed images
4. Connect the output to a "Save Image" node
### Video Processing
1. Use the "Load Video" node to load your input video
2. Connect it to the "GFPGAN Face Enhancer" node
3. Configure the parameters as needed
4. Connect the output to a "Video Combine" node to create the enhanced video
## Output Directories
The node creates the following subdirectories in your specified output folder:
- `restored_imgs`: The final enhanced images
- `restored_faces`: Only the enhanced faces
- `cropped_faces`: The original cropped faces
- `cmp`: Comparison images showing before and after
## Troubleshooting
- If you encounter CUDA errors, make sure you have the correct PyTorch version installed for your CUDA version
- If the model fails to download automatically, download it manually and place it in the `models` directory
- For memory issues, try processing images at a smaller scale
- For more complex issues, check the official [GFPGAN repository](https://github.com/TencentARC/GFPGAN)
+84 -20
View File
@@ -1,45 +1,109 @@
# ComfyUI_FaceEnhancer
A ComfyUI custom node for enhancing faces in images and videos using GFPGAN.
基于 GFPGAN 的 ComfyUI 人脸增强自定义节点,可以修复和增强图像和视频中的人脸。
## Installation
## 先决条件
- Python 3.7 或更高版本
- CUDA 兼容的 GPU(推荐)
- ComfyUI 已安装并正常运行
## 安装步骤
### 1. 克隆仓库
将此仓库克隆到您的 ComfyUI 的 custom_nodes 目录:
1. Clone this repository into ComfyUI's custom_nodes directory:
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/YourUsername/ComfyUI_FaceEnhancer.git
cd ComfyUI_FaceEnhancer
```
2. Install the required dependencies:
### 2. 安装 PyTorch
根据您的 CUDA 版本安装适当的 PyTorch 版本:
```bash
# 对于 CUDA 12.1
pip install --no-cache-dir torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
# 对于 CUDA 11.8
pip install --no-cache-dir torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
# 对于 CUDA 11.7
pip install --no-cache-dir torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
# 对于 CPU 版本(不推荐,处理速度会很慢)
pip install --no-cache-dir torch torchvision torchaudio
```
更多安装选项请参考 [PyTorch 官方安装页面](https://pytorch.org/get-started/locally/)。
### 3. 安装其他依赖
```bash
pip install basicsr basicsr-fixed facexlib realesrgan
pip install -r requirements.txt
```
3. Download the pre-trained GFPGAN model:
### 4. 下载预训练模型
```bash
mkdir -p models
wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth -P models/
```
## Usage
注意:如果您的系统没有 wget,可以手动从 URL 下载模型并将其放在 `models` 目录中。
1. In ComfyUI, you'll find a new node called "GFPGAN Face Enhancer"
2. Connect an image or image batch to enhance faces
3. Configure the options and run the workflow
4. The output will be enhanced images with improved facial details
### 5. 重启 ComfyUI
## Options
如果 ComfyUI 已在运行,请重启它以加载新的自定义节点。
- **image**: Input single image
- **image_folder**: Input folder containing multiple images
- **output_folder**: Folder to save results (will create subdirectories)
- **version**: GFPGAN model version (1, 1.2, 1.3, 1.4)
- **scale**: Upscaling factor
- **only_center_face**: Only process the center face
- **bg_upsampler**: Background upsampler method
## 使用方法
## Credits
### 单张图片处理
This node is based on the [GFPGAN project](https://github.com/TencentARC/GFPGAN) by TencentARC.
1. 使用 "Load Image" 节点加载输入图片
2. 连接到 "GFPGAN Face Enhancer" 节点
3. 配置参数:
- version: GFPGAN 模型版本(1.4)
- scale: 放大倍数(1-4)
- only_center_face: 如果为 true,则只处理图像中心的人脸
- bg_upsampler: 背景上采样方法
- output_folder: 保存处理结果的文件夹名称
4. 将输出连接到 "Save Image" 节点保存结果
### 视频处理
1. 使用 "Load Video" 节点加载输入视频
2. 连接到 "GFPGAN Face Enhancer" 节点
3. 配置所需参数
4. 将输出连接到 "Video Combine" 节点创建增强后的视频
### 文件夹处理
1. 使用 "GFPGAN Folder Processor" 节点
2. 指定包含图片的文件夹路径
3. 配置所需参数
4. 节点将处理文件夹中的所有图片并输出增强结果
## 输出目录
节点会在指定的输出文件夹中创建以下子目录:
- `restored_imgs`: 最终增强后的图像
- `restored_faces`: 只包含增强后的人脸
- `cropped_faces`: 原始裁剪的人脸
- `cmp`: 显示处理前后对比的图像
## 故障排除
- 如果遇到 CUDA 错误,请确保您安装了与 CUDA 版本相匹配的 PyTorch 版本
- 如果模型无法自动下载,请手动下载并放在 `models` 目录中
- 对于内存问题,请尝试使用较小的 scale 值处理图像
- 对于更复杂的问题,请查看官方 [GFPGAN 仓库](https://github.com/TencentARC/GFPGAN)
## 致谢
本节点基于 [GFPGAN 项目](https://github.com/TencentARC/GFPGAN) 开发。
-3
View File
@@ -2,9 +2,6 @@ basicsr>=1.4.2
basicsr-fixed>=1.3.6
facexlib>=0.2.5
realesrgan>=0.3.0
torch
torchvision
torchaudio
numpy
opencv-python
Pillow