Detect Yolo
YOLO detection with masks you can feed straight into inpainting
- image
- plot_image
- mask
Detect Yolo (1hew_DetectYolo) is the pack's object-detection node: run a YOLO model over an image, get back a drawn-on plot plus a mask. What makes it more useful than a plain "detect boxes" node is the mask output - per-object instance masks (it runs with retina_masks=True) that you can union or pick apart and feed directly into inpainting, regional generation, or the pack's Mask to SAM3 Box.
It's in the 1hewNodes/detect group, powered by Ultralytics YOLO. The workflow it enables is the classic "detect people, mask them, edit them individually" pipeline, and the mask_index control is what turns that from a party trick into something practical.
How it works
You need a model first: the node looks for .pt files in ComfyUI/models/yolo/ (subfolders supported) and lists them in the yolo_model dropdown. No model there, and the dropdown literally says "No models found - Please add .pt files to models/yolo/" - that's the node telling you exactly what to do. Drop in a yolov8s.pt, yolo11n.pt, or any Ultralytics weights and it appears.
For each image it runs inference at your threshold (default 0.3), draws class-labeled boxes on the plot, and builds masks. mask_index controls which detections end up in the mask output:
-1(default) - every detection, unioned into one mask.0- only the first detection.0,2- the first and third.- A space or comma-separated list selects those indices; the node even accepts full-width Chinese commas, a nice touch.
If the model returns no instance masks (some YOLO variants don't do retina_masks well), it falls back to filling the box regions, so you still get a mask. The label toggle and label_size control the box annotations on the plot.
Inputs and outputs
- image - input.
- yolo_model - dropdown of
.ptfiles inmodels/yolo/. - threshold - confidence cutoff, default 0.3.
- mask_index - which detections to mask,
-1= all. - label - draw class boxes + names on the plot.
- label_size - annotation scale, 0.1–5.
- plot_image - the annotated image.
- mask - union of the selected instance masks.
Installing it
It's part of the 1hewNodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
Restart, let ComfyUI Manager install requirements (this is the node that needs ultralytics), and drop a .pt model into ComfyUI/models/yolo/. The model itself is on you - YOLO weights are small (yolo11n is ~5MB, yolo11s ~19MB) and downloadable from Ultralytics' own releases.
The honest take
It's a solid, no-frills YOLO node, and the mask output plus mask_index is genuinely the right design - most competitor nodes give you boxes and make you reconstruct masks yourself. Where people trip: forgetting the model file (the dropdown warning is the hint), and pushing threshold too low so the mask picks up noise. Start at 0.3. And if your masks look blocky, that's the box-fallback path kicking in - switch to a model with good instance segmentation, or just accept box masks for detection-style work. Pair it with Mask to SAM3 Box for the full "detect → SAM3 → inpaint each person" chain.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| yolo_model | COMBO | No models found - Please add .pt files to models/yolo/ | 1 options: No models found - Please add .pt files to models/yolo/ |
| threshold | FLOAT | 0.300–1 | — |
| mask_index | STRING | -1 | — |
| label | BOOLEAN | true | — |
| label_size | FLOAT | 1.000.1–5 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| plot_image | IMAGE | — |
| mask | MASK | — |