Detailer (SEGS) with auto retry
Re-rolls the region when it comes back black
- image
- segs
- model
- clip
- vae
- positive
- negative
- detailer_hook
- scheduler_func_opt
- IMAGE
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.
Inputs (28)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| segs | SEGS | — | |
| model | MODEL | If the `ImpactDummyInput` is connected to the model, the inference stage is skipped. | |
| clip | CLIP | — | |
| vae | VAE | — | |
| guide_size | FLOAT | 51264–16384 | — |
| guide_size_for | BOOLEAN | true | — |
| max_size | FLOAT | 102464–16384 | — |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 8.000–100 | — |
| sampler_name | COMBO | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 | |
| scheduler | COMBO | 17 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +11 | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| denoise | FLOAT | 0.500.0001–1 | — |
| feather | INT | 50–100 | — |
| noise_mask | BOOLEAN | true | — |
| force_inpaint | BOOLEAN | true | — |
| wildcard | STRING | — | |
| cycle | INT | 11–10 | — |
| max_retries | INT | 11–10 | — |
| detailer_hookopt | DETAILER_HOOK | — | |
| inpaint_modelopt | BOOLEAN | false | — |
| noise_mask_featheropt | INT | 200–100 | — |
| scheduler_func_optopt | SCHEDULER_FUNC | — | |
| tiled_encodeopt | BOOLEAN | false | — |
| tiled_decodeopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |