Nodes/Mask Tensor I/O/Load Bounding Boxes
ComfyUI Node

Load Bounding Boxes

Feed a saved detection pass back in and skip the detector

By swanjohn99·Created 22 days ago·Updated 17 days ago· 1
Load Bounding Boxes
    • bboxes
    • frame_count
    ◄bbox_file▾►
    ◄subfolderbboxes►
    ◄skip_first_frames0►
    ◄frame_load_cap0►
    ◄select_every_nth1►

    This is the other half of Save Bounding Boxes: it reads a .cbbox file out of output/bboxes/ and hands you the boxes back as a BOUNDING_BOX, plus an INT frame count. The pitch is simple - detection is the slow, VRAM-hungry step, and once you have the boxes you can delete the detector from your graph entirely and still re-render as many times as you like.

    That matters more in video than in stills. A SAM3 track over a few hundred frames is a real wait, and the output is a few kilobytes of numbers. Locking those numbers into a file turns a twenty-minute experiment into a ten-second one.

    How it works

    The loader opens the JSON, checks the envelope (format: "mvex_bboxes", a bboxes payload), and normalizes it the same way the saver did. If the file holds a single broadcast box, you get that box straight back. If it holds per-frame data, you get the frame list - and this is where the frame controls come in.

    skip_first_frames, frame_load_cap and select_every_nth mirror the semantics of the video-loader nodes people already know from VideoHelperSuite: drop the first N frames, take at most N from the start point, then step through with a stride. So skip_first_frames: 10, frame_load_cap: 50, select_every_nth: 2 gives you 25 boxes, matching a video loaded with the same window. That's the point - you window the video and the boxes identically and the frame N box still belongs to frame N.

    The frame_count output is the count after slicing, which is what you want to sanity-check against the video's frame count or feed into whatever number field downstream cares. And the loader is honest about cache invalidation: it reports the file's mtime as its changed-value, so if you overwrite clip_01.cbbox with a fresh detection pass, the node re-runs instead of serving you the old boxes from cache.

    The inputs you actually set

    • bbox_file - dropdown built from output/bboxes/. Shows (none) when the folder is empty, which is the state you'll see on first install.
    • subfolder - must match whatever the saver used. Defaults to bboxes.
    • skip_first_frames / frame_load_cap / select_every_nth - the window. Defaults of 0, 0, 1 load everything.

    Outputs are bboxes (BOUNDING_BOX) and frame_count (INT). Send the boxes into whatever consumed the detector before - a detailer, a crop, a mask builder - and use frame_count when you need to keep the video and the boxes in step.

    Install

    Manager, search the pack title, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/swanjohn99/comfyUIcostumNodes
    

    Restart ComfyUI. No dependencies to install and no models to download; the pack's pyproject.toml declares none, and the loader only uses folder_paths and json.

    Where people get burned

    The dropdown is built during node definition, which means a file you saved thirty seconds ago in the same session may not be listed yet. The pack's frontend extension papers over this - it fetches the folder list and auto-selects the newest file whose name matches the video you loaded - but if the selection looks stale, refresh the browser and it re-reads the folder. On an older frontend you may have to reload the page after saving.

    skip_first_frames is invalid on a broadcast file, and the node says so rather than silently ignoring you: a single box with no per-frame structure cannot be sliced. If you need a window, save per-frame boxes.

    Two more. .pt files are rejected deliberately - ComfyUI's model scanner false-flags .pt in output folders as missing models, which is why this pack invented .cbbox - so pointing this at an old pickled box file won't work, and nothing here will convert it for you. And the loader only looks under output/<subfolder>; it will not read an arbitrary path off your disk, so copy the file into output/bboxes/ first if that's where it lives.

    If you select (none) and run anyway, you get a plain "run Save Bounding Boxes first" - which is usually the correct diagnosis.

    Categorybbox_io

    Inputs (5)

    NameTypeDefaultDescription
    bbox_fileCOMBO1 options: (none)
    subfolderSTRINGbboxes—
    skip_first_framesINT00–1000000—
    frame_load_capINT00–1000000—
    select_every_nthINT11–100—

    Outputs (2)

    NameTypeDescription
    bboxesBOUNDING_BOX—
    frame_countINT—