Nodes/CoachBate/CoachBate H3 Loop Subject
ComfyUI Node

CoachBate H3 Loop Subject

Three men stand in a row. This node is how the loop tells them apart.

By CoachBate·Created 3 months ago·Updated 22 days ago· 2
CoachBate H3 Loop Subject
    • select_override
    • select_index
    ◄index0►
    ◄total1►
    ◄orderleft_to_right►

    The small node that makes the loop make sense

    The H3 Subject Refine xN blueprint counts the subjects in a clip and runs one refine pass per subject. Each pass needs to know which subject it's working on. CoachBate H3 Loop Subject is the bit that answers that: it maps the loop round to a choice the tracker understands, and outputs both a select_override string and a select_index integer.

    It's tiny, and it's the difference between a loop that refines three people and a loop that refines the same person three times.

    Left to right, not biggest to smallest

    The logic is worth knowing because it's a real opinion:

    • order = left_to_right (the default) with 2 subjects maps round 0 to left_most and round 1 to right_most.
    • With 3 subjects it maps to left_most / centre_most / right_most.
    • Any other case falls through to size rank plus the index.

    The reasoning is in the node's own description, and it's sound: three similar subjects standing side by side - three men in a row is the example the author uses - are told apart by position far more reliably than by size rank. Size rank reorders itself the moment one steps forward, and your loop then refines subject 2 twice and subject 3 never. Position doesn't care. order = size is there for the cases where size genuinely is the discriminator (a big foreground subject and a small distant one, say).

    index (0-based, default 0) is the loop round, so wire it from Pixaroma Loop Start's index. total (default 1) is the number of rounds; it's what the left_to_right mapping keys off, so feeding it the count from CoachBate H3 Subject Count keeps the two nodes consistent. If they disagree, you get position names for a subject count that isn't there and the loop misbehaves in ways that look like a tracking bug.

    Inputs and outputs

    • index (INT, 0–99, default 0), total (INT, 1–99, default 1), order (left_to_right or size).

    Outputs:

    • select_override (STRING) - the position name, wired into CoachBate H3 Subject Track + Crop's select_override input.
    • select_index (INT) - the rank, wired into the tracker's select_index.

    You don't need both; pick whichever is more honest for your clip. The tracker's own subject choice is made once per shot and followed from there, so whichever you feed it, the loop's job ends after that first decision.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/CoachBate/ComfyUI-CoachBate.git
    

    Or ComfyUI Manager → search "CoachBate" → restart. It's under CoachBate / H3. Nothing extra to install for this node itself - it's pure arithmetic - but the loop it serves needs ComfyUI-Pixaroma for Loop Start / Loop End, and the rest of the refine chain needs ultralytics and the Video Helper Suite.

    Where people get burned

    • The same subject gets refined twice. order = size on a clip with similarly sized subjects
      • size rank is unstable when everyone is roughly the same height. Use left_to_right.
    • Subjects get skipped. total doesn't match the actual count. Feed it from CoachBate H3 Subject Count rather than typing it by hand.
    • The tracker follows nobody on round 1. The subject at that select_index doesn't exist in the clip; the tracker clamps and warns in its report rather than failing, so check that report before you blame the loop.
    CategoryCoachBate/H3

    Inputs (3)

    NameTypeDefaultDescription
    indexINT00–99—
    totalINT11–99—
    orderCOMBOleft_to_right2 options: left_to_right, size

    Outputs (2)

    NameTypeDescription
    select_overrideSTRING—
    select_indexINT—