Deepface Extract Faces
Turn a pile of images into a clean face dataset
- images
- face_images
Before FaceID, InstantID, ReActor, or a LoRA dataset can use your images, somebody has to crop the faces out. Deepface Extract Faces is that somebody: feed it a batch of images and it returns every detected face, resized to a target size, as a single image batch. It's the quiet utility of jordoh/ComfyUI-Deepface, and for a lot of identity work it's the node you'll reach for first - everything else in this pack judges faces, this one just harvests them.
How it works
For each input image it runs deepface's detector and collects every face it finds, resizing each crop to target_face_size. Simple, with one deliberate behavior to know about: with enforce_detection off (the default), an image with no detectable face doesn't get dropped - deepface hands the whole image back, resized to the target size. Flip it on and a no-face image instead produces None, a hard stop rather than junk data sneaking through.
Inputs that matter
images- your batch.target_face_size- default 224 (range 32–1024, step 32). 224 is deepface's own convention and fine for embedding-based tools like FaceID. If the crops are feeding a face detailer or a dataset where pixels matter, bump it up - upscaling a 224 crop later doesn't conjure detail that was never captured.detector_backend-retinafacedefault (accurate, slower);ssdoropencvwhen you're just harvesting crops in bulk.enforce_detection- the strictness switch above.
The output
face_images, an IMAGE batch. The important gotcha: output count won't match input count. One image with three faces yields three crops, so the batch size changes - wire this into anything that assumes a 1:1 with input frames and you'll be confused.
Where it fits
This is the front of the identity pipeline. Tight face crops are exactly what IP-Adapter FaceID and InstantID expect as reference input, a clean crop is what you'd feed into this pack's Deepface Verify as reference_images, and it's how you harvest training crops for a face LoRA without hand-cropping two hundred images.
Installing
Shared with the rest of the pack - ComfyUI Manager → search "ComfyUI Deepface", or:
cd ComfyUI/custom_nodes
git clone https://github.com/jordoh/ComfyUI-Deepface
cd ComfyUI-Deepface
pip install -r requirements.txt
Then restart. The install pulls deepface==0.0.89 + tf_keras, and with it TensorFlow - the heavy part. TF runs on CPU if it can't find CUDA/cuDNN, and detection across a big batch will feel it. Weights auto-download into ComfyUI/models/deepface on first run.
Troubleshooting
- Your "face" dataset has whole images in it? That's
enforce_detection=Falsequietly returning originals. Flip it on if you want strict face-only output. - Picked
yolov8,fastmtcnn,mediapipeordliband got an import error? Those backends ship as separate pip packages; install the one you chose. - Crops look tiny - that's the 224 default doing its job. Raise
target_face_size.
One node, one job, and it does the job well. If your pipeline involves faces more than once a week, this is the cheap part that makes the expensive parts work.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| target_face_size | INT | 22432–1024 | — |
| detector_backend | COMBO | retinaface | 9 options: opencv, ssd, dlib, mtcnn, retinaface, mediapipe, +3 |
| enforce_detection | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| face_images | IMAGE | — |