Apply Yolov8 Model Detect
Object detection that hands you a dataset, not just a picture
- yolov8_model
- image
- IMAGE
- JSON
- MASK
Most YOLO stuff in ComfyUI is quietly serving someone else's face-detailer. Impact Pack runs Ultralytics under the hood just to crop a face out, inpaint it, and paste it back. This node is the other kind of YOLO: run detection, see the boxes, and - the part that makes it worth your time - get the results out as JSON you can actually build on.
Apply Yolov8 Model Detect is the workhorse of the Comfyui-Yolov8-JSON pack. Feed it an image plus a model from Load Yolov8 Model, and it runs a real YOLOv8 inference pass (all 80 COCO classes, detection-only, no segmentation). You get three outputs: the annotated image with boxes drawn on, a JSON of everything it found, and a mask. If you've ever wanted to count people in a photo, flag missing safety gear, or assemble a training dataset from images you already have, this is the node that does it.
How it works
Under the hood it's calling ultralytics directly - the same YOLO model object the Load node hands it, run with model(image, classes=..., conf=threshold). The drawn image comes from Ultralytics' own plot() renderer, so the labels look exactly like the classic YOLO demo output. The JSON is the interesting bit: with json_type set to Labelme, each detection becomes a shapes entry with shape_type: "rectangle" and corner points, wrapped in the standard Labelme header (version, imageHeight, imageWidth). That's the exact format the Labelme annotation tool uses, and it's what the pack's Save node turns into files. Switch json_type to yolov8 and you get the plain [label, x1, y1, x2, y2] rows instead.
The MASK output is a per-detection white rectangle on black, one per box, stacked as a batch. Wire it into anything that takes masks - inpainting, overlays, whatever.
The inputs that matter
You'll set four things and leave the rest alone.
- detect -
all,choose, orinput.choosefilters to a single class picked from the 80-class label_list dropdown (e.g. justperson).inputis for a comma-separated list you type in label_name. - label_name - comma-separated class names. Default is
person,cat,dog. - json_type -
Labelmeoryolov8. Keep Labelme unless you specifically want the flat rows. - threshold - confidence cutoff, default 0.25. Crank to 0.5+ if you're drowning in false positives.
One trap worth knowing: "all" isn't actually all 80 classes. Reading the source, every mode routes through a label filter - all just sends whatever's in label_name (default person,cat,dog), so that's what gets detected. If you want genuinely everything, put the full list you care about in label_name and don't assume the default is exhaustive.
Installing it
Search Comfyui-Yolov8-JSON in ComfyUI Manager, or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/prodogape/Comfyui-Yolov8-JSON
Then install its Python deps (ultralytics, numpy, torch, PIL) and restart. The models auto-download into ComfyUI/models/yolov8/ on first use, so there's no separate weight hunt. Two real gotchas from the field: on the Windows portable build, Manager sometimes misses ultralytics, and you get ModuleNotFoundError: No module named 'ultralytics' - fix it with a manual pip install ultralytics in the embedded Python. And note that pulling ultralytics is pulling AGPL-licensed code plus AGPL-reached weights, which matters if you're shipping this in a product; it's also the library behind the December 2024 supply-chain scare, so keep the package reasonably current.
Where it fits
The pack's Save node can write every frame and its Labelme JSON straight to disk, which turns this from a curiosity into a dataset factory. If your goal is "detect and draw boxes" this is the one to reach for; the segmentation sibling is Apply Yolov8 Model Seg for when you need pixel masks instead of rectangles.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| yolov8_model | YOLOV8_MODEL | — | |
| image | IMAGE | — | |
| detect | COMBO | all | 3 options: all, choose, input |
| label_name | STRING | person,cat,dog | — |
| label_list | COMBO | person | 80 options: person, bicycle, car, motorcycle, airplane, bus, +74 |
| json_type | COMBO | Labelme | 2 options: Labelme, yolov8 |
| threshold | FLOAT | 0.250.01–1 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| JSON | JSON | — |
| MASK | MASK | — |