Shibiko AI - Cascade Detection
Face detection without YOLO — OpenCV's Haar cascades, anime face included
- image
- image
- mask
- bbox
Need to find faces, eyes, or anime faces in an image and turn them into masks or boxes - without pulling in a YOLO model? That's this node. It wraps OpenCV's built-in Haar cascades, the old-school machine-learning detectors that have shipped with OpenCV for over a decade, and hands you an image with boxes drawn, a mask, and the bounding boxes themselves.
The licensing angle in the README is worth taking seriously: YOLO weights are AGPL, which is a non-starter for commercial work unless you buy a license. Haar cascades are bundled with OpenCV (BSD-licensed) and there's no model download at all. The author's pitch - "you can use this as an alternate way for inpainting or in combination with other masking techniques" - is accurate. It pairs naturally with the pack's BboxInsertImage, or with mask-based inpainting from the KB's playbook, and it runs on CPU in milliseconds.
How it works
At startup the node scans two places for .xml cascade files: whatever you've dropped into ComfyUI/models/cascades, and OpenCV's own embedded cv2.data.haarcascades folder - that's where the 17 options like frontalface_default, eye, frontalcatface, fullbody, and license_plate_rus_16stages come from. Detection is classic detectMultiScale (scaleFactor 1.1, minNeighbors 5, min size 32px). For each hit it draws a rectangle on a copy of the image, and builds a mask by filling each box, then applying your chosen blur (gaussian, median, or box) and dilation to feather and grow the region.
The inputs that matter
- cascade - the dropdown.
frontalface_defaultis the safe starting point;eyeis handy for close crops. - blur (default 32) and blur_type (box/gaussian/median) - how much the mask edges are softened. This is your feather control.
- dilation (default 4) - grows the mask beyond the detected box, so an inpainting pass covers the whole face.
- padding (default 4) - how far the drawn rectangle sits outside the box.
Three outputs: image (boxes drawn), mask (feathered, dilated regions), and bbox (the coordinates, ready for BboxSplit or BboxInsertImage).
Install and the fresh-install gotcha
cd ComfyUI/custom_nodes
git clone https://github.com/Shibiko-AI/ShibikoAI-ComfyUI-Tools
Or ComfyUI Manager → "Shibiko". Here's the real-world trap: the node's startup code tries to copy built-in cascades from an assets/cascades folder into ComfyUI/models/cascades - but that folder isn't shipped in the repo, so on a truly fresh install the whole pack can fail to load with a FileNotFoundError if models/cascades doesn't exist yet. If that happens, create the folder yourself before launching:
mkdir -p ComfyUI/models/cascades
One more README-vs-reality note: the README says Nagadomi's lbpcascade_animeface is bundled, but as of the current tree it isn't in the repo. It's a free download from Nagadomi's GitHub - grab the XML and drop it in models/cascades, and the anime face option appears in the dropdown. Also set expectations: Haar cascades only handle frontal, roughly upright faces. Profiles, heavy angles, or heavy occlusion and it'll miss them - that's the trade for being free and CPU-fast.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| cascadeopt | COMBO | frontalface_default | 17 options: eye, eye_tree_eyeglasses, frontalcatface, frontalcatface_extended, frontalface_alt, frontalface_alt2, +11 |
| bluropt | INT | 320–100 | — |
| blur_typeopt | COMBO | box | 3 options: gaussian, median, box |
| dilationopt | INT | 4 | — |
| paddingopt | INT | 4 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| bbox | BBOX | — |