Save Labelme Json
The node that turns detections into a training dataset on disk
- image
- labelme_json
- STRING
This is the node that makes the whole pack more than a demo. Save Labelme Json writes each frame and its Labelme annotation to disk as a matching .jpg + .json pair, and that's the exact structure a detection or segmentation training pipeline wants to eat. Run a batch of images through Apply Yolov8 Model, dump them here, and you've started a dataset without opening the Labelme tool once.
The default folder_name and filename_prefix are both GroundingDino, which hints at the intended loop: a GroundingDINO-style proposal pass finds objects, this pack records the boxes, and the output becomes labeled data for a fine-tune. It's a pragmatic answer to the eternal question of "where do I get labeled training data" - you bootstrap it from a strong pretrained detector instead of hand-annotating.
How it works
It zips the image and labelme_json inputs together, and for each pair saves filename_prefix_000.jpg plus filename_prefix_000.json into ComfyUI/output/<folder_name>/ (it creates the folder if needed). The JSON gets one edit on the way out: imagePath is rewritten to match the saved file, so the annotation correctly references its image - the thing that breaks most hand-assembled Labelme folders. It zero-pads the counter to match the batch size, so ordering stays stable.
Output is a single STRING - the number of files written. If the image batch and JSON list lengths don't match, it returns 0 and saves nothing rather than corrupting data, which is the right kind of fail.
The two inputs you actually set
- folder_name - subdirectory under
ComfyUI/output/. Set it to something meaningful per run, because this node does not dedupe - re-running overwrites. - filename_prefix - base name for both files. Keep it unique per experiment or you'll clobber earlier saves.
Then wire image and labelme_json from Apply Yolov8 Model (in Labelme mode), hit run, and check output/<folder_name>/. The count string tells you it worked.
Gotchas
If you plan to view the JSON inside the graph before saving, the README wants you to install Comfyui-Toolbox - that's where the PreviewJson node lives. And note the saved format is rectangle-only detection data; for pixel-perfect segmentation labels you'd want the seg node's masks exported separately, since this node just writes what the JSON carries.
Install is the pack install - ComfyUI Manager search Comfyui-Yolov8-JSON, or:
cd ComfyUI/custom_nodes
git clone https://github.com/prodogape/Comfyui-Yolov8-JSON
then pip install -r requirements.txt and restart. Modest node, but if dataset-building is your goal, it's the payoff.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| labelme_json | JSON | — | |
| folder_name | STRING | GroundingDino | — |
| filename_prefix | STRING | GroundingDino | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |