FC FaceDetectCrop
The node that finds the face and cuts it out — FC FaceDetectCrop
- source_image
- IMAGE
- MASK
- BOX
- KEY_POINT
FC FaceDetectCrop is where every FaceChain workflow starts. It finds faces in an image, crops one out for generation, and hands you the metadata - the box, the mask, the landmarks - that the rest of the pack needs to put the result back. If you're building a face-inpaint graph from scratch, this is the first node you'll place.
The engine is a ModelScope face-detection pipeline (damo/cv_ddsar_face-detection_iclr23-damofd), downloaded on first use from Alibaba's hub. That's worth flagging now because it means the very first run is slow and needs network access to modelscope.cn - and because it's not InsightFace. The pack imports insightface and installs it (with a bundled Windows cp311 wheel, no less), but the actual detection work is done by the ModelScope model. So the usual "insightface install pain" horror stories mostly don't apply here; the pain is just a big download instead.
The inputs that matter
- source_image (
IMAGE) - the photo to search. Required. - mode -
normalcrops tight around the detected face;square 512 width heightpads the crop out into a 512×512 square centered on the face. This second mode is load-bearing:FC CropToOrigin(the paste-back node) only works with it. The README says so explicitly. - face_index (
INT, default 0) - which face, when there are several. 0 is the first detected, not necessarily the biggest. - crop_ratio (
FLOAT, default 1.0) - how much margin around the face. Only active innormalmode; 1.0 is exactly the face, higher values include more context (hair, shoulders).
That's the whole public surface - no other knobs on this node.
Outputs
Four of them: the cropped IMAGE, a MASK (the region that was cropped), the BOX (the face bounding box in original-image coordinates), and a KEY_POINT array (five facial landmarks). The box and mask are exactly what FC CropToOrigin consumes on the way back, so don't drop them on the floor.
Typical graph and gotchas
Load Image → FC FaceDetectCrop → (crop) → KSampler → FC CropToOrigin, with the box/mask wired straight across. In square 512 mode the crop is already sampler-ready at 512×512.
Two things trip people up. First, don't resize the crop between nodes - the paste-back geometry assumes nothing changed. Second, the face-index behavior: with multiple faces it picks by detection order, so if it crops the "wrong" person, bump face_index rather than re-cropping by hand.
Install
ComfyUI Manager (search "ComfyUI-FaceChain") or:
cd ComfyUI/custom_nodes
git clone https://github.com/THtianhao/ComfyUI-FaceChain
Restart, then wait through the pack's startup dependency install (onnxruntime-gpu, mmdet, mmcv via openmim, modelscope, insightface, transformers…) - first launch after install is slow, and it's normal. The node itself is one of the most used in the pack, and it's the one whose outputs everything else orbits around.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| source_image | IMAGE | — | |
| face_index | INT | 00–10 | — |
| crop_ratio | FLOAT | 1.00–10 | — |
| mode | COMBO | 2 options: normal, square 512 width height |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| BOX | BOX | — |
| KEY_POINT | KEY_POINT | — |