ZML_YOLO打码
YOLO finds the face, mosaics it, done
- 原始图像
- 安全审查图像
- 处理后图像
- 检测遮罩
- 检测结果
Blurring faces by hand across a batch is the kind of task that makes you wonder why you don't automate it. ZML_AutoCensorNode (ZML_YOLO打码) is the automation: it runs a YOLO object detector over your image, finds the targets (faces, hands, whatever your model knows), and covers them with a mosaic or an overlay image. It also has a review mode that turns the whole thing into a content filter - detect something and swap the frame for a safe image instead.
What it is
An ultralytics-backed detection-and-censor node from ComfyUI-ZML-Image. This is the same YOLO machinery that powers the masking/detailing ecosystem - you're not training anything, you're using a community-standard .pt detector. The inputs that matter:
- 原始图像 (IMAGE) - what you're censoring.
- YOLO模型 - a dropdown populated from
ComfyUI/models/ultralytics/. This is the step everyone trips on: it's empty until you actually put a model file there.face_yolov8n.ptorface_yolov8s.ptare the usual picks, straight from the standard detailing toolchain. - 置信度阈值 (FLOAT, 0.5) - how sure the model has to be. Lower it and you get more detections plus more false positives.
- 覆盖模式 - 图像 (paste an overlay image over each detection) or 马赛克 (mosaic/pixelate).
- 马赛克数量 (5), 遮罩缩放系数 (1.0), 遮罩膨胀 (0) - mosaic block count and how much to grow/shrink the covered region. A little dilation makes sure the whole face is covered even if the box is tight.
- 审查模式 (BOOLEAN) - the tooltip says it plainly: when on, if a target is detected the node outputs the 安全审查图像 instead. That's your "replace the unsafe frame" content filter.
Outputs: 处理后图像 (the censored result), 检测遮罩 (a MASK of everything detected - feed it to other nodes), and 检测结果 (BOOLEAN - whether anything was found). If no model is selected or nothing is detected, the original image passes through with a blank mask and a false flag.
How it works
It loads the YOLO model with ultralytics (in a compatibility mode that keeps it working under current ComfyUI), runs detection at your confidence threshold, and for each hit converts the detection to a mask - supporting both box and segmentation models. It can scale and dilate the mask so the blur covers the full face, then applies the mosaic or pastes your overlay. The mask output is a genuinely useful extra: wire it to anything that consumes MASKs, like the pack's own mask nodes or an inpainting chain.
Install and gotchas
Two parts to install here. The pack first:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
or ComfyUI Manager → ComfyUI-ZML-Image, restart. The pack's requirements include ultralytics, which Manager will install.
Then the model - this is where people get stuck. The node reads ComfyUI/models/ultralytics/ (it auto-registers that folder), and if it's empty, the dropdown is empty and the node just passes images through untouched. Drop a face_yolov8n.pt (or the -s variant for accuracy) into that folder and refresh. The README even documents a historical bug where the node couldn't see the YOLO models in some setups - fixed, but if your dropdown is empty, that folder is the first suspect.
Caveats: a low confidence threshold on a crowd will mosaic half the image; that's YOLO, not the node. And the detection-then-replace review mode is a blunt filter - good enough for a pipeline guard, not a guarantee, so don't ship it as content moderation. Chinese-first UI, English patch at github.com/zml-w/ZZZ_ZML_English_Patch, no English community to lean on - GitHub issues are the channel.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| 原始图像 | IMAGE | — | |
| YOLO模型 | COMBO | 0 options: | |
| 置信度阈值 | FLOAT | 0.500–1 | — |
| 覆盖模式 | COMBO | 2 options: 图像, 马赛克 | |
| 拉伸图像 | BOOLEAN | false | — |
| 审查模式 | BOOLEAN | false | 开启审查模式时,如果检测到目标,将直接输出安全审查图像 |
| 马赛克数量 | INT | 51–256 | — |
| 遮罩缩放系数 | FLOAT | 1.000.1–5 | — |
| 遮罩膨胀 | INT | 00–128 | — |
| 安全审查图像opt | IMAGE | 开启审查模式时,如果检测到目标,将直接输出安全审查图像 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 处理后图像 | IMAGE | — |
| 检测遮罩 | MASK | — |
| 检测结果 | BOOLEAN | — |