BBox to Coco
Export your detections as COCO JSON
- results
- bbox
- coco_json
Sometimes the point of detecting things isn't the picture - it's the data. This node takes the detection results and the boxes from UltralyticsInference and assembles them into a COCO-format JSON annotation file: a categories list, an images list, and per-object annotations with id, image_id, category_id, bbox, area and iscrowd. One input pair (results + bbox), one output: the coco_json string.
COCO is the annotation format most object-detection tooling, dataset pipelines and evaluation scripts speak, so this is the node you reach for when detections need to leave the canvas - building a training dataset from your own images, logging detections, or hand-feeding a script that expects COCO. The source builds it the straightforward way: class names come from the results object, image dimensions from the detector's orig_shape, and each box gets written as [x, y, w, h]. Each annotation also gets an area (width × height) and iscrowd: 0 computed for you, while segmentation stays an empty list - this is a detection exporter, not a segmentation one.
One honesty note: this node writes the box values straight through as [x, y, w, h] without the center→top-left conversion that BBoxToXYWH does. YOLO's native xywh stores the center, so a strict COCO consumer that assumes top-left will be off by half the box. If that's your situation, convert first with BBoxToXYWH and feed the translated coordinates - the pack just doesn't do that step for you here. For eyeballing detections as JSON, it's perfect as-is.
Install via ComfyUI Manager (search "ComfyUI-YOLO") or git clone https://github.com/kadirnar/ComfyUI-YOLO into custom_nodes, then restart. It's an output node, so the JSON shows up in its widget and can be copied out - there's no file-saving built in, so pair it with a text-save node or copy it manually for anything persistent.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| results | ULTRALYTICS_RESULTS | — | |
| bbox | BOXES | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| coco_json | STRING | — |