A ComfyUI custom node that detects NSFW content using Freepik/nsfw_image_detector (EVA-based, ~86MB) and saves images with detection results in the filename.
Drop-in replacement for SaveImage with built-in NSFW detection.
| Name | Type | Description |
|---|---|---|
| images | IMAGE | Input images |
| filename_prefix | STRING | Filename prefix (default: ComfyUI) |
| nsfw_threshold | low / medium / high |
Detection threshold (default: medium). See Threshold levels |
| Name | Type | Description |
|---|---|---|
| images | IMAGE | Passthrough (for chaining) |
| nsfw_level | STRING | Detected level: neutral / low / medium / high |
| nsfw_score | FLOAT | Confidence score of the detected level |
The model classifies images into 4 levels: neutral, low, medium, high. The nsfw_threshold parameter controls the minimum level that triggers a flag — images at or above the threshold are flagged.
| Threshold | Flagged levels | Passed levels | Strictness |
|---|---|---|---|
low |
low, medium, high | neutral only | Strictest |
medium |
medium, high | neutral, low | Balanced |
high |
high only | neutral, low, medium | Most lenient |
- Normal:
{prefix}_00001_.png - Flagged:
{prefix}_flagged_{level}_00001_.png
Clone into ComfyUI's custom_nodes directory:
cd ComfyUI/custom_nodes
git clone https://github.com/newraina/comfyui-nsfw-detector.git
pip install -r comfyui-nsfw-detector/requirements.txtThe model is downloaded from HuggingFace on first use by default. To pre-download, place model files in ComfyUI/models/nsfw_detector/:
models/nsfw_detector/
config.json
model.safetensors
If you're using comfyui-api, add to manifest.yml:
models:
before_start:
- url: https://huggingface.co/Freepik/nsfw_image_detector/resolve/main/config.json
local_path: models/nsfw_detector/config.json
- url: https://huggingface.co/Freepik/nsfw_image_detector/resolve/main/model.safetensors
local_path: models/nsfw_detector/model.safetensors