GITS Webcam Face Replacement
Live Face Replacement That Actually Remembers the Last Frame
- images
- static_logo
- static_logo_mask
- ring_logo
- ring_logo_mask
- final_images
- removed_background_images
GITS Webcam Face Replacement is the same trick as the Simple node with one structural difference that changes everything: it keeps state between runs. Tracker, motion smoothing and the LaMa cache all survive from one queued prompt to the next, so your stream doesn't re-acquire the face from scratch sixty times a minute.
That's not a small optimisation. A tracker that re-initialises every frame locks on cold, and the first frames of a lock are the jumpy ones - this node amortises that across a whole session.
There's a second piece of live-video plumbing worth knowing, because it's the classic webcam bug: ComfyUI caches node output, and near-identical frames can get suppressed. This node declares IS_CHANGED returning NaN - "never cache me" - so every queued frame actually processes. Ever built a webcam graph that updated at two frames a second with no error anywhere? That's why.
The three dials that matter
performance_mode - fast, balanced (default) or quality. It maps directly onto how the face gets removed: fast skips LaMa and does a blur fill, balanced runs LaMa on an interval, quality runs it on every frame. That's the real latency/quality ladder here, more than any other widget. On a laptop webcam, fast is not a compromise, it's the honest answer.
fps - defaults to 30 here versus 24 on the other nodes, and it feeds the temporal logic. Set it to what your capture node is actually producing, not what you wish it were.
reset_tracking - the one you'll hunt for after something goes wrong. State that persists is state that goes stale: move the webcam or switch subjects and the tracker is still holding the last person's face. Flip reset_tracking on for one run and it throws away the tracker, the LaMa cache and the frame counter. Then flip it back off. Don't leave it on.
The rest is the familiar GITS surface: logo_scale, vertical_position, ring_speed, removal_area, lama_strength, edge_smoothness, mask_input_mode, face_mode (only locked_face, largest_face and all_faces here - no legacy single_face), max_faces, lama_resolution, lama_every_n_frames, plus the effect controls glitch_intensity, signal_flicker, edge_aware_mask, yaw_foreshorten and the two tooltipped boosts. temporal_blend defaults to 0.3 rather than 0.35, since live frames want more responsiveness than a rendered batch.
effect_preset defaults to live_balanced, the preset named for this use case - webcam-friendly hold and fade, temporal LaMa on. Start there, drop to custom when you want your widget values taken literally.
Two outputs, same as Simple: final_images with the artwork, and removed_background_images for the LaMa plate without it. Live, you'll generally only use the first.
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
Then put all three files in ComfyUI/models/gits_tracking/: face_landmarker.task, face_detection_yunet_2023mar.onnx and big-lama.pt - the last one from 1038lab/Lama, ~196 MB, or copied from an existing ComfyUI-RMBG install. Requirements are mediapipe>=0.10.14,<0.11, numpy>=1.24,<2 and Pillow>=10.0; Python 3.10/3.11 is the reference environment. Restart ComfyUI - you can't hot-load the node and expect the tracker to behave.
This node needs a capture source upstream; it takes images, it doesn't open a camera itself. The pack ships workflows/gits_webcam_template.json wired for that. Big-LaMa removal goes through ComfyUI-RMBG - the pack borrows RMBG's AILab_LamaRemover at runtime. Without RMBG, fast mode still works (it never touches LaMa), and so does everything except the balanced/quality inpaint, which is a decent argument for staying on fast while you get the rest working.
Keeping it alive
The README's performance table is short and correct: for live use, run live_balanced with balanced mode and lama_resolution at 256 or 384 - 512 is a desktop-GPU luxury and the diff is invisible at webcam bitrates. With several faces, lower max_faces, raise lama_every_n_frames, or drop to fast. MediaPipe runs CPU-side in this pack, so a busy CPU is your frame budget even if the GPU is idle.
Where it goes wrong, honestly:
- It re-acquires your face every time. Something reset the tracker. Confirm
reset_trackingis off, and that you're not restarting ComfyUI between prompts. - It locks onto someone else.
locked_faceplus a one-shotreset_trackingpass. - Sluggish, and the GPU is bored. You're in
balancedorqualitywith too many faces, or LaMa is running on every frame at 512. Checkperformance_modefirst. - Import error on startup. MediaPipe didn't install into ComfyUI's interpreter. Verify with that exact interpreter, not your shell's
python. - The whole frame looks tinted. Not a bug in current builds - the pack restores original RGB outside the removal mask. If you're on an older checkout, update; the changelog lists the fix.
One last thing about the stateful design that isn't obvious: because it keeps state on the node instance, two webcam nodes in one graph are two independent trackers with two independent LaMa caches. Useful for a side-by-side, memory-hungry for no reason otherwise.
Inputs (28)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| fps | FLOAT | 301–120 | — |
| effect_preset | COMBO | live_balanced | 6 options: custom, classic, subtle, aggressive_track, live_balanced, cinematic_glitch |
| performance_mode | COMBO | balanced | 3 options: balanced, fast, quality |
| lama_resolution | COMBO | 384 | 3 options: 256, 384, 512 |
| lama_every_n_frames | INT | 21–30 | — |
| logo_scale | FLOAT | 1.100.25–3 | — |
| vertical_position | FLOAT | -0.04-1–1 | — |
| ring_speed | FLOAT | 35-720–720 | — |
| removal_area | FLOAT | 1.150.5–2.5 | — |
| lama_strength | INT | 2300–255 | — |
| edge_smoothness | INT | 80–20 | — |
| mask_input_mode | COMBO | comfy_load_image | 2 options: comfy_load_image, alpha_mask |
| reset_tracking | BOOLEAN | false | — |
| face_mode | COMBO | locked_face | 3 options: locked_face, largest_face, all_faces |
| max_faces | INT | 41–12 | — |
| temporal_flow | BOOLEAN | true | — |
| temporal_blend | FLOAT | 0.300–0.95 | — |
| glitch_intensity | FLOAT | 0.000–1 | — |
| signal_flicker | FLOAT | 0.100–1 | — |
| edge_aware_mask | FLOAT | 0.250–1 | — |
| yaw_foreshorten | FLOAT | 0.350–1 | — |
| profile_boost | FLOAT | 0.550–1 | Extra LaMa mask expansion on side shots only. Raise if profiles leave half a face. |
| partial_face_boost | FLOAT | 0.550–1 | Extra mask expansion when only part of the face is visible (edge crop). Full faces almost unchanged. |
| static_logoopt | IMAGE | — | |
| static_logo_maskopt | MASK | — | |
| ring_logoopt | IMAGE | — | |
| ring_logo_maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| final_images | IMAGE | — |
| removed_background_images | IMAGE | — |