Nodes/WAS Node Suite v3/Image Crop Face (YuNet)
ComfyUI Node Runs on cloud

Image Crop Face (YuNet)

A face crop that tells you how sure it is

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Image Crop Face (YuNet)
  • image
  • yunet_model
  • IMAGE
  • CROP_DATA
  • faces_found
  • confidence_score
crop_padding_factor0.25
confidence0.60
select

The difference between the two face-crop nodes in WAS Node Suite is the difference between a metal detector from 2003 and a modern one with a display: the classic cascade version finds faces but can't tell you whether it's sure. Image Crop Face (YuNet) can. It runs YuNet, a modern learned face detector, and it reports not just where a face is but how confident the detector was and how many it saw - which is exactly what you want when the crop feeds an automated fix loop that shouldn't run on a false positive.

It comes from WAS Node Suite (WASasquatch's MIT pack, v3 ships 457 nodes). The YuNet detector ships inside the pack and runs in torch on whatever device ComfyUI is using, so there's nothing to install - and if you want it gone entirely, the config key features.yunet set to false leaves the node out of the menu.

How it's wired

The one input that's easy to miss: yunet_model is a YUNET_MODEL socket, fed by the pack's sibling YuNet Model Loader node. You load the detector once, wire it in, and the crop node does the rest. That indirection is normal for the suite and it means one loaded model can drive many crop nodes without reloading.

From there the controls read like a face pipeline designer's wish list:

  • confidence (default 0.6) - how sure the detector has to be before a region counts as a face. Drop toward 0.3 for a small, blurred, or heavily stylized face; raise toward 0.9 when a busy background keeps producing detections that aren't faces.
  • select - which face wins when several are found. largest takes the one filling the most pixels (usually the subject); highest confidence takes the one the detector is surest of (the move for a crowd where the subject isn't nearest); leftmost/rightmost pick by position when you know the framing.
  • crop_padding_factor (default 0.25) - room around the detection, as a fraction of its size, so a re-render pass has surroundings to blend against. 2.0 reaches roughly to the shoulders.

Like the cascade crop, a batch is searched on its first image and every frame is cut to that same window.

Outputs that make it automatable

  • IMAGE - the square crop, at least 64px a side; a black 512×512 placeholder when nothing was found.
  • CROP_DATA - the window for Image Paste Face to put the reworked face back.
  • faces_found (INT) - how many faces the detector reported before one was chosen. 0 means the crop is the black placeholder.
  • confidence_score (FLOAT) - how sure the detector was about the face it cropped. This is the output the cascade node can't give you, and it's what makes routing possible: wire confidence_score into a condition node and send doubtful detections somewhere else - a fallback crop, a different cascade, a human check.

Which to pick

Reach for YuNet when the faces are hard - angled, small, partially lit, drawn with a stylized hand - or when the crop is one stage of an unattended batch loop where a confident "no face here" needs to trigger a different path. The cascades in the other node are faster and completely dependency-free in the classic sense, but they offer no score and no face count. In practice: cascade for quick photographic stills where you'll eyeball the result, YuNet when the pipeline has to decide things for itself.

Install

Standard WAS Node Suite: ComfyUI Manager, search "WAS Node Suite v3", or git clone https://github.com/WASasquatch/was-node-suite-comfyui into ComfyUI/custom_nodes and restart. Requires ComfyUI 0.14.0+ and Python 3.10+. The YuNet weights ship in the repo, so nothing downloads; and because v3 installs no Python packages, you're spared the dependency collisions that plagued v2.

CategoryWAS Suite/Image/Process

Inputs (5)

NameTypeDefaultDescription
imageIMAGEThe image to search for a face in. A batch is searched on its first image and every image is then cut to that same window.
yunet_modelYUNET_MODELThe detector, from YuNet Model Loader.
crop_padding_factorFLOAT0.250–2How much room to leave around the detected face, as a fraction of its size. 0.0 crops tight to the detection, 0.25 leaves a quarter of the face size as margin, and 2.0 pulls back far enough to include the shoulders.
confidenceFLOAT0.600–1How sure the detector has to be before a region counts as a face. Lower finds more faces and more false positives: drop towards 0.3 for a small, blurred or heavily stylised face, raise towards 0.9 when a busy background is producing detections that are not faces.
selectCOMBOWhich face to crop when several are found. `largest` takes the one filling the most pixels, which is usually the subject. `highest confidence` takes the one the detector is surest of, which suits a crowd where the subject is not the nearest. `leftmost` and `rightmost` pick by position, for a framing you already know.

Outputs (4)

NameTypeDescription
IMAGEIMAGEThe square face crop, at least 64 pixels on a side. A black 512x512 image when no face was found.
CROP_DATACROP_DATAThe crop window, for Image Paste Face to put the reworked face back in the right place. One window covers a whole batch. False when no face was found.
faces_foundINTHow many faces the detector reported before one was chosen. 0 means the crop is the black placeholder.
confidence_scoreFLOATHow sure the detector was about the face it cropped, 0.0 to 1.0. Wire it into a condition node to route a doubtful detection somewhere else. 0.0 when no face was found.