ComfyUI Node

CPA DetectReport

The Node Behind the 'Detect' Button

By rik-python·Created about a month ago·Updated 9 days ago· 50
CPA DetectReport
  • masks
    ◄frame0►
    ◄token►

    Some ComfyUI nodes are things you build with. Some are the plumbing that makes one button work. CPA DetectReport is squarely the second kind: it has no outputs at all, and its entire job is to hand a web UI a set of rectangles and mask thumbnails so you can click something.

    You'd meet it if you're the sort of person who expands a graph to see what actually ran - which, since the Comfy Pro Alpha Generator does that expansion on every Queue, is a lot of people. Here's what it is.

    What it does

    It takes masks - SAM 3 text-prompt detections on a single frame - plus frame (which frame those detections came from) and token (a string used to name the files, and passed straight back in the payload).

    For each mask in the batch, it:

    • Finds the pixels above 0.5 and skips anything under 50 of them. A speck isn't a subject, and the picker shouldn't offer it.
    • Computes a bounding box as normalised centre x, centre y, width, height - so it can be drawn at any viewer scale.
    • Writes a black-and-white PNG of the mask to ComfyUI/temp/comfy_pro_alpha_detect/det_<token>_<i>.png.
    • Returns an entry with an id, that box, the mask's area as a fraction of frame, and a reference to the PNG in temp.

    Then it emits the lot as a UI payload, comfy_pro_alpha_detect, which the node's front-end script picks up and draws over the plate.

    That's it. No IMAGE out, no MASK out, nothing for you to wire. It's an output node in the sense that it's the end of a branch, and its output is the interface.

    Why "type a word" is a real feature

    Compositors know the problem: a hand on a shoulder is easier to name than to click precisely, and clicking the wrong thing on a busy plate costs you a full tracking pass to find out. So the generator's picker has a Find box - person by default, but dog, red car, bike, woman, or a comma-separated pair like dog, person. Type, press Detect, and every match on that frame comes back as a clickable overlay.

    That's SAM 3's open vocabulary doing the work, and it's the capability that changed this whole area in late 2025: segmentation stopped being "foreground versus background" and became "this object, described in words". DetectReport is the thin adapter between that and a clickable rectangle.

    The temp files

    The mask PNGs land in ComfyUI's temp directory, not your output folder. Nothing accumulates in your project, and clearing temp clears them. The viewer only needs them long enough for you to look at them, and the decisions you make from them are stored in the generator's picks JSON - points, boxes and frames - not as references to these PNGs. So there's no case where you need to keep them around for a render to work later.

    CPA PartReport is the sibling for a single click: same temp folder, same idea, one mask, one PNG, a payload the picker uses to show you what your alt-click or shift-click actually grabbed. Between the two of them, every bit of visual feedback the picker gives you comes from a node whose only output is HTML-shaped JSON.

    Install

    Nothing to install: it's part of the pack, it has no models, no dependencies beyond what the pack already needs, and it's flagged deprecated so it stays out of the node menu. It runs when the generator's Detect path runs.

    cd ComfyUI/custom_nodes
    git clone https://github.com/rik-python/ComfyUI-Comfy-Pro-Alpha-Generator.git
    pip install -r ComfyUI-Comfy-Pro-Alpha-Generator/requirements.txt
    

    The one install failure that matters here is ComfyUI-SAM3. The generator validates its inputs before queueing and will refuse with "Missing node pack(s): …" if SAM 3's nodes aren't there - which is more polite than letting Detect silently return nothing and leaving you to wonder whether you typed the wrong word.

    When Detect comes back empty

    Usually three things, in order of likelihood. The word isn't a SAM 3 concept in this framing - try the simpler noun, dog rather than brown dog. The frame you're on doesn't contain it clearly enough at the point you clicked. Or the subject is tiny: under 50 pixels of mask and this node drops it on purpose, which is a reasonable floor for a picker and an unreasonable one for someone trying to matte a distant figure.

    If it's the third case and you actually want that distant figure, click it directly rather than detecting it - a point prompt on SAM 3 works on things a box overlay won't offer you.

    CategoryComfy Compositing/internal

    Inputs (3)

    NameTypeDefaultDescription
    masksMASK—
    frameINT0—
    tokenSTRING—

    Outputs (0)

    No outputs