Create README_ZH.md
Browse files- README_ZH.md +116 -0
README_ZH.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div style="display: flex; justify-content: center; align-items: center;">
|
| 2 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/alibaba.png" alt="alibaba" style="width: 20%; height: auto; margin-right: 5%;">
|
| 3 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/alimama.png" alt="alimama" style="width: 20%; height: auto;">
|
| 4 |
+
</div>
|
| 5 |
+
|
| 6 |
+
# FLUX.1-dev ControlNet 图像修复 - Beta版
|
| 7 |
+
|
| 8 |
+
本仓库包含了由阿里妈妈创意团队开发的[alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha](https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha)模型的改进版图像修复ControlNet权重和推理代码。
|
| 9 |
+
|
| 10 |
+
## 主要改进
|
| 11 |
+
|
| 12 |
+
与之前版本相比,我们最新的图像修复模型带来了以下改进:
|
| 13 |
+
|
| 14 |
+
1. **支持1024分辨率**: 能够直接处理和生成1024x1024分辨率的图像,无需额外的放大步骤,提供更高质量和更详细的输出结果。
|
| 15 |
+
2. **增强细节生成**: 经过微调以捕捉和重现修复区域的更精细细节。
|
| 16 |
+
3. **改进提示词控制**: 通过增强的提示词解释,对生成内容提供更精确的控制。
|
| 17 |
+
|
| 18 |
+
## 展示示例
|
| 19 |
+
|
| 20 |
+
以下图像是使用ComfyUI工作流生成的([点击此处下载](https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/alimama-creative-flux-inapint-cn-beta.json)),设置如下:
|
| 21 |
+
`control-strength` = 1.0, `control-end-percent` = 1.0, `true_cfg` = 1.0
|
| 22 |
+
|
| 23 |
+
| 图像 & 提示词输入 | Alpha 版本 | Beta 版本 |
|
| 24 |
+
|-----------------------------------------------------|----------------------------------------------------|----------------------------------------------------|
|
| 25 |
+
|
| 26 |
+
<div align = "center">
|
| 27 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/1_0.png" width = "30%" style="display:inline-block;" />
|
| 28 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/1_1.png" width = "30%" style="display:inline-block;" />
|
| 29 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/1_2.png" width = "30%" style="display:inline-block;"/>
|
| 30 |
+
<br>
|
| 31 |
+
提示词 : <i>'在木板上写几行"alimama creative"字样'</i>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<div align = "center">
|
| 35 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/2_0.png" width = "30%" style="display:inline-block;" />
|
| 36 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/2_1.png" width = "30%" style="display:inline-block;" />
|
| 37 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/2_2.png" width = "30%" style="display:inline-block;"/>
|
| 38 |
+
<br>
|
| 39 |
+
提示词 : <i>"一个女孩,有漂亮的大白翅膀"</i>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<div align = "center">
|
| 43 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/3_0.png" width = "30%" style="display:inline-block;" />
|
| 44 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/3_1.png" width = "30%" style="display:inline-block;" />
|
| 45 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/3_2.png" width = "30%" style="display:inline-block;"/>
|
| 46 |
+
<br>
|
| 47 |
+
提示词 : <i>"红色头发"</i>
|
| 48 |
+
</div>
|
| 49 |
+
|
| 50 |
+
<div align = "center">
|
| 51 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/4_0.png" width = "30%" style="display:inline-block;" />
|
| 52 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/4_1.png" width = "30%" style="display:inline-block;" />
|
| 53 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/4_2.png" width = "30%" style="display:inline-block;"/>
|
| 54 |
+
<br>
|
| 55 |
+
提示词 : <i>" "</i>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
<div align = "center">
|
| 59 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/5_0.png" width = "30%" style="display:inline-block;" />
|
| 60 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/5_1.png" width = "30%" style="display:inline-block;" />
|
| 61 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/5_2.png" width = "30%" style="display:inline-block;"/>
|
| 62 |
+
<br>
|
| 63 |
+
提示词 : <i>"阿尔伯特·爱因斯坦"</i>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<div align = "center">
|
| 67 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/6_0.png" width = "30%" style="display:inline-block;" />
|
| 68 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/6_1.png" width = "30%" style="display:inline-block;" />
|
| 69 |
+
<img src="https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/6_2.png" width = "30%" style="display:inline-block;"/>
|
| 70 |
+
<br>
|
| 71 |
+
提示词 : <i>"Ravello户外沙发组合配咖啡桌"</i>
|
| 72 |
+
</div>
|
| 73 |
+
|
| 74 |
+
### ComfyUI使用指南:
|
| 75 |
+
|
| 76 |
+
下载示例ComfyUI工作流[点击这里](https://huggingface.co/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Alpha/resolve/main/images/alimama-creative-flux-inapint-cn-beta.json)。
|
| 77 |
+
|
| 78 |
+
- 使用`t5xxl-FP16`和`flux1-dev-fp8`模型进行30步推理@1024px & H20 GPU:
|
| 79 |
+
- GPU内存使用: 27GB
|
| 80 |
+
- 推理时间: 48秒 (true_cfg=3.5), 26秒 (true_cfg=1)
|
| 81 |
+
|
| 82 |
+
- 通过调整以下参数可以获得不同的结果:
|
| 83 |
+
|
| 84 |
+
| 参数 | 推荐范围 | 效果 |
|
| 85 |
+
|-----------|------------------|--------|
|
| 86 |
+
| control-strength | 0.6 - 1.0 | 控制ControlNet对生成的影响程度。较高的值会使生成结果更严格地遵循控制图像。 |
|
| 87 |
+
| controlend-percent | 0.35 - 1.0 | 决定ControlNet影响在去噪过程中的哪一步结束。较低的值在后期步骤中允许更多的创意自由。 |
|
| 88 |
+
| true-cfg (无分类器引导尺度) | 1.0 或 3.5 | 影响生成结果对提示词的遵循程度。较高的值会增加对提示词的遵循,但可能降低图像质量。 |
|
| 89 |
+
|
| 90 |
+
- 更全面的整图提示词可以带来更好的整体效果。例如,除了描述需要修复的区域,你还可以描述整个图像的背景、氛围和风格。这种方法可以使生成的结果更加和谐自然。
|
| 91 |
+
|
| 92 |
+
## Diffusers 推理
|
| 93 |
+
|
| 94 |
+
1. 安装所需的diffusers版本:
|
| 95 |
+
```shell
|
| 96 |
+
pip install diffusers==0.30.2
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
2. 克隆此仓库:
|
| 100 |
+
```shell
|
| 101 |
+
git clone https://github.com/alimama-creative/FLUX-Controlnet-Inpainting.git
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
3. 在`main.py`中配置`image_path`、`mask_path`和`prompt`,然后执行:
|
| 105 |
+
```shell
|
| 106 |
+
python main.py
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
## 模型说明
|
| 110 |
+
|
| 111 |
+
- 训练数据集: 来自LAION2B和专有来源的1500万张图像
|
| 112 |
+
- 最佳推理分辨率: 1024x1024
|
| 113 |
+
|
| 114 |
+
## 许可证
|
| 115 |
+
|
| 116 |
+
我们的模型权重在[FLUX.1 [dev]](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)非商业许可下发布。
|