CoachBate H3 Loop Subject
Three men stand in a row. This node is how the loop tells them apart.
- select_override
- select_index
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 toleft_mostand round 1 toright_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_rightorsize).
Outputs:
select_override(STRING) - the position name, wired into CoachBate H3 Subject Track + Crop'sselect_overrideinput.select_index(INT) - the rank, wired into the tracker'sselect_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 = sizeon a clip with similarly sized subjects- size rank is unstable when everyone is roughly the same height. Use
left_to_right.
- size rank is unstable when everyone is roughly the same height. Use
- Subjects get skipped.
totaldoesn'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_indexdoesn'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.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| index | INT | 00–99 | — |
| total | INT | 11–99 | — |
| order | COMBO | left_to_right | 2 options: left_to_right, size |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| select_override | STRING | — |
| select_index | INT | — |