CoachBate H3 Subject Stitch Back
Putting the refined subject back without a visible seam
- base_images
- refined_crops
- transform
- masks
- images
Paste is where refine workflows die
Detecting the subject and re-rendering it big is the easy part. Putting it back is where every face-detailer workflow either looks like nothing happened or looks like a sticker. CoachBate H3 Subject Stitch Back is the paste, tuned specifically for the awkward case: the crop you paste was generated at 768 and lands on a box maybe 200 pixels wide, so the composite is a downscale, and it happens through a mask whose subject changes size every frame.
It takes base_images (the original clip), refined_crops (the decoded H3 output of the crops),
and the transform from CoachBate H3 Subject Track + Crop, and returns images. That's the loop:
track, inject, denoise, sample, decode, mask, stitch.
The settings that decide whether it looks real
Only one output, so all the decisions live in the inputs.
paste_region is what actually gets composited: subject_only or subject_ellipse pastes just
the detected subject box - the wider crop exists to give the sampler context, not to be pasted -
while full_crop pastes the whole crop including surroundings and background, which risks a
visible rectangle if H3 altered them.
feather is where a lot of people go wrong, and the tooltip explains why at length. It's a
Gaussian blur radius in source pixels, measured against the final frame rather than the
canvas. Canvas-relative feather is a trap: a 75px crop blown up to a 512 canvas makes a 40px
canvas feather only ~6 source pixels, while a 720px crop makes it ~56. The blend ends up tightest
exactly where the subject is smallest and you need the most help - which reads as a hard edge
appearing as the shot zooms out. There's an optional feather_scales_with_crop that restores the
old canvas-relative behaviour; leave it off.
resample defaults to bicubic_antialias, and this is not a detail. The paste is a downscale,
and plain bilinear with no antialiasing softens and aliases exactly the detail the pass just
added. The antialiased path shrinks the crop to the box size with an antialiased bicubic filter
first, then warps it. bilinear is the original behaviour and exists because forks change
defaults carefully.
colour_match (default 1.0) matches the refined crop's per-channel mean and standard deviation to
the region it replaces. The crop and the full frame went through independent passes, so without
this the subject comes back subtly brighter or differently tinted, and your eye reads that as
"pasted" even when the detail is perfect. blend is a plain global opacity on the refined
subject - knock it to 0.7 or 0.8 if the pass came back over-sharpened.
mask_dilation (default 16) grows the box or mask before blurring, in canvas pixels, so the blur
has room and doesn't eat into the subject. Impact Pack dilates for the same reason.
Frames where the subject isn't there
undetected_frames is the one people find surprising, because all frames go through H3 either
way - that's what keeps the clip temporally consistent. This only controls what gets pasted.
fade_out ramps the composite to zero across the gap (smooth, no pop, and the default), skip
hard-cuts so those frames keep their original pixels exactly, and composite_anyway pastes
regardless - which risks pasting a subject H3 hallucinated where there wasn't one.
The optional masks input overrides paste_region entirely. Feed it from CoachBate H3 Segm Mask
(YOLO) and the blend falls on the actual silhouette instead of an arbitrary rectangle - this is
the bbox-vs-polygon lesson from face detailing, applied to video. Pair a silhouette with a small
feather (2–8); a rectangle needs much more.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/CoachBate/ComfyUI-CoachBate.git
Or ComfyUI Manager, search "CoachBate". Restart, then look under CoachBate / H3 Subject
Refine. No pip dependencies of its own - but the pipeline around it needs ultralytics for
detection, the Video Helper Suite, and, if you use the blueprints, ComfyUI-Pixaroma's Loop Start /
Loop End.
Where people get burned
- A sharp rectangle appears as the camera pulls back. Canvas-relative feather, most likely via
feather_scales_with_crop, or a feather value that was tuned for a fixed-size subject. Feather is in source pixels precisely so it survives magnification changes. - The subject looks slightly wrong-tinted.
colour_matchis at 0, or the base images and the crops were colour-managed differently. - The subject pops in and out of existence.
undetected_framesatskipon a clip with detection dropouts.fade_outexists for this. - Soft, mushy result.
resampleset tobilinear.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| base_images | IMAGE | — | |
| refined_crops | IMAGE | — | |
| transform | H3FACEXFORM | — | |
| paste_region | COMBO | subject_only | WHAT gets composited back. subject_only / subject_ellipse paste just the detected subject box (FaceDetailer's behaviour - the wider crop exists to give the sampler context, not to be pasted). full_crop pastes the whole crop including the surroundings and background, which risks a visible rectangle if H3 alters them. |
| mask_dilation | INT | 160–256 | Grow the subject box (or mask) before blurring, in canvas px. Impact Pack dilates the same way so the blur has room and the blend does not eat into the subject itself. |
| feather | INT | 60–256 | Gaussian blur radius on the paste mask, in SOURCE pixels. Measured against the final frame, not the canvas, so the blend is the same physical width whatever this frame's magnification happens to be. Canvas-relative feather is a trap: a 75px crop blown up to 512 makes a 40px canvas feather only ~6 source px, while a 720px crop makes it ~56. The blend ends up TIGHTEST exactly where the subject is smallest and the composite needs the most help - which reads as a hard edge appearing as a shot zooms out. |
| colour_match | FLOAT | 1.000–1 | Match the refined crop's per-channel mean/std to the region it replaces. The crop and the full frame went through independent passes, so without this the subject can come back subtly brighter or differently tinted and read as pasted on. |
| blend | FLOAT | 1.000–1 | Global opacity of the refined subject. Below 1.0 mixes back toward the original - useful to dial back over-sharpening. |
| undetected_frames | COMBO | fade_out | What to do on frames where no SUBJECT was found (out of shot / occluded). ALL frames are still sent through H3 either way - that is what keeps it temporally consistent - this only controls whether the result is pasted back. fade_out: ramp the composite to zero across the gap (smooth, no pop, recommended). skip: hard cut - those frames keep original pixels exactly. composite_anyway: paste regardless. Risks pasting a subject H3 hallucinated where there was none. |
| feather_scales_with_cropopt | BOOLEAN | false | Old behaviour: treat feather as CANVAS pixels, so the blend narrows as the crop shrinks. Leave off. |
| resampleopt | COMBO | bicubic_antialias | How the refined crop is resampled back onto its box. The paste is a DOWNscale (a 768 canvas onto a box a few hundred px wide), and bilinear sampling with no antialiasing softens and aliases exactly the detail the pass just added. bicubic_antialias first shrinks the crop to the box size with an antialiased bicubic filter, then warps it. bilinear is the original behaviour. |
| masksopt | MASK | Optional per-frame paste masks in CANVAS space, e.g. from CoachBate H3 Segm Mask (YOLO). Overrides paste_region: the mask follows the actual silhouette so the blend falls on its edge instead of an arbitrary rectangle. With a silhouette use a SMALL feather (2-8); a rectangle needs much more. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |