Nodes/comfyui-gits-tracked-identity/GITS Face Tracking + Removal (Advanced)
ComfyUI Node

GITS Face Tracking + Removal (Advanced)

The Node That Hands You the Pieces — and Why the Overlay Runs Twice

By Niutonian·Created 2 months ago·Updated 2 months ago· 1
GITS Face Tracking + Removal (Advanced)
  • images
  • static_logo
  • static_logo_mask
  • ring_logo
  • ring_logo_mask
  • final_images
  • removed_background_images
  • guide_images
  • aligned_overlay_images
  • overlay_masks
  • tracking_preview
  • tracking_json
  • face_occlusion_masks
◄fps24.00►
◄face_scale1.00►
◄y_offset-0.02►
◄rotation_speed42►
◄follow_head_roll0.20►
◄min_cutoff1.20►
◄beta0.035►
◄hold_frames8►
◄fade_frames8►
◄tracker_confidence0.45►
◄effect_presetcustom►
◄start_frame0►
◄rotation_phase0.00►
◄logo_opacity1.00►
◄fallback_detectoryunet►
◄occlusion_scale1.15►
◄occlusion_feather_px8►
◄guide_occlusion_opacity1.00►
◄face_removal_modelama►
◄lama_removal_strength230►
◄lama_edge_smoothness8►
◄final_overlay_opacity1.00►
◄face_modelocked_face►
◄max_faces4►
◄temporal_lamatrue►
◄lama_resolution384►
◄lama_every_n_frames2►
◄temporal_flowtrue►
◄temporal_blend0.35►
◄glitch_intensity0.00►
◄signal_flicker0.10►
◄edge_aware_mask0.35►
◄yaw_foreshorten0.40►
◄profile_boost0.55►
◄partial_face_boost0.55►
◄track_predictiontrue►
◄fuse_detectorstrue►
◄small_face_boosttrue►

Here's the honest summary of GITS Face Tracking + Removal (Advanced): it's the only node in this pack you can put in front of a sampler. Everything else assumes you've given up on diffusion rendering your graphic.

It does two unrelated jobs at once, which is why the outputs list is eight items long:

images -> Advanced Tracking -> preprocessing / diffusion -> Final Artwork Overlay
             |                                        ^
             +-- exact RGB overlay + alpha mask ------+

On the way in, it takes your frames, finds the faces, paints an opaque plate over each one, and draws the artwork into the image. That's guide_images - what you send to ControlNet, an img2img pass, or KSampler. On the way out it hands you the artwork separately as aligned_overlay_images plus overlay_masks, so GITS Final Artwork Overlay can re-apply the real thing after the VAE decode.

That double-apply isn't redundancy, it's the design: KSampler will approximate a logo rather than reproduce one - smeared lines, an elliptical ring. So let diffusion work on a face that's already covered, then paste the real pixels over its guess.

The inputs you'll actually touch

Ten required widgets, and they fall into three groups.

Geometry - face_scale, y_offset, rotation_speed. How big the artwork sits relative to the face, where it sits vertically (-1..1), and how fast the ring spins - negative reverses it.

Smoothing - min_cutoff, beta. It's the pack's one Euro filter, exposed raw, and the fiddliest thing here. min_cutoff is the latency/jitter tradeoff: lower is smoother and laggier, higher hugs the face but inherits detector jitter. beta is how much the filter loosens up when the face is moving fast. Overlay trailing a quick head turn? Raise min_cutoff. Vibrating on a still face? Lower it.

Track loss - hold_frames, fade_frames, tracker_confidence. When detection drops, the node coasts on motion prediction for hold_frames, then fades over fade_frames. tracker_confidence is the bar for accepting a detection at all, and it's the one people get backwards: lowering it makes tracking more willing, which is what you want on hard faces, at the cost of the odd junk detection.

Then the optional block: track_prediction, fuse_detectors (keeps YuNet faces MediaPipe's landmarks don't overlap) and small_face_boost (a second YuNet pass on a 1.5× upscale) are the three robustness toggles shipped for exactly this. effect_preset defaults to custom here rather than classic - this node expects you to drive it. start_frame and rotation_phase let you join a video mid-stream and stay in phase, which matters when you chunk a long video.

The eight outputs, sorted by what they're for

  • guide_images - into your sampler, ControlNet, or whatever re-renders the scene.
  • aligned_overlay_images and overlay_masks - into GITS Final Artwork Overlay, after decode. Also handy as a standalone tracked matte.
  • final_images - artwork composited over the LaMa-filled frame; removed_background_images is the same plate with no artwork.
  • face_occlusion_masks - the face coverage region; feeds the Final Overlay's optional face_occlusion_masks input to drive its backplate.
  • tracking_preview - the guide image again, for eyeballing the track without rewiring.
  • tracking_json - a JSON string (version, fps, width, height, frames[]) of the whole track. Per-frame transforms in a text output is the kind of thing you appreciate later.

The occlusion controls - occlusion_scale, occlusion_feather_px, guide_occlusion_opacity - govern the plate itself. profile_boost and partial_face_boost do narrow, literal jobs (side shots, frame-edge crops) and barely touch frontal faces by design.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Niutonian/ComfyUI-GITS-Tracked-Identity.git
cd ComfyUI-GITS-Tracked-Identity
python -m pip install -r requirements.txt
python scripts/download_face_landmarker.py

Everything goes in ComfyUI/models/gits_tracking/: face_landmarker.task (~3.6 MB), face_detection_yunet_2023mar.onnx (~0.2 MB - both from the script above, or --skip-lama) and big-lama.pt (~196 MB, from 1038lab/Lama). Restart after.

Face removal is the dependency that bites: face_removal_mode on lama needs ComfyUI-RMBG installed and loaded, because the pack borrows RMBG's AILab_LamaRemover class and points it at your local big-lama.pt. No RMBG and you get a RuntimeError naming RMBG specifically. Set face_removal_mode to disabled and everything else still works - tracking, guide, all eight outputs.

Troubleshooting

Model not found: the three files, exact filenames, gits_tracking/, restart. If you already have Big-LaMa from RMBG, copy it rather than re-downloading.

MediaPipe import error: requirements.txt into the interpreter that launches ComfyUI. On Windows embedded, python_embeded\python.exe.

Track loss or ID swaps: aggressive_track preset, lower tracker_confidence, raise hold_frames, keep fuse_detectors and small_face_boost on. For swaps specifically, locked_face and a lower max_faces - the appearance-matching layer needs contrast to work with.

LaMa flicker across frames: raise temporal_blend, keep temporal_flow on, and only lower lama_every_n_frames if you can afford the per-frame inpaint.

Inverted logo: this node has no mask_input_mode, so if the artwork comes out backwards, put an InvertMask in front of static_logo_mask or ring_logo_mask.

Tensor size mismatch at the Final Overlay: keep the decode resolution equal to the tracking resolution - match batch, height and width.

The packaged workflows/gits_core_image_batch.json is the core-nodes-only chain (Advanced → sampler → Final Overlay), and gits_video_integration_example.json shows the VideoHelperSuite setup. For long videos, load chunks.

CategoryGITS/Tracking

Inputs (43)

NameTypeDefaultDescription
imagesIMAGE—
fpsFLOAT24.001–240—
face_scaleFLOAT1.000.25–3—
y_offsetFLOAT-0.02-1–1—
rotation_speedFLOAT42-720–720—
follow_head_rollFLOAT0.200–1—
min_cutoffFLOAT1.200.01–20—
betaFLOAT0.0350–2—
hold_framesINT80–120—
fade_framesINT80–120—
tracker_confidenceFLOAT0.450–1—
static_logooptIMAGE—
static_logo_maskoptMASK—
ring_logooptIMAGE—
ring_logo_maskoptMASK—
effect_presetoptCOMBOcustom6 options: custom, classic, subtle, aggressive_track, live_balanced, cinematic_glitch
start_frameoptINT00–2147483647—
rotation_phaseoptFLOAT0.00-3600–3600—
logo_opacityoptFLOAT1.000–1—
fallback_detectoroptCOMBOyunet2 options: yunet, disabled
occlusion_scaleoptFLOAT1.150.5–2.5—
occlusion_feather_pxoptINT80–128—
guide_occlusion_opacityoptFLOAT1.000–1—
face_removal_modeoptCOMBOlama2 options: lama, disabled
lama_removal_strengthoptINT2300–255—
lama_edge_smoothnessoptINT80–20—
final_overlay_opacityoptFLOAT1.000–1—
face_modeoptCOMBOlocked_face4 options: locked_face, largest_face, all_faces, single_face
max_facesoptINT41–12—
temporal_lamaoptBOOLEANtrue—
lama_resolutionoptCOMBO3843 options: 256, 384, 512
lama_every_n_framesoptINT21–30—
temporal_flowoptBOOLEANtrue—
temporal_blendoptFLOAT0.350–0.95—
glitch_intensityoptFLOAT0.000–1—
signal_flickeroptFLOAT0.100–1—
edge_aware_maskoptFLOAT0.350–1—
yaw_foreshortenoptFLOAT0.400–1—
profile_boostoptFLOAT0.550–1Extra LaMa/face-mask expansion on side shots only. 0 keeps tight frontal masks; raise toward 1 if profiles leave half a face.
partial_face_boostoptFLOAT0.550–1Extra mask expansion when only part of the face is visible (frame edge crop / partial face). Full faces are almost unchanged.
track_predictionoptBOOLEANtrue—
fuse_detectorsoptBOOLEANtrue—
small_face_boostoptBOOLEANtrue—

Outputs (8)

NameTypeDescription
final_imagesIMAGE—
removed_background_imagesIMAGE—
guide_imagesIMAGE—
aligned_overlay_imagesIMAGE—
overlay_masksMASK—
tracking_previewIMAGE—
tracking_jsonSTRING—
face_occlusion_masksMASK—