ComfyUI Node

DetailerX Masks

See what SAM actually selected before you blame the prompt

By haroonaslam·Created 6 months ago·Updated 11 days ago· 11
DetailerX Masks
  • detailer_masks

    The most common automatic-detailing failure isn't a bad re-render, it's a bad region. The detector found a rock and called it a face, or the mask covers the cheekbone but stops short of the eye you were trying to fix, and you spend twenty minutes tuning denoise for a problem that was never denoise. DetailerX Masks kills that guessing game: it shows the detector's proposal, the SAM-refined mask, and the feathered mask that was actually allowed to change pixels - per detailer, on the exact image that entered it.

    What it is

    It's a viewer. One input, no outputs, and it always executes. You feed it the detailer_masks output from DetailerX and it opens a browsable overlay panel; nothing wires out of it and it changes nothing about your image. In a normal graph you'd need a mask-to-image detour and a folder of PNGs to answer "did the detector hit the right thing." Here you queue once and look.

    How it works

    The input isn't an IMAGE - it's a DETAILERX_MASKS bundle, version 1, built by DetailerX as it runs. For every enabled detector-based detailer it carries the cumulative image entering that stage, three masks (detector, refined, blend), and the metadata that explains them: which backend and detector checkpoint, which class labels, how many regions were found versus how many were actually processed, plus any message from the stage.

    The node validates all of that - mask shapes must match the image batch exactly - then writes the masks out as temporary PNGs under ComfyUI/temp/workflowx_detailer_masks/, in a subfolder keyed to the node's id, deleted and rewritten on every run. The mask files are white RGB with the mask in the alpha channel: a deliberate detail, because CSS image masks read alpha by default and a plain grayscale PNG would paint the whole image instead of the selected region.

    The one input, and what's in the panel

    detailer_masks is the only socket, and it comes off DetailerX's third output. The numeric story lives in the same bundle: a stage that found four faces and processed zero is telling you its thresholds are wrong, and that's visible in region_counts versus processed_counts without touching the overlay at all.

    The stages appear in execution order, and only detector-based ones. Levels, sharpen, grain, LUT, the camera simulator and DLSS5 have no masks, so they never show up here; disabled or hidden detailers don't either. Three views per stage:

    • Detector proposal - what Ultralytics returned. For a SEGM checkpoint that's a polygon; for a plain BBOX checkpoint it's the rectangle that gets dilated into a mask.
    • SAM-refined mask - the SAM result. With SAM switched off for that detailer, this view shows the detector-only mask, which is exactly the comparison you want when deciding whether SAM is earning its cost.
    • Final blend mask - the constrained, feathered mask that actually gets composited. With SAM3, this is the one that shows the post-constraint at work: the refined view is raw SAM before the constraint, the blend view is what survived it.

    Overlay colour and opacity are adjustable, and there's batch navigation for multi-image runs, fit/100% and an enlargement overlay. Explicit "no detection" and "zero denoise" states are shown as states rather than blank panels, which is the small thing that makes this node useful instead of confusing.

    Install

    ComfyUI Manager → WorkflowX-Configurator, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/haroonaslam/WorkflowX-Configurator
    

    Restart ComfyUI and hard-refresh the browser. For the masks to be interesting you'll also need DetailerX's dependencies (ultralytics, segment-anything, opencv-python) and its detector and SAM assets, which the pack's WorkflowX Downloader node provisions in one shot.

    Common issues

    The one error you'll actually hit is DetailerX Masks requires the detailer_masks output from DetailerX, which is what you get plugging in an ordinary IMAGE, a decoded latent, or a bundle from a different node. There's no conversion path - this is a dedicated type, and the viewer only understands the author's own bundle.

    If the panel is empty, the run was bypassed or skipped; the bundle carries a bypass reason and the panel surfaces it. If a stage is missing, that detailer is disabled or hidden - hidden processors are dropped from the bundle entirely, not shown as off.

    And keep the temporary-file thing in mind. These are previews, not outputs: they live in ComfyUI's temp directory, they're overwritten every queue, and ComfyUI is free to clear temp whenever it likes. If you need a mask kept, route it to a Save Image yourself.

    One last trap that isn't this node's fault: a clean mask with a bad result means the mask was fine and your denoise, prompt or CFG was not. The masks tell you which half of the pipeline to fix.

    CategoryWorkflowX/Image

    Inputs (1)

    NameTypeDefaultDescription
    detailer_masksDETAILERX_MASKS—

    Outputs (0)

    No outputs