Ordered Face Filter
Grab the biggest face in the batch, keep the rest
- faces
- filtered
- rest
Here's a workflow problem you'll hit the moment you batch group shots: DetectFaces returns every face in every image, and sometimes you only want to detail the subject - the biggest face, the one the photo is actually about - not every person in the background. OrderedFaceFilter is the boring, useful node that answers that. It sorts a FACE list by size and slices out a window of it, handing you filtered (the faces you kept) and rest (everyone else). The author modeled it on Impact Pack's ImpactSEGSOrderedFilter, so if you've used that, the mental model transfers 1:1.
The inputs, all four of them
- faces - your FACE list from DetectFaces.
- criteria - currently a single choice,
area, meaning it sorts by bounding-box area (width × height). The enum exists to grow later; today there's one option. - order -
descending(biggest first) orascending(smallest first). Descending is the one you'll normally want. - take_start (default 0) and take_count (default 1) - the window into the sorted list. Defaults keep exactly the single largest face; set
take_startto skip the first N (useful if the biggest face is, say, a close-up you don't want) and raisetake_countto grab the top 2 or 3.
The math is dead simple: sort, then filtered = faces[take_start : take_start + take_count], and rest is everything before and after that slice. Because rest comes out as its own FACE list, you can run your expensive high-denoise detail pass on filtered only and send rest down a lighter path - or to no path at all. Nothing gets destroyed.
Where it sits
DetectFaces → OrderedFaceFilter → CropFaces → refine → WarpFacesBack, with rest routed to a different crop if you care. It's the cheapest "detail the subject, ignore the crowd" lever in the pack, and unlike GenderFaceFilter it needs no model, no GPU preference, no first-run download - it's pure Python sorting over the face metadata. That makes it the filter I'd wire in first when a batch has one real subject and a bunch of noise.
Gotchas
Two, both mild. Sorting by raw bounding-box area means a face close to the camera always wins - which is usually the subject, but a cropped face at the frame edge can sneak ahead of the actual focus if it's physically larger. And because criteria only has area, you can't sort by confidence or position; if you need "the leftmost face" or "the most confident face," this node won't do it yet.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/dchatel/comfyui_facetools
or ComfyUI Manager → search facetools → restart. Zero extra dependencies beyond the pack's shared install - the filtering runs on the FACE objects DetectFaces produces and needs nothing else. For a node this small, that's the right kind of simple.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| faces | FACE | — | |
| criteria | COMBO | 1 options: area | |
| order | COMBO | 2 options: descending, ascending | |
| take_start | INT | 0 | — |
| take_count | INT | 1 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| filtered | FACE | — |
| rest | FACE | — |