Nodes/ComfyUI Impact Pack/Detailer (SEGS) with auto retry
ComfyUI Node Runs on cloud

Detailer (SEGS) with auto retry

Re-rolls the region when it comes back black

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
Detailer (SEGS) with auto retry
  • image
  • segs
  • model
  • clip
  • vae
  • positive
  • negative
  • detailer_hook
  • scheduler_func_opt
  • IMAGE
guide_size512
guide_size_fortrue
max_size1024
seed0
steps20
cfg8.00
sampler_name
scheduler
denoise0.50
feather5
noise_masktrue
force_inpainttrue
wildcard
cycle1
max_retries1
inpaint_modelfalse
noise_mask_feather20
tiled_encodefalse
tiled_decodefalse

Detailer (SEGS) with auto retry is the ordinary SEGS detailer with one paranoia feature added: if a refined region comes out as a solid black patch, it re-rolls that region instead of pasting the garbage back. Same crop-resample-paste engine, same inputs, plus a single max_retries knob. If you've ever run a big batch overnight and found one face turned into a black square, this is the node that would have saved it.

The black-patch failure is a real, if occasional, thing. A sampling pass on a cropped region can collapse - a bad seed, an NaN somewhere in the model, a checkpoint that doesn't like the crop - and produce nothing but black. The plain Detailer (SEGS) will happily composite that void back onto your image. This variant checks the result, and when the patch is all black it samples again with a bumped seed, up to your retry limit. It's insurance, not a different technique.

How it works

For each region in the incoming SEGS, it does exactly what the standard detailer does: crop, scale toward guide_size, run an img2img pass at full resolution, feather, and paste back. The one addition is a check after sampling. If the refined crop is entirely black, it retries that region - up to max_retries times - before giving up and moving on. Everything else about the node is identical to Detailer (SEGS), so anything you know about tuning that transfers here unchanged.

The inputs and outputs that matter

The one you're here for:

  • max_retries (default 1) - how many extra attempts a black region gets. 1 catches the common one-off; raise it if a particular model is flaky. It costs nothing when regions succeed, since the retry only fires on failure.

The rest are the standard detailer controls:

  • image, segs (required) - the picture and the regions to refine.
  • model, clip, vae, positive, negative (required) - checkpoint and conditioning for the refinement pass.
  • guide_size (default 512) - the size each crop is scaled to before resampling, where the added detail comes from.
  • denoise (default 0.5) - how far the region departs from the original. 0.3–0.4 for a clean-up that stays on-model; higher regenerates more.
  • feather (default 5) - softens the paste edge.
  • cycle (default 1) - refine passes per region.
  • wildcard - optional per-detection prompt.

Optional inpaint_model, tiled_encode/tiled_decode, and detailer_hook are there for advanced setups. The single output is IMAGE - your frame with each region refined, and any black misfires re-rolled.

How to install it

Install the pack via ComfyUI Manager (search ComfyUI Impact Pack, install, restart), or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack comfyui-impact-pack
cd comfyui-impact-pack
python -m pip install -r requirements.txt   # ComfyUI's python; python_embeded on portable

then restart. The node needs no models itself; the detector feeding its SEGS does - usually the Impact Subpack for UltralyticsDetectorProvider. Linux: libgl1-mesa-glx and libglib2.0-0 for OpenCV.

Common issues & troubleshooting

Every region keeps retrying and still comes back black. Retries won't fix a systemic problem. Persistent black patches usually mean a broken VAE, an fp16 overflow (try the fp16-fixed VAE or a bf16 model), or a checkpoint that's incompatible with the crop resolution. Raising max_retries just burns time - fix the root cause.

Do I even need this over the plain detailer? For a handful of interactive images, no - you'd just re-run. For unattended batches, yes: it stops one bad seed from silently ruining a frame you won't look at until later. That's the whole case for it.

It's slower than expected. Only when it's actually retrying. If it feels slow with no black regions, that's the normal detailer cost - each region is a full sampling pass, and more regions means more passes.

CategoryImpactPack/Detailer

Inputs (28)

NameTypeDefaultDescription
imageIMAGE
segsSEGS
modelMODELIf the `ImpactDummyInput` is connected to the model, the inference stage is skipped.
clipCLIP
vaeVAE
guide_sizeFLOAT51264–16384
guide_size_forBOOLEANtrue
max_sizeFLOAT102464–16384
seedINT00–18446744073709550000
stepsINT201–10000
cfgFLOAT8.000–100
sampler_nameCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO17 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +11
positiveCONDITIONING
negativeCONDITIONING
denoiseFLOAT0.500.0001–1
featherINT50–100
noise_maskBOOLEANtrue
force_inpaintBOOLEANtrue
wildcardSTRING
cycleINT11–10
max_retriesINT11–10
detailer_hookoptDETAILER_HOOK
inpaint_modeloptBOOLEANfalse
noise_mask_featheroptINT200–100
scheduler_func_optoptSCHEDULER_FUNC
tiled_encodeoptBOOLEANfalse
tiled_decodeoptBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE