Nodes/facetaggg/FaceTag Crop (YOLO)
ComfyUI Node

FaceTag Crop (YOLO)

Fix faces across every frame of a video without masking a single one

By adbrasi·Created 30 days ago·Updated 27 days ago· 0
FaceTag Crop (YOLO)
  • image
  • image
  • mask
  • preview
  • paste_data
model_name
confidence0.25
padding2.00
output_width768
output_height768
smoothing0.95
zoom_mode
zoom_percentile95.0
mask_mode
max_gap12
mask_grow0
mask_feather0
detector_imgsz640
batch_size16
device

You've got a 200-frame video and one face that's soft, blurry, or just wrong in every single frame. Masking that by hand is a weekend. FaceTag Crop (YOLO) is the automated version of the detailer loop that's been standard practice since ADetailer and FaceDetailer - detect, crop, refine, paste back - except it does the detect + crop + mask part for a whole batch of frames at once, and it does it temporally stable. It comes from ADbrasil's small facetaggg pack, and it's deliberately just half a workflow: the other half is its sibling node, FaceTag Paste Back.

Why you'd reach for it

Why this pattern at all? Masked inpainting still owns the one thing edit models can't give you: bit-identical unmasked pixels, plus full-resolution detail budget on just the part you want fixed. On a video you'd get those benefits only if your crop and mask were perfectly consistent frame to frame - and they never are by hand. That's the whole reason this node exists.

How it works

Here's the mechanism. A YOLO model (any .pt, .onnx, or .engine in your models/ultralytics folder) runs detection over the batch. A select_primary step picks the main face each frame - if there was a previous frame, it prefers the box closest to where that face was, weighted by confidence - then fill_missing interpolates boxes across gaps where detection failed, up to max_gap frames. Bigger gaps hold the nearest detection instead of sweeping. If nothing is detected in the whole batch it falls back to a full-frame crop and an all-white mask with a console warning instead of erroring - which is friendlier than it deserves to be. The crop geometry gets run through a zero-phase EMA (smoothed forward and backward, so the crop follows the face without lagging behind it), and output dimensions are snapped to a multiple of 32 because samplers demand it.

The inputs that matter

The inputs a beginner actually touches: image (a single image or a video-frame batch), model_name (your YOLO file), confidence, padding (crop size as a multiple of the detected box), output_width/output_height, and device (auto/cuda/cpu). The one worth understanding before you run is mask_mode. follow_detection keeps a steady camera and lets the mask track the box inside the crop. locked_center nails the subject to center and auto-zooms so the crop never samples a border - and uses one fixed mask size for the whole clip, which makes it a rock-solid paste target. full_frame skips the crop entirely and just hands you the face mask over the original scene (handy if you're inpainting in place). mask_grow and mask_feather tune the mask edge before it leaves the node.

Outputs

It outputs four things: image (the crop at your output size), mask (aligned to the crop), preview (the crop with a translucent green overlay so you can eyeball the tracking), and - the important one - paste_data, a FACETAG_PASTE token that carries the original frames and every crop's placement. That plugs straight into FaceTag Paste Back.

Install

ComfyUI Manager, search "facetaggg", or:

cd ComfyUI/custom_nodes
git clone https://github.com/adbrasi/facetaggg.git
# restart ComfyUI

Its requirements.txt is just ultralytics and opencv-python; torch ships with ComfyUI. If ultralytics is somehow missing, the node quietly pip-installs it for you on first use. The model dropdown is the gotcha everyone hits: it reads ComfyUI/models/ultralytics recursively (subfolders like bbox/ are fine), and until you drop a .pt in there it shows "(no models found in models/ultralytics)". Any detection YOLO works - a face model like yolov8n-face, or a plain bbox model.

Troubleshooting

Empty dropdown = no model in the folder yet; add one and refresh. "Model not found" = path typo or the model isn't under models/ultralytics. Bigger batch_size uses more VRAM but speeds up detection. And one genuine caution: this pack sits on the Ultralytics dependency surface, the same library that shipped a cryptominer in a compromised release back in December 2024 (it reached ComfyUI via Impact Pack). Nothing wrong with this node - just keep your ultralytics install current instead of letting an old pinned copy rot.

The crop alone does nothing useful. Wire image into an inpaint (or an edit model), and the inpainted crop into FaceTag Paste Back - that's the workflow.

Categoryimage/facetag

Inputs (16)

NameTypeDefaultDescription
imageIMAGE
model_nameCOMBO1 options: (no models found in models/ultralytics)
confidenceFLOAT0.250.01–1
paddingFLOAT2.001–8Crop size as a multiple of the detected box
output_widthINT76864–4096
output_heightINT76864–4096
smoothingFLOAT0.950–0.99Temporal smoothing across the batch (video frames)
zoom_modeCOMBOfixed: one zoom level for the whole batch
zoom_percentileFLOAT95.050–100
mask_modeCOMBOfollow_detection: steady camera, mask tracks the box inside the crop. locked_center: subject nailed to the center, crop auto-zooms to stay inside the frame (no padding/mirror). zoom_mode=fixed locks one zoom for the whole clip; smooth lets it breathe with the subject. full_frame: NO crop -- keep the original scene and just output the face mask (padding expands the mask box; width/height/zoom are ignored)
max_gapINT120–300Max missing-frame gap bridged by interpolation
mask_growINT0-256–256Grow (+) or shrink (-) the mask before feathering, in pixels
mask_featherINT00–256Gaussian blur radius on the mask edges, in pixels
detector_imgszINT640256–1536
batch_sizeINT161–256Frames per YOLO forward pass. Bigger = more GPU use / faster on beefy cards
deviceCOMBOauto/cuda run on GPU when available; cpu forces CPU

Outputs (4)

NameTypeDescription
imageIMAGE
maskMASK
previewIMAGE
paste_dataFACETAG_PASTE