GPU图像人脸马赛克
The image face mosaic that handles angles the CPU node misses
- image
- IMAGE
The stock ImageFaceMosaicNode in this pack finds frontal faces and quietly lets everyone else walk free. If your privacy-masking job has people in profile, looking down, or halfway off camera, this is the image variant that actually keeps up. It's the same InsightFace RetinaFace detector the GPU video node uses, but for a single image: IMAGE in, IMAGE out, no files, no fuss. Menu name is GPU图像人脸马赛克 under YZZ_Face_Mosaic/GPU.
How it works
On the first run it builds InsightFace's FaceAnalysis app with the buffalo_l model set, downloads the weights if they're not already cached, and picks ONNX Runtime providers: CUDA if use_gpu is on and a CUDA device is available, CPU otherwise. Your image tensor gets converted to an OpenCV BGR array, run through the detector, and every returned face box gets pixelate, blur, or black_box applied. Result comes back as a standard IMAGE tensor you can preview, save, or keep feeding into the rest of your graph.
It's a one-shot process - no video loop, no VideoWriter - so it's effectively instant, GPU or not.
Inputs
- image - any IMAGE tensor from Load Image or anything upstream.
- use_gpu - defaults on; off forces CPU. Since it's a single frame, the difference is seconds at most, so don't stress about this toggle.
- mosaic_size - block size for pixelate, blur kernel for blur.
- mosaic_type -
pixelate,blur, orblack_box, same trio as every node in this pack.
Single output: IMAGE, ready to plug into Preview Image or Save Image.
Installing it - read this before you blame the node
InsightFace is not in the pack's requirements.txt. Install the pack and run this node as-is and you'll get a console warning that InsightFace is missing - then no faces get detected and your image comes back untouched, which is exactly the kind of silent failure that sends people to the issue tracker. One command fixes it:
pip install insightface onnxruntime-gpu # or onnxruntime for CPU-only
Restart ComfyUI and run again. First init downloads the buffalo_l weights, so expect a one-time delay.
Where it bites
Same caveat as its video sibling: no CUDA means it's just InsightFace on CPU, which is still more accurate than the Haar node but costs more. And remember this detector mosaics everyone - it has no notion of "only the person on the left." For that, the pack has SelectiveImageFaceMosaicNode, which matches faces against reference images before it paints. If you're choosing between this and the plain image node, the honest rule is: quick-and-dirty frontal faces → the CPU node; anything with real-world angles → this one.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mosaic_size | INT | 205–100 | — |
| mosaic_type | COMBO | 3 options: pixelate, blur, black_box | |
| use_gpu | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |