ComfyUI Node

Find NSFW Part

Find out WHERE it's NSFW, not just whether

By phyblas·Created 12 months ago·Updated 4 months ago· 17
Find NSFW Part
  • image
  • detection
model_resolution
buttocks exposed threshold0.20
female breast exposed threshold0.20
female genitalia exposed threshold0.20
anus exposed threshold0.20
male genitalia exposed threshold0.20

The other detector nodes in this pack answer "is it NSFW?" with a number. FindNsfwPart answers a more useful question: where. It runs the NudeNet detector and hands you a list of the exposed bits it found - buttocks, breasts, genitals, anus - each with a confidence score and a bounding box. It's the eyes for CensorNsfwPart, and it's genuinely handy on its own if you want to log what's in an image without touching it.

How it works

NudeNet is an object detector trained on 18 body-part classes; FindNsfwPart filters that down to the five that are actually NSFW: buttocks, female breast, female genitalia, anus, and male genitalia (all "exposed"). The model_resolution dropdown picks the 320 or 640px model. The 640 version catches smaller details but is a bigger download and slower per frame - start at 320 and only bump up if it's missing things.

What you'll actually set is the five per-part thresholds, one for each exposed label, defaulting to 0.2. Lower a threshold and that body part gets flagged more eagerly. Want a strict censoring pipeline? Drop them all to 0.1. Getting flooded with false hits? Raise them.

The output

  • detection (STRING) - a readout of every hit: {label, score, bbox} per detected part.

Fair warning: it's typed as a STRING but it's really a list of dicts, and it's meant to be inspected or logged - think of it as the node talking to you, not a value you chain into a math node. If you want the localized censoring that uses these boxes, that's CensorNsfwPart in the same pack.

Install

Same pack, same drill - ComfyUI Manager (search "nsfw-shorier") or:

cd ComfyUI/custom_nodes
git clone https://github.com/phyblas/nsfw-shorier_comfyui

Restart, then the first run pulls the NudeNet ONNX file from Hugging Face. One real gotcha: the NudeNet code imports OpenCV (cv2), and opencv-python isn't in the pack's requirements.txt. If the pack fails to load on a lean install, pip install opencv-python fixes it.

The anime problem

This is the big one, and it's not a bug. NudeNet is trained on realistic photos. On anime and stylized art it misses obvious content and flags random body parts that are obviously fine. There's a long history of people hitting exactly this wall in r/comfyui - it works great on photography and falls apart on drawn art. If you're censoring anime, expect to lean on manual masks or a YOLO model trained on anime instead, and don't blame the threshold settings.

CategoryNSFW

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
model_resolutionCOMBO2 options: 320, 640
buttocks exposed thresholdFLOAT0.200–1
female breast exposed thresholdFLOAT0.200–1
female genitalia exposed thresholdFLOAT0.200–1
anus exposed thresholdFLOAT0.200–1
male genitalia exposed thresholdFLOAT0.200–1

Outputs (1)

NameTypeDescription
detectionSTRING