Detailerとは?

Stable Diffusion 1.5 がもっとも得意なのは、だいたい 512〜768px 前後の画像です。
この解像度で全身を描いたとき、1人あたりの「顔」に使えるピクセル数は 30〜50px 程度しかありません。
解像度の問題もありますが、画面全体から見ると顔があまりにも小さく、
AI にとっても「細かい作業」になりすぎてしまいます。人間と同じように、細かい作業はAIも得意ではありません。
それならばいっそ、顔の部分だけ切り抜き、描き直したものを元の画像に貼り戻してしまえばいいんじゃない? という発想が出ました。
この 「切り抜き → 拡大 → inpaint → 元画像に貼り戻し」 という一連の処理を、 Detailer といいます。
なぜDetailerが必要なのか
「画像全体をアップスケールして inpaint すればいいのでは?」という考え方もあります。
しかし、inpainting の計算量は、マスクの大きさではなく 元画像のサイズ で決まります。
4K の画像があったとき、顔だけを塗り直したい場合でも、4K 全体ぶんの計算が発生してしまい非常に非効率です。
Detailer は、inpaintしたい周辺領域だけ切り抜くため無駄がありません。
カスタムノード
一般的には、Impact Pack に含まれる Detailer ノードを使います。
こちらのほうが物体検出まで含めた自動化が出来るので多機能なのですが、独自パラメータが多く難しいため、別で改めて扱います。
マスクとクロップ領域
マスクとクロップ領域の違いを確認しておきましょう。

- マスク:本当に書き換えたい部分(顔そのもの など)
- クロップ領域:マスクや BBOX を少しだけ広げた「作業用キャンバス」
Detailer は、このクロップ領域のみで行うinpaintingです。
✂️ Inpaint Crop

{
"id": "3b990c76-d92c-49ec-8f4c-6f3d1cbcc594",
"revision": 0,
"last_node_id": 13,
"last_link_id": 20,
"nodes": [
{
"id": 3,
"type": "LoadImage",
"pos": [
158.8744138939285,
364.03294906356285
],
"size": [
371.9572329709805,
583.1414645379411
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
1
]
},
{
"name": "MASK",
"type": "MASK",
"links": [
7
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoadImage",
"image": "clipspace/clipspace-painted-masked-1765174382492.png [input]"
},
"widgets_values": [
"clipspace/clipspace-painted-masked-1765174382492.png [input]",
"image"
]
},
{
"id": 4,
"type": "PreviewImage",
"pos": [
921.2483639847512,
364.03294906356285
],
"size": [
301.62904350112717,
344.36448181818173
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 2
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 12,
"type": "MaskPreview",
"pos": [
921.2483639847512,
763.842428144825
],
"size": [
307.83944479576166,
349.81618240301236
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "mask",
"type": "MASK",
"link": 18
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "MaskPreview"
},
"widgets_values": []
},
{
"id": 1,
"type": "InpaintCropImproved",
"pos": [
572.237278935808,
364.03294906356285
],
"size": [
307.6054529780441,
626
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 1
},
{
"name": "mask",
"shape": 7,
"type": "MASK",
"link": 7
},
{
"name": "optional_context_mask",
"shape": 7,
"type": "MASK",
"link": null
}
],
"outputs": [
{
"name": "stitcher",
"type": "STITCHER",
"links": []
},
{
"name": "cropped_image",
"type": "IMAGE",
"links": [
2
]
},
{
"name": "cropped_mask",
"type": "MASK",
"links": [
18
]
}
],
"properties": {
"cnr_id": "comfyui-inpaint-cropandstitch",
"ver": "a5fbe06f766ec237f304fb65bb94c0f255060109",
"Node name for S&R": "InpaintCropImproved"
},
"widgets_values": [
"bilinear",
"bicubic",
false,
"ensure minimum resolution",
1024,
1024,
16384,
16384,
true,
0,
false,
32,
0.1,
false,
1,
1,
1,
1,
1.2,
true,
512,
512,
"32"
],
"color": "#232",
"bgcolor": "#353"
}
],
"links": [
[
1,
3,
0,
1,
0,
"IMAGE"
],
[
2,
1,
1,
4,
0,
"IMAGE"
],
[
7,
3,
1,
1,
1,
"MASK"
],
[
18,
1,
2,
12,
0,
"MASK"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.9229599817706445,
"offset": [
160.30085263487416,
-190.57364276738986
]
},
"frontendVersion": "1.34.6",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
workflow を見れば分かるとおり、マスク+元画像 を渡すと、マスクをもとに少し余白を足したクロップ領域を自動で作り、その部分だけを指定サイズにリサイズしてくれます。
かなり多くのパラメータがありますが、基本的には下のものだけ見ておけば十分です。
| パラメータ名 | 役割・意味 |
|---|---|
mask_fill_holes |
マスク内の小さな穴(塗り残し)を自動で埋める |
mask_expand_pixels |
マスクの境界を外側に指定ピクセルぶん広げる |
mask_invert |
マスクを反転する |
mask_blend_pixels |
マスク境界をぼかす。 |
🔥context_from_mask_extend_factor |
マスクからクロップ領域を作るときの「余白の量」を倍率で指定する |
🔥output_target_width |
クロップ後の出力幅(ピクセル)。顔用キャンバスの横サイズなどを指定する |
🔥output_target_height |
クロップ後の出力高さ(ピクセル)。顔用キャンバスの縦サイズなどを指定する |
output_padding |
必要に応じて、解像度をこの値の倍数になるように余白を追加する |
✂️ Inpaint Stitch (Improved)

{
"id": "3b990c76-d92c-49ec-8f4c-6f3d1cbcc594",
"revision": 0,
"last_node_id": 14,
"last_link_id": 25,
"nodes": [
{
"id": 10,
"type": "PreviewImage",
"pos": [
1367.7437333774412,
513.7276442801832
],
"size": [
223.71000000000026,
258
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 16
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 9,
"type": "EmptyImage",
"pos": [
890.6357108398461,
513.7276442801832
],
"size": [
210,
130
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
14
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "EmptyImage"
},
"widgets_values": [
512,
512,
1,
255
]
},
{
"id": 8,
"type": "ImageBlend",
"pos": [
1129.1897221086429,
446.67980912237664
],
"size": [
210,
102
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "image1",
"type": "IMAGE",
"link": 21
},
{
"name": "image2",
"type": "IMAGE",
"link": 14
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
15,
16
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "ImageBlend"
},
"widgets_values": [
0.6,
"normal"
]
},
{
"id": 7,
"type": "PreviewImage",
"pos": [
1641.6985006857185,
364.03294906356285
],
"size": [
414.22380399999975,
591.965072
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 11
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 3,
"type": "LoadImage",
"pos": [
158.8744138939285,
364.03294906356285
],
"size": [
371.9572329709805,
583.1414645379411
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
24
]
},
{
"name": "MASK",
"type": "MASK",
"links": [
25
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoadImage",
"image": "clipspace/clipspace-painted-masked-1765174382492.png [input]"
},
"widgets_values": [
"clipspace/clipspace-painted-masked-1765174382492.png [input]",
"image"
]
},
{
"id": 14,
"type": "InpaintCropImproved",
"pos": [
554.895920077805,
364.03294906356285
],
"size": [
307.6054529780441,
626
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 24
},
{
"name": "mask",
"shape": 7,
"type": "MASK",
"link": 25
},
{
"name": "optional_context_mask",
"shape": 7,
"type": "MASK",
"link": null
}
],
"outputs": [
{
"name": "stitcher",
"type": "STITCHER",
"links": [
20
]
},
{
"name": "cropped_image",
"type": "IMAGE",
"links": [
21
]
},
{
"name": "cropped_mask",
"type": "MASK",
"links": []
}
],
"properties": {
"cnr_id": "comfyui-inpaint-cropandstitch",
"ver": "a5fbe06f766ec237f304fb65bb94c0f255060109",
"Node name for S&R": "InpaintCropImproved"
},
"widgets_values": [
"bilinear",
"bicubic",
false,
"ensure minimum resolution",
1024,
1024,
16384,
16384,
true,
0,
false,
32,
0.1,
false,
1,
1,
1,
1,
1.2,
true,
512,
512,
"32"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 6,
"type": "InpaintStitchImproved",
"pos": [
1372.1887487452448,
364.03294906356285
],
"size": [
241.0976899545639,
46
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "stitcher",
"type": "STITCHER",
"link": 20
},
{
"name": "inpainted_image",
"type": "IMAGE",
"link": 15
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
11
]
}
],
"properties": {
"cnr_id": "comfyui-inpaint-cropandstitch",
"ver": "a5fbe06f766ec237f304fb65bb94c0f255060109",
"Node name for S&R": "InpaintStitchImproved"
},
"widgets_values": [],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[
11,
6,
0,
7,
0,
"IMAGE"
],
[
14,
9,
0,
8,
1,
"IMAGE"
],
[
15,
8,
0,
6,
1,
"IMAGE"
],
[
16,
8,
0,
10,
0,
"IMAGE"
],
[
20,
14,
0,
6,
0,
"STITCHER"
],
[
21,
14,
1,
8,
0,
"IMAGE"
],
[
24,
3,
0,
14,
0,
"IMAGE"
],
[
25,
3,
1,
14,
1,
"MASK"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.8390545288824038,
"offset": [
-58.874413893928505,
-262.84113140979014
]
},
"frontendVersion": "1.34.6",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
✂️ Inpaint Stitch (Improved) ノードは、いじったクロップ画像を元の位置に戻します。
マスクされた部分だけが元画像に上書きされます。
Inpaint Crop and Stitchで手作業Detailer
さて、早速Detailer をやってみましょう。
といっても、inpainting のworkflowに組み込むだけです。

{
"id": "8b9f7796-0873-4025-be3c-0f997f67f866",
"revision": 0,
"last_node_id": 20,
"last_link_id": 26,
"nodes": [
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [
416.1970166015625,
392.37848510742185
],
"size": [
410.75801513671877,
158.82607910156253
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 5
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
6
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"text, watermark"
]
},
{
"id": 13,
"type": "LoadImage",
"pos": [
-294.2855123966943,
742.4170000000003
],
"size": [
371.9572329709805,
583.1414645379411
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
12
]
},
{
"name": "MASK",
"type": "MASK",
"links": [
13
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoadImage",
"image": "clipspace/clipspace-painted-masked-1765174382492.png [input]"
},
"widgets_values": [
"clipspace/clipspace-painted-masked-1765174382492.png [input]",
"image"
]
},
{
"id": 10,
"type": "VAELoader",
"pos": [
132.4262925619836,
611.9892535544651
],
"size": [
281.0743801652891,
58
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "VAE",
"type": "VAE",
"links": [
10,
16
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAELoader"
},
"widgets_values": [
"vae-ft-mse-840000-ema-pruned.safetensors"
]
},
{
"id": 8,
"type": "VAEDecode",
"pos": [
1209,
188
],
"size": [
210,
46
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 7
},
{
"name": "vae",
"type": "VAE",
"link": 10
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"slot_index": 0,
"links": [
18,
19
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "VAEDecode"
},
"widgets_values": []
},
{
"id": 11,
"type": "InpaintStitchImproved",
"pos": [
1449.2712348513148,
738.4170000000003
],
"size": [
241.0976899545639,
46
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "stitcher",
"type": "STITCHER",
"link": 11
},
{
"name": "inpainted_image",
"type": "IMAGE",
"link": 18
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
17
]
}
],
"properties": {
"cnr_id": "comfyui-inpaint-cropandstitch",
"ver": "a5fbe06f766ec237f304fb65bb94c0f255060109",
"Node name for S&R": "InpaintStitchImproved"
},
"widgets_values": [],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 6,
"type": "CLIPTextEncode",
"pos": [
415,
186
],
"size": [
411.95503173828126,
151.0030493164063
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 3
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
4
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"illustration of a portrait, beautifull girl,Open your mouth and close your eyes."
]
},
{
"id": 16,
"type": "PreviewImage",
"pos": [
1477.694978315702,
193.37892043958945
],
"size": [
350.79999999999995,
384.4
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 19
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 9,
"type": "SaveImage",
"pos": [
1724.105085812445,
738.4170000000003
],
"size": [
423.52342840047254,
574.4169798178841
],
"flags": {},
"order": 14,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 17
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 3,
"type": "KSampler",
"pos": [
863,
186
],
"size": [
315,
262
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 26
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 4
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 6
},
{
"name": "latent_image",
"type": "LATENT",
"link": 23
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
7
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "KSampler"
},
"widgets_values": [
12345,
"fixed",
20,
8,
"euler",
"normal",
0.55
]
},
{
"id": 18,
"type": "SetLatentNoiseMask",
"pos": [
634.8898651420305,
682.6952818257673
],
"size": [
180.74765625,
46
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 21
},
{
"name": "mask",
"type": "MASK",
"link": 22
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
23
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "SetLatentNoiseMask"
},
"widgets_values": []
},
{
"id": 15,
"type": "VAEEncode",
"pos": [
454.1952689346516,
682.6952818257673
],
"size": [
140,
46
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "pixels",
"type": "IMAGE",
"link": 14
},
{
"name": "vae",
"type": "VAE",
"link": 16
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
21
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAEEncode"
},
"widgets_values": []
},
{
"id": 12,
"type": "InpaintCropImproved",
"pos": [
101.73599378718188,
742.4170000000003
],
"size": [
307.6054529780441,
626
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 12
},
{
"name": "mask",
"shape": 7,
"type": "MASK",
"link": 13
},
{
"name": "optional_context_mask",
"shape": 7,
"type": "MASK",
"link": null
}
],
"outputs": [
{
"name": "stitcher",
"type": "STITCHER",
"links": [
11
]
},
{
"name": "cropped_image",
"type": "IMAGE",
"links": [
14,
24
]
},
{
"name": "cropped_mask",
"type": "MASK",
"links": [
22
]
}
],
"properties": {
"cnr_id": "comfyui-inpaint-cropandstitch",
"ver": "a5fbe06f766ec237f304fb65bb94c0f255060109",
"Node name for S&R": "InpaintCropImproved"
},
"widgets_values": [
"bilinear",
"bicubic",
false,
"ensure minimum resolution",
1024,
1024,
16384,
16384,
true,
0,
false,
32,
0.1,
false,
1,
1,
1,
1,
1.2,
true,
512,
512,
"32"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 19,
"type": "PreviewImage",
"pos": [
453.71448760330577,
865
],
"size": [
254.39999999999986,
304.29999999999995
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 24
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 4,
"type": "CheckpointLoaderSimple",
"pos": [
38.10000000000001,
363.8900000000004
],
"size": [
315,
98
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
25
]
},
{
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": [
3,
5
]
},
{
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"😎-v1.x\\AuroraONE_F16.safetensors"
]
},
{
"id": 20,
"type": "DifferentialDiffusion",
"pos": [
523.8254088354622,
71.70004836964688
],
"size": [
210,
58
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 25
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
26
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "DifferentialDiffusion"
},
"widgets_values": [
1
],
"color": "#322",
"bgcolor": "#533"
}
],
"links": [
[
3,
4,
1,
6,
0,
"CLIP"
],
[
4,
6,
0,
3,
1,
"CONDITIONING"
],
[
5,
4,
1,
7,
0,
"CLIP"
],
[
6,
7,
0,
3,
2,
"CONDITIONING"
],
[
7,
3,
0,
8,
0,
"LATENT"
],
[
10,
10,
0,
8,
1,
"VAE"
],
[
11,
12,
0,
11,
0,
"STITCHER"
],
[
12,
13,
0,
12,
0,
"IMAGE"
],
[
13,
13,
1,
12,
1,
"MASK"
],
[
14,
12,
1,
15,
0,
"IMAGE"
],
[
16,
10,
0,
15,
1,
"VAE"
],
[
17,
11,
0,
9,
0,
"IMAGE"
],
[
18,
8,
0,
11,
1,
"IMAGE"
],
[
19,
8,
0,
16,
0,
"IMAGE"
],
[
21,
15,
0,
18,
0,
"LATENT"
],
[
22,
12,
2,
18,
1,
"MASK"
],
[
23,
18,
0,
3,
3,
"LATENT"
],
[
24,
12,
1,
19,
0,
"IMAGE"
],
[
25,
4,
0,
20,
0,
"MODEL"
],
[
26,
20,
0,
3,
0,
"MODEL"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.6830134553650707,
"offset": [
394.2855123966943,
28.29995163035312
]
},
"frontendVersion": "1.34.6",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
- 🟩 ベースモデルによって
output_target_width/heightを調整してください。- 今回はSD1.5なので512px
- 🟥 直接 Detailer とは関係ありませんが、Inpaint Crop が「境界をぼかしたマスク」を出力してくれるので、それを活かせる Differential Diffusion とはかなり相性が良いです。
物体検出を組み合わせる
顔のマスクを自動で作成して、少し自動化してみましょう。

{
"id": "8b9f7796-0873-4025-be3c-0f997f67f866",
"revision": 0,
"last_node_id": 21,
"last_link_id": 28,
"nodes": [
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [
416.1970166015625,
392.37848510742185
],
"size": [
410.75801513671877,
158.82607910156253
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 5
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
6
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"text, watermark"
]
},
{
"id": 10,
"type": "VAELoader",
"pos": [
132.4262925619836,
611.9892535544651
],
"size": [
281.0743801652891,
58
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "VAE",
"type": "VAE",
"links": [
10,
16
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAELoader"
},
"widgets_values": [
"vae-ft-mse-840000-ema-pruned.safetensors"
]
},
{
"id": 8,
"type": "VAEDecode",
"pos": [
1209,
188
],
"size": [
210,
46
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 7
},
{
"name": "vae",
"type": "VAE",
"link": 10
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"slot_index": 0,
"links": [
18,
19
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "VAEDecode"
},
"widgets_values": []
},
{
"id": 11,
"type": "InpaintStitchImproved",
"pos": [
1449.2712348513148,
738.4170000000003
],
"size": [
241.0976899545639,
46
],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{
"name": "stitcher",
"type": "STITCHER",
"link": 11
},
{
"name": "inpainted_image",
"type": "IMAGE",
"link": 18
}
],
"outputs": [
{
"name": "image",
"type": "IMAGE",
"links": [
17
]
}
],
"properties": {
"cnr_id": "comfyui-inpaint-cropandstitch",
"ver": "a5fbe06f766ec237f304fb65bb94c0f255060109",
"Node name for S&R": "InpaintStitchImproved"
},
"widgets_values": [],
"color": "#432",
"bgcolor": "#653"
},
{
"id": 6,
"type": "CLIPTextEncode",
"pos": [
415,
186
],
"size": [
411.95503173828126,
151.0030493164063
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 3
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
4
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"illustration of a portrait, beautifull girl,Open your mouth and close your eyes."
]
},
{
"id": 16,
"type": "PreviewImage",
"pos": [
1477.694978315702,
193.37892043958945
],
"size": [
350.79999999999995,
384.4
],
"flags": {},
"order": 14,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 19
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 9,
"type": "SaveImage",
"pos": [
1724.105085812445,
738.4170000000003
],
"size": [
423.52342840047254,
574.4169798178841
],
"flags": {},
"order": 15,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 17
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33"
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 3,
"type": "KSampler",
"pos": [
863,
186
],
"size": [
315,
262
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 28
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 4
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 6
},
{
"name": "latent_image",
"type": "LATENT",
"link": 23
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
7
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "KSampler"
},
"widgets_values": [
12345,
"fixed",
20,
8,
"euler",
"normal",
0.55
]
},
{
"id": 18,
"type": "SetLatentNoiseMask",
"pos": [
634.8898651420305,
682.6952818257673
],
"size": [
180.74765625,
46
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 21
},
{
"name": "mask",
"type": "MASK",
"link": 22
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
23
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "SetLatentNoiseMask"
},
"widgets_values": []
},
{
"id": 15,
"type": "VAEEncode",
"pos": [
454.1952689346516,
682.6952818257673
],
"size": [
140,
46
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{
"name": "pixels",
"type": "IMAGE",
"link": 14
},
{
"name": "vae",
"type": "VAE",
"link": 16
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
21
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "VAEEncode"
},
"widgets_values": []
},
{
"id": 12,
"type": "InpaintCropImproved",
"pos": [
101.73599378718188,
742.4170000000003
],
"size": [
307.6054529780441,
626
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 12
},
{
"name": "mask",
"shape": 7,
"type": "MASK",
"link": 26
},
{
"name": "optional_context_mask",
"shape": 7,
"type": "MASK",
"link": null
}
],
"outputs": [
{
"name": "stitcher",
"type": "STITCHER",
"links": [
11
]
},
{
"name": "cropped_image",
"type": "IMAGE",
"links": [
14,
24
]
},
{
"name": "cropped_mask",
"type": "MASK",
"links": [
22
]
}
],
"properties": {
"cnr_id": "comfyui-inpaint-cropandstitch",
"ver": "a5fbe06f766ec237f304fb65bb94c0f255060109",
"Node name for S&R": "InpaintCropImproved"
},
"widgets_values": [
"bilinear",
"bicubic",
false,
"ensure minimum resolution",
1024,
1024,
16384,
16384,
true,
0,
false,
32,
0.1,
false,
1,
1,
1,
1,
1.2,
true,
512,
512,
"32"
],
"color": "#232",
"bgcolor": "#353"
},
{
"id": 19,
"type": "PreviewImage",
"pos": [
453.71448760330577,
865
],
"size": [
254.39999999999986,
304.29999999999995
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 24
}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
},
{
"id": 13,
"type": "LoadImage",
"pos": [
-604.2329203606309,
742.4170000000003
],
"size": [
371.9572329709805,
583.1414645379411
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
12,
25
]
},
{
"name": "MASK",
"type": "MASK",
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "LoadImage",
"image": "clipspace/clipspace-painted-masked-1765182779878.png [input]"
},
"widgets_values": [
"clipspace/clipspace-painted-masked-1765182779878.png [input]",
"image"
]
},
{
"id": 20,
"type": "SAM3Segment",
"pos": [
-214.09484680123433,
828.8728691744416
],
"size": [
297.6500000000001,
332
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 25
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": []
},
{
"name": "MASK",
"type": "MASK",
"links": [
26
]
},
{
"name": "MASK_IMAGE",
"type": "IMAGE",
"links": null
}
],
"properties": {
"cnr_id": "comfyui-rmbg",
"ver": "2.9.4",
"Node name for S&R": "SAM3Segment"
},
"widgets_values": [
"face",
"sam3",
"Auto",
0.5,
0,
0,
false,
"Alpha",
"#222222"
],
"color": "#223",
"bgcolor": "#335"
},
{
"id": 4,
"type": "CheckpointLoaderSimple",
"pos": [
38.10000000000001,
363.8900000000004
],
"size": [
315,
98
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
27
]
},
{
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": [
3,
5
]
},
{
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": []
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.33",
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": [
"😎-v1.x\\AuroraONE_F16.safetensors"
]
},
{
"id": 21,
"type": "DifferentialDiffusion",
"pos": [
534.4404368428528,
62.781508537241564
],
"size": [
210,
58
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 27
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
28
]
}
],
"properties": {
"cnr_id": "comfy-core",
"ver": "0.3.76",
"Node name for S&R": "DifferentialDiffusion"
},
"widgets_values": [
1
],
"color": "#323",
"bgcolor": "#535"
}
],
"links": [
[
3,
4,
1,
6,
0,
"CLIP"
],
[
4,
6,
0,
3,
1,
"CONDITIONING"
],
[
5,
4,
1,
7,
0,
"CLIP"
],
[
6,
7,
0,
3,
2,
"CONDITIONING"
],
[
7,
3,
0,
8,
0,
"LATENT"
],
[
10,
10,
0,
8,
1,
"VAE"
],
[
11,
12,
0,
11,
0,
"STITCHER"
],
[
12,
13,
0,
12,
0,
"IMAGE"
],
[
14,
12,
1,
15,
0,
"IMAGE"
],
[
16,
10,
0,
15,
1,
"VAE"
],
[
17,
11,
0,
9,
0,
"IMAGE"
],
[
18,
8,
0,
11,
1,
"IMAGE"
],
[
19,
8,
0,
16,
0,
"IMAGE"
],
[
21,
15,
0,
18,
0,
"LATENT"
],
[
22,
12,
2,
18,
1,
"MASK"
],
[
23,
18,
0,
3,
3,
"LATENT"
],
[
24,
12,
1,
19,
0,
"IMAGE"
],
[
25,
13,
0,
20,
0,
"IMAGE"
],
[
26,
20,
1,
12,
1,
"MASK"
],
[
27,
4,
0,
21,
0,
"MODEL"
],
[
28,
21,
0,
3,
0,
"MODEL"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.6830134553650707,
"offset": [
704.2329203606309,
37.218491462758436
]
},
"frontendVersion": "1.34.6",
"VHS_latentpreview": false,
"VHS_latentpreviewrate": 0,
"VHS_MetadataImage": true,
"VHS_KeepIntermediate": true
},
"version": 0.4
}
- 🟦 SAM 3を使って顔のマスクを作成します。
Detailerの基礎はこれだけなので、もう十分使いこなせると思います。
ただ、画像に映った複数の人物をまとめて検出して、一気に処理したい……となるとImpactPackを使用する必要があります。
サンプル画像
