Nodes/Comfyui-Yolov8-JSON/Draw Labelme Json
ComfyUI Node

Draw Labelme Json

Turn YOLO's JSON back into visible boxes — and color-code the bad ones

By prodogape·Created 2 years ago·Updated 2 years ago· 27
Draw Labelme Json
  • image
  • labelme_json
  • IMAGE
  • MASK
  • JSON
show_promptall
event_promptall
prompt_name{"head":"no helmet","helmet":"helmet"}
show_thresholdno

Once the pack's Apply nodes have run, you've got a JSON full of boxes and no obvious way to look at them. Draw Labelme Json is the QC and presentation step: it takes a Labelme JSON, paints the boxes back onto the image, and - the genuinely useful part - lets you color-code and rename what it draws.

The defaults tell you what it was built for. The prompt_name field ships set to {"head":"no helmet","helmet":"helmet"}, and event_prompt defaults to all. That's a helmet-detection review workflow: labels get renamed on the fly, and "event" labels get drawn in red while everything else is green, so a manager can scan a batch and see exactly which frames have violations. If you're running any detection task where a human has to review thousands of boxes, this is the node that keeps that from being miserable.

What you can do with it

  • show_prompt - only draw boxes whose label matches this comma-separated list (default all draws everything).
  • event_prompt - the "bad" labels. Matching ones draw red, everything else green.
  • prompt_name - a JSON object that renames labels before drawing: {"head":"no helmet"} displays no helmet instead of the raw label.
  • show_threshold - set yes to append each box's confidence score to its label (only if the shape actually carries a threshold field, which the pack's own detection JSON does not add by default).

Under the hood it's plain PIL drawing on a copy of the image, using a font bundled with the pack so CJK labels render instead of tofu blocks - a small detail that says a lot about who this pack is for. Outputs are the annotated IMAGE, a combined MASK of the drawn boxes, and a fresh JSON with just the shapes you chose to draw, so the filtered result stays usable downstream.

Wiring and gotchas

Feed it the image and the JSON output of Apply Yolov8 Model (in Labelme mode) and you're set. One note: the box coordinates in the JSON are pixel-space and the drawing code assumes the JSON's imageHeight/imageWidth match the actual image - which they will if you kept the original and its annotation together, and won't if you upscaled one side of the pipeline.

It's part of the Comfyui-Yolov8-JSON pack, so the install is the pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/prodogape/Comfyui-Yolov8-JSON

plus pip install -r requirements.txt and a restart. If you want to inspect the raw JSON in the graph rather than drawn on pixels, the README points you to install Comfyui-Toolbox - its PreviewJson node is what the sample workflow uses.

CategoryComfyui-Yolov8-JSON

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
labelme_jsonJSON
show_promptSTRINGall
event_promptSTRINGall
prompt_nameSTRING{"head":"no helmet","helmet":"helmet"}
show_thresholdCOMBOno2 options: yes, no

Outputs (3)

NameTypeDescription
IMAGEIMAGE
MASKMASK
JSONJSON