什么是 ESRGAN?
在扩散模型(Stable Diffusion 等)流行之前,图像生成的主角是 GAN。
ESRGAN 是从那个 GAN 世代继承下来的放大用的模型。
ESRGAN 是用于将低分辨率的图像放大为高分辨率的 超分辨率 GAN。
不是单纯的扩大,而是一边补画“像那样的细节”一边扩大为 2〜4 倍。
与扩散模型的放大相比非常轻量,所以现在活跃的机会也很多呢。
模型的下载
根据用途有数量繁多的模型,暂且试着使用以下的模型吧。
RealESRGAN
ComfyUI Manager→Model Manager- 搜索
RealESRGAN x4并Install。
- 共有着由有志者开发的模型。
- 也有专注于清理的模型等,光是看着也很开心呢。
用 ESRGAN 放大

{
"id": "a244ccf2-5842-47ed-a7fe-5252c37bb979",
"revision": 0,
"last_node_id": 5,
"last_link_id": 6,
"nodes": [
{
"id": 3,
"type": "UpscaleModelLoader",
"pos": [
451.29150787007677,
-191.52546058515136
],
"size": [
260,
58
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "UPSCALE_MODEL",
"type": "UPSCALE_MODEL",
"links": [
2
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "UpscaleModelLoader"
},
"widgets_values": [
"RealESRGAN_x4.pth"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 1,
"type": "ImageUpscaleWithModel",
"pos": [
747.4225780470904,
-133.04868614724018
],
"size": [
247.4365767045455,
46
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "upscale_model",
"type": "UPSCALE_MODEL",
"link": 2
},
{
"name": "image",
"type": "IMAGE",
"link": 1
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
6
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ImageUpscaleWithModel"
},
"color": "#232",
"bgcolor": "#353"
},
{
"id": 4,
"type": "SaveImage",
"pos": [
1029.6592249286493,
-133.04868614724018
],
"size": [
322.72727272727275,
387.2727272727272
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 6
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 2,
"type": "LoadImage",
"pos": [
451.29150787007677,
-75.36269847873763
],
"size": [
261.33100000000013,
357.303
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
1
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"A_01.jpg",
"image"
]
}
],
"links": [
[
1,
2,
0,
1,
1,
"IMAGE"
],
[
2,
3,
0,
1,
0,
"UPSCALE_MODEL"
],
[
6,
1,
0,
4,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.9090909090909091,
"offset": [
82.10849212992323,
466.42546058515137
]
},
"frontendVersion": "1.34.6",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
- 🟩 在
Load Upscale Model节点读取任意的模型。
修正倍率
像 RealESRGAN x4 那样大体上放大器都有 x4 这样的文字。
这是倍率,使用这个模型放大的话会 强制地 变为 4 倍。
但是,例如组装进 Hires.fix 的工作流时等 4 倍太大了。 这种时候追加缩小放大器变大了的图像的处理。
工作流

{
"id": "a244ccf2-5842-47ed-a7fe-5252c37bb979",
"revision": 0,
"last_node_id": 5,
"last_link_id": 5,
"nodes": [
{
"id": 5,
"type": "ImageScaleBy",
"pos": [
1024.6577912673977,
-133.04868614724018
],
"size": [
210,
82
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 4
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
5
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ImageScaleBy"
},
"widgets_values": [
"nearest-exact",
0.5
],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 4,
"type": "SaveImage",
"pos": [
1263.9592249286482,
-133.04868614724018
],
"size": [
322.72727272727275,
387.2727272727272
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 5
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 1,
"type": "ImageUpscaleWithModel",
"pos": [
747.9197809016003,
-133.04868614724018
],
"size": [
247.4365767045455,
46
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "upscale_model",
"type": "UPSCALE_MODEL",
"link": 2
},
{
"name": "image",
"type": "IMAGE",
"link": 1
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
4
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ImageUpscaleWithModel"
},
"widgets_values": [],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 3,
"type": "UpscaleModelLoader",
"pos": [
451.29150787007677,
-191.52546058515136
],
"size": [
260,
58
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "UPSCALE_MODEL",
"type": "UPSCALE_MODEL",
"links": [
2
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "UpscaleModelLoader"
},
"widgets_values": [
"RealESRGAN_x4.pth"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 2,
"type": "LoadImage",
"pos": [
451.29150787007677,
-75.36269847873763
],
"size": [
261.33100000000013,
357.303
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
1
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"A_01.jpg",
"image"
]
}
],
"links": [
[
1,
2,
0,
1,
1,
"IMAGE"
],
[
2,
3,
0,
1,
0,
"UPSCALE_MODEL"
],
[
4,
1,
0,
5,
0,
"IMAGE"
],
[
5,
5,
0,
4,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 1.1,
"offset": [
-190.3824169609858,
406.9800060396968
]
},
"frontendVersion": "1.34.6",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
- 🟨 变更
scale_by的值可以调整倍率。
用 GFPGAN 只修正脸
作为 脸(Face)专用的复原 GAN 有名为 GFPGAN 的东西。
是检测因噪声崩溃的脸,靠拢“学习过的漂亮的脸”重画类型的模型。
有时会在 FaceSwap 节点等的后处理以“顺便只整理脸”的用途登场。
详细的使用方法这里不处理,只要记住 “有专门修脸的收尾用 GAN” 的程度就足够了。