🍒YOLO_Multi_Crop✀多人物裁切
YOLO finds every person and crops them out
- image
- IMAGE
- DATA
YOLO_Multi_Crop is the "give me every person in this image, individually" node. Point it at a group shot or a batch of images with people, and it detects each person, crops each one out, and hands you a list of cutouts plus structured data about where they were found. If you've ever hand-cropped fifty faces out of a group render, this is the automation you were building toward.
The author's framing is blunt: "detect multiple people and crop them separately." It's an ultralytics YOLO node tuned for people (it hard-codes class 0 = person), which makes it both very good at its one job and very limited at everything else.
The mechanism. It runs your chosen YOLO model on the image, takes every detection of class 0 (person), and builds a square crop around each one - centered on the detected box, sized to the longer side of the detection with a 1.5× margin baked in, then scaled by your square_size percentage. It then sorts the results top-to-bottom, left-to-right (reading order), caps them at max_detections, and crops. You get one image per person plus a DATA object describing each crop.
Inputs that matter.
image- what to scan.yolo_model- a dropdown that lists.ptfiles found inComfyUI/models/yolo/. The dropdown is empty until you put a YOLO model there - see install below; this is the thing that trips everyone.confidence- FLOAT, default 0.5. Raise it if you're getting false positives, lower it if people are being missed.square_size- FLOAT, default 100, range 10–200. Percentage scale of the crop relative to the person box. 100 keeps the 1.5× margin; 120 gives more breathing room; 80 tightens it.max_detections- INT, default 5, cap 20. How many people you want back.
Outputs. IMAGE - a list of the cropped persons, ready for a batch loop or individual processing. DATA - a dict with count, image_size, bboxes, and face_data (per-person pixel and normalized coordinates, crop size, confidence). That DATA output is the underrated part: wire it into the pack's own Crop_Paste or any JSON-aware node and you can paste the cutouts back onto the original image at exactly the right spots, or drive conditional logic off how many people were found.
Where people get burned. Detection quality is YOLO quality. The classic community complaint with YOLO-based cropping is that boxes come out "too big" and cut adjacent people into the crop - the fix here is square_size down toward 70–80. People hugging or overlapping will share a crop and there's no re-splitting. And models matter: a tiny mobile YOLO on a crowd will miss half the group; that's a model choice, not a node bug.
Install. Part of KimNodes (wjl0313's 🍒 toolbox). ComfyUI Manager → search "ComfyUI_KimNodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/wjl0313/ComfyUI_KimNodes
Then two things the README won't tell you. First, the pack's requirements.txt only lists pixeloe - ultralytics is not included, so install it yourself:
pip install ultralytics
Second, drop a YOLO weights file (any yolov8*.pt or yolov11*.pt you have, or a download from the ultralytics releases) into:
ComfyUI/models/yolo/
No file in that folder = empty dropdown, and the node is dead on arrival. Same story as the pack's YOLOWorld_Match, just a different folder.
Troubleshooting. Empty model list → weights not in models/yolo/. Model loads but crops nothing → confidence too high, or your people are small/occluded - try 0.25. Output order weird → it's sorted by row (10% height threshold), so a person standing slightly below another can group into the wrong row; usually fine, occasionally surprising. And expect CUDA fallback to CPU if your torch build lacks GPU - it's slow but works.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| yolo_model | COMBO | 0 options: | |
| confidence | FLOAT | 0.500.1–1 | — |
| square_size | FLOAT | 10010–200 | — |
| max_detections | INT | 51–20 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| DATA | DATA | — |