deepfacelab中文网

 找回密码
 立即注册(仅限QQ邮箱)
查看: 1346|回复: 5

【拯救模糊的素材】DiffBIR WEBUI界面汉化整合包

[复制链接]

8

主题

137

帖子

2683

积分

初级丹圣

Rank: 8Rank: 8

积分
2683

荣誉会员勋章小有贡献勋章

 楼主| 发表于 2023-11-9 15:49:17 | 显示全部楼层 |阅读模式
星级打分
  • 1
  • 2
  • 3
  • 4
  • 5
平均分:NAN  参与人数:0  我的评分:未评
本帖最后由 vancheap 于 2023-11-9 23:29 编辑

项目地址:https://github.com/XPixelGroup/DiffBIR
恢复效果还行,比sd-webui-stablesr强一些,模糊的图片都能生成的比较清晰
默认参数牙齿部分还是有些缺陷,皮肤质感偏细腻
需要设置关键词及细致的调参,尝试不同的seed,或者-1来随机一次多画几张
2.JPG
玩的话非常类似SD

关键词,CFG:玩过SD的都会

控制强度:减小偏向原图,太大会崩坏
迭代步数:减小偏向原图,太大会崩坏,感觉和原图质量有点关系
Seed:很神奇,测试了几十张下来貌似231是最好的
关闭预处理模型:偏向原图,高清的图可以关闭试试看

weights 为模型,按需下载:
脸图只需下face_full_v1+face_swinir_v1,open_clip_pytorch_model.bin必下,realesrgan里面的是命令行用到的模型,SD里面也有

请修改“启动webui_face.bat”里面的DiffBIR路径:set python=E:\AI\DiffBIR\python\python.exe


命令行用法参考README.txt已机翻


Full Pipeline (Remove Degradations & Refine Details)
完整的管道(删除降级和细化细节)

General Image
一般图像
Download general_full_v1.ckpt and general_swinir_v1.ckpt to weights/ and run the following command.
将general_full_v1.ckpt和general_swinir_v1.ckpt下载到weights/并运行以下命令。

python inference.py \
--input inputs/demo/general \
--config configs/model/cldm.yaml \
--ckpt weights/general_full_v1.ckpt \
--reload_swinir --swinir_ckpt weights/general_swinir_v1.ckpt \
--steps 50 \
--sr_scale 4 \
--color_fix_type wavelet \
--output results/demo/general \
--device cuda [--tiled --tile_size 512 --tile_stride 256]

Remove the brackets to enable tiled sampling. If you are confused about where the reload_swinir option came from, please refer to the degradation details.
括号内以启用分割采样。 如果您对reload_swinir选项的来源感到困惑,请参阅降级详细信息。

Face Image
面部图像
The face_full_v1.ckpt will be downloaded from HuggingFace automatically.
face_full_v1.ckpt将自动从HuggingFace下载。

# for aligned face inputs
#用于对齐的面输入

python inference_face.py \
--input inputs/demo/face/aligned \
--sr_scale 1 \
--output results/demo/face/aligned \
--has_aligned \
--device cuda

# for unaligned face inputs
#用于未对齐的面输入

python inference_face.py \
--input inputs/demo/face/whole_img \
--sr_scale 2 \
--output results/demo/face/whole_img \
--bg_upsampler DiffBIR \
--device cuda

Latent Image Guidance (Quality-fidelity trade-off)
潜像引导(质量-保真度权衡)
Latent image guidance is used to achieve a trade-off bwtween quality and fidelity. We default to closing it since we prefer quality rather than fidelity. Here is an example:
潜像引导用于实现质量和保真度之间的折衷。 我们默认关闭它,因为我们更喜欢质量而不是保真度。 下面是一个例子:

python inference.py \
--input inputs/demo/general \
--config configs/model/cldm.yaml \
--ckpt weights/general_full_v1.ckpt \
--reload_swinir --swinir_ckpt weights/general_swinir_v1.ckpt \
--steps 50 \
--sr_scale 4 \
--color_fix_type wavelet \
--output results/demo/general \
--device cuda \
--use_guidance --g_scale 400 --g_t_start 200

You will see that the results become more smooth.
你会看到结果变得更加平滑。

Only Stage1 Model (Remove Degradations)
仅第1阶段模型(删除降解)
Download general_swinir_v1.ckpt, face_swinir_v1.ckpt for general, face image respectively, and run the following command.
分别下载general、face image的general_swinir_v1.ckpt、face_swinir_v1.ckpt,运行以下命令。

python scripts/inference_stage1.py \
--config configs/model/swinir.yaml \
--ckpt [swinir_ckpt_path] \
--input [lq_dir] \
--sr_scale 1 --image_size 512 \
--output [output_dir_path]

Only Stage2 Model (Refine Details)
仅限第2阶段模型(细化细节)

Since the proposed two-stage pipeline is very flexible, you can utilize other awesome models to remove degradations instead of SwinIR and then leverage the Stable Diffusion to refine details.
由于建议的两阶段管道非常灵活,您可以利用其他出色的模型来消除退化,而不是SwinIR,然后利用稳定扩散来细化细节。

# step1: Use other models to remove degradations and save results in [img_dir_path].
# step1:使用其他模型删除降级并将结果保存在[img_dir_path]中。

# step2: Refine details of step1 outputs.
# step2:细化step1输出的细节。

python inference.py \
--config configs/model/cldm.yaml \
--ckpt [full_ckpt_path] \
--steps 50 --sr_scale 1 \
--input [img_dir_path] \
--color_fix_type wavelet \
--output [output_dir_path] \
--disable_preprocess_model \
--device cuda

效果图

1src.jpg 1.jpg






评分

参与人数 1贡献 +1 收起 理由
gotoplay + 1 太好了感谢楼主

查看全部评分

回复

使用道具 举报

1

主题

33

帖子

252

积分

初级丹师

Rank: 3Rank: 3

积分
252
发表于 2023-12-27 20:30:38 | 显示全部楼层
其实配置低的话还是要把素材模糊化了,毕竟我只能跑224的丹,192的质量模糊效果更好。。。
回复 支持 反对

使用道具 举报

1

主题

115

帖子

2453

积分

初级丹圣

Rank: 8Rank: 8

积分
2453

万事如意节日勋章

发表于 2024-1-15 12:38:25 | 显示全部楼层

執行軟件時出現以下錯誤
WARNING: Pretrained weights (e:\ai\diffbir\weights\open_clip_pytorch_model.bin) not found for model vit-h-14.available pretrained tags (['laion2b_s32b_b79k'].
請問 紅字部分路徑能修改嗎 ?
懇請大佬能指點迷津, 感謝您
回复 支持 反对

使用道具 举报

8

主题

137

帖子

2683

积分

初级丹圣

Rank: 8Rank: 8

积分
2683

荣誉会员勋章小有贡献勋章

 楼主| 发表于 2024-1-15 17:15:45 | 显示全部楼层
gotoplay 发表于 2024-1-15 12:38
執行軟件時出現以下錯誤
WARNING: Pretrained weights (e:\ai\diffbir\weights\open_clip_pytorch_model. ...

不太记得哪里有改过这个模型路径了,看文件时间戳我只汉化了gradio_diffbir.py,改名为gradio_diffbir_cn.py,可以在bat里改回原版试试

或者把所有的__pycache__删除试试看
回复 支持 反对

使用道具 举报

1

主题

115

帖子

2453

积分

初级丹圣

Rank: 8Rank: 8

积分
2453

万事如意节日勋章

发表于 2024-1-15 23:15:29 | 显示全部楼层
vancheap 发表于 2024-1-15 17:15
不太记得哪里有改过这个模型路径了,看文件时间戳我只汉化了gradio_diffbir.py,改名为gradio_diffbir_cn ...

感謝大佬 , 問題已經排除了
回复 支持 反对

使用道具 举报

0

主题

209

帖子

1253

积分

初级丹圣

Rank: 8Rank: 8

积分
1253
发表于 2024-3-26 15:53:28 | 显示全部楼层
感谢分享
回复

使用道具 举报

QQ|Archiver|手机版|deepfacelab中文网 |网站地图

GMT+8, 2024-5-18 17:07 , Processed in 0.096307 second(s), 15 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表