Nodes/ComfyUI-CoachBate/CoachBate H3 Subject Stitch Back
ComfyUI Node

CoachBate H3 Subject Stitch Back

Composite H3-refined subject crops back into the source frames.

By CoachBate·Created 2 months ago·Updated a day ago· 0
CoachBate H3 Subject Stitch Back
  • base_images
  • refined_crops
  • transform
  • masks
  • images
◄paste_regionsubject_only►
◄mask_dilation16►
◄feather6►
◄colour_match1.00►
◄blend1.00►
◄undetected_framesfade_out►
◄feather_scales_with_cropfalse►
◄resamplebicubic_antialias►
CategoryCoachBate/H3 Subject Refine

Inputs (12)

NameTypeDefaultDescription
base_imagesIMAGE—
refined_cropsIMAGE—
transformH3FACEXFORM—
paste_regionCOMBOsubject_onlyWHAT 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_dilationINT160–256Grow 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.
featherINT60–256Gaussian 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_matchFLOAT1.000–1Match 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.
blendFLOAT1.000–1Global opacity of the refined subject. Below 1.0 mixes back toward the original - useful to dial back over-sharpening.
undetected_framesCOMBOfade_outWhat 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_cropoptBOOLEANfalseOld behaviour: treat feather as CANVAS pixels, so the blend narrows as the crop shrinks. Leave off.
resampleoptCOMBObicubic_antialiasHow 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.
masksoptMASKOptional 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)

NameTypeDescription
imagesIMAGE—