RookieUI ADetailer Detect Mask
The detect step behind A1111's face-fix, on ComfyUI
- image
- MASK
If you've ever rendered a full-body shot and gotten a beautiful scene with a melted face, you already know why this node exists. A face that occupies 60×60 pixels of a wide render has almost no latent budget to work with, so it comes out mangled no matter how good your checkpoint is. The fix is always the same: find that region, mask it, and give it its own generation pass at full resolution. This node does the find and mask half.
It's the ComfyUI-native reimplementation of the first stage of A1111's ADetailer - the detect-mask-inpaint loop that made ruined faces a solved problem. RookieUI is an A1111-style sidebar for ComfyUI, and instead of leaning on an external node pack, it ships its own detector runtime. This node runs a YOLO detector over an image and hands you back a MASK you feed into an inpaint pass.
How it works
You give it an image, it runs a detection model over the finished pixels, turns each hit into a mask region, filters and cleans those regions per your settings, and outputs a single combined MASK. Everything downstream - the VAE encode for inpaint, the sampler, the composite back - is ordinary masked img2img. The detection step only decides where the mask goes; the actual repair happens later in the graph.
Detection is just swappable YOLO weights, which is the whole reason the paradigm aged so well. Bundled face/hand/person models cover the common cases, and any .pt or .safetensors YOLO you drop in the folder shows up as an option - including community detectors for hands, eyes, or NSFW anatomy.
The inputs that matter
detector/detector_family- which YOLO to run and its family. This is the whole game. A face-detection model for faces, a hand model for hands. Leave itNoneand the node has nothing to find.confidence(0–1, default 0.3) - the detection threshold. 0.3 is a sane floor; raise it if the detector is hallucinating faces in foliage (a real and classic failure), lower it if it's missing small ones.dilate_erode(default 4) andmask_blur(default 4) - grow the mask outward and feather its edge. These two decide whether the fixed region blends or shows a visible seam. If you're getting a hard box around the repaired face, raise both before touching anything else.
The rest is mask housekeeping, and it's genuinely useful housekeeping: mask_filter_method (Area or Confidence) with mask_k keeps only the top-N biggest or most-confident detections; mask_min_ratio / mask_max_ratio throw out detections that are too small or absurdly large; x_offset / y_offset nudge the mask; and mask_merge_mode (None / Merge / Merge and Invert) controls whether overlapping detections combine.
How to install it
ADetailer is built into RookieUI - no separate detailer pack needed. Via ComfyUI Manager, search ComfyUI-RookieUI, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/rookiestar28/ComfyUI-RookieUI
cd ComfyUI-RookieUI
python -m pip install -r requirements.txt
The detector path leans on two dependencies the pack declares: ultralytics>=8.3.0 and opencv-python-headless>=4.10.0. If Manager doesn't auto-install node dependencies in your setup, run that pip line by hand in the same Python environment ComfyUI uses. You also need the YOLO detector files present on the host (commonly under models/ultralytics) - the pack supplies the runtime, not the weights.
Common issues
Two things bite people, and neither is this node's fault directly. First, a grey or mismatched box around the fixed region - that's the downstream inpaint pass's VAE round-trip, and the fixes are raising dilate_erode and mask_blur here, plus confirming the correct VAE is loaded in the repair pass. Second, the "room of clones" problem on crowds: if every detected face gets inpainted on the same base seed downstream, they converge into siblings. That's a property of the inpaint stage, but it starts here - if you're detailing a crowd and want distinct people, mask in smaller batches rather than merging everything into one pass.
One more, straight from the pack's own dependency list: ultralytics had a real supply-chain compromise in late 2024 that reached ComfyUI users. Nothing wrong with this pack - but install its dependencies from a clean environment and keep them current.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| detector | STRING | None | — |
| detector_family | STRING | none | — |
| detector_classes | STRING | — | |
| confidence | FLOAT | 0.300–1 | — |
| mask_filter_method | COMBO | 2 options: Area, Confidence | |
| mask_k | INT | 00–100 | — |
| mask_min_ratio | FLOAT | 0.000–1 | — |
| mask_max_ratio | FLOAT | 1.000–1 | — |
| x_offset | INT | 0-2048–2048 | — |
| y_offset | INT | 0-2048–2048 | — |
| dilate_erode | INT | 4-128–128 | — |
| mask_merge_mode | COMBO | 3 options: None, Merge, Merge and Invert | |
| mask_blur | INT | 40–64 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |