RM Face Detect & Crop
Crop every face out of a shot and run each one through its own pipeline
- image
- cropped_face
- face_data
- face_count
Every ComfyUI face-fixer workflow ends up as the same wall of nodes: a detector provider, a BBOX detector, a SEGS decompose, a bbox-to-crop converter, a crop node, a scale node... The author of this pack knew it - the source comments literally list the stock+Impact-Pack chain this replaces. RMFaceDetectCrop collapses that into one node: YOLO finds the faces, expands and crops each one, and outputs them as a list so every face flows through the rest of your graph independently. Each face gets its own encode, its own sampler pass, its own decode.
How it works
The node runs a YOLO detection model over your image, keeps bounding boxes above threshold, drops anything smaller than drop_size, then for each face expands the box by crop_factor (1.5 = a 50% bigger crop so the face isn't clipped at the frame edge), applies dilation to the mask, and scales the crop so it lands at roughly megapixels MP. The key mechanism is OUTPUT_IS_LIST: the cropped_face output is a list of tensors, and ComfyUI responds by executing every downstream node once per list item. That's how one detect node becomes a per-face upscale-and-refine pipeline with zero branching logic on your side.
The face_data output (RM_FACE_DATA) carries each crop's region, size, and mask back to the pack's RM Face Composite node, which is what puts the processed faces back where they came from. No faces found? It doesn't crash - it returns a dummy image, face_data marked found: false, and a face_count of 0, so the pipeline runs but changes nothing.
Inputs and outputs that matter
- image (IMAGE, required)
- model_name - a dropdown of YOLO models in
ComfyUI/models/ultralytics/bbox. If nothing's there it shows"none"and detection returns nothing. - threshold (default 0.5), dilation (default 10, can go negative to erode), crop_factor (default 1.5), drop_size (default 10), megapixels (default 1.0).
- Outputs: cropped_face (IMAGE, list), face_data (RM_FACE_DATA), face_count (INT).
How to install it
The pack has no requirements.txt, and this node needs real dependencies that Manager won't install for you:
cd ComfyUI/custom_nodes
git clone https://github.com/Moser9815/ComfyUI-RMAutomation
pip install ultralytics opencv-python
Then drop a face-detection YOLO model (.pt) into ComfyUI/models/ultralytics/bbox/ and restart. The package doesn't ship one, so find a face bbox model from the usual Ultralytics/detection sources.
Common issues
Two setup problems dominate. The model dropdown is empty - you haven't placed a .pt file in models/ultralytics/bbox. The pack fails to load entirely - opencv-python (cv2) is imported at module level, so if it's missing, all RMAutomation nodes disappear, not just this one. Install cv2 before you panic about the rest of the pack. Behavior-wise, the dummy-output-on-no-faces design is a blessing and a trap: downstream nodes still execute on a black 256×256 dummy, so a failed detection doesn't error visibly - check face_count (or wire it to a display node) rather than assuming your fix worked.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_name | COMBO | 1 options: none | |
| threshold | FLOAT | 0.500–1 | — |
| dilation | INT | 10-512–512 | — |
| crop_factor | FLOAT | 1.51–10 | — |
| drop_size | INT | 101–8192 | — |
| megapixels | FLOAT | 1.00.1–16 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| cropped_face | IMAGE | — |
| face_data | RM_FACE_DATA | — |
| face_count | INT | — |