NSFW Check (HF Classifier)
The one-node version — load and classify in a single drop
- image
- block_policy
- image
NSFW Check (HF Classifier) is the pack's shortcut node - it loads a Viddexa classifier and runs it against an image in one step, no separate loader required. If you only have one place in your workflow where you need to check an image, right before Save Image say, this is genuinely the simpler pick over wiring up NSFW Load Model and NSFW Check (HF, Shared Model) as two separate nodes. The pack's own README says as much: it's simpler for one checkpoint, and the shared-model split only earns its keep once you're checking more than once.
That "more than once" caveat matters, though, because this node's convenience has a cost: every instance of it loads its own copy of the classifier. Drop two of these in the same graph - one on the input, one on the output - and you're loading the model twice per run instead of once. Fine if you genuinely only need one check point. Worth switching to the shared-model pair the moment you need two or more.
How it works
Same classifier, same policy logic as the rest of the pack - it just skips the separate load step. You pick a model_repo, feed it an image, and it classifies the image into one of five buckets (porn, hentai, sexy, drawing, or neutral) and compares that against your block_policy. Pass, and the image comes out the other side unchanged. Fail, and the pack does what it always does on a block: fires an nsfw_guard.content_blocked event, calls interrupt_processing(True), and raises an nsfw_content_detected error. There's no blur-and-continue option here - a block stops the run.
The inputs and outputs that matter
image(IMAGE) - required, what gets classified.model_repo-viddexa/nsfw-detection-2-nano(default) orviddexa/nsfw-detection-2-mini. Same two options as the loader node; the README doesn't spell out a speed/accuracy delta between them.block_policy(NSFW_BLOCK_POLICY, optional) - connect aNSFW Filter Policynode here to override the default policy, which blocks porn, hentai, and sexy, and allows drawing and neutral. Leave it unwired and you get that default.
One output: image, identical to the input when it passes.
How to install it
ComfyUI Manager: search "NSFW Guard", install, restart - this pulls in all five nodes in the pack, this one included. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/vuhung3990/comfyui-nsfw-guard
pip install -r comfyui-nsfw-guard/requirements.txt
then restart. Dependencies are light: the moderators PyPI package as the preferred backend, transformers as the fallback if that's not installed.
Common issues & troubleshooting
First execution takes a while. It's fetching the classifier weights from Hugging Face - a one-time cost per model repo, then it's cached locally and later runs are fast.
You're running this node twice in the same graph and things feel slow. That's the tradeoff above: each instance loads its own model. Swap to NSFW Load Model feeding two NSFW Check (HF, Shared Model) nodes if you're screening at more than one point in the graph.
A run stops with nsfw_content_detected and you weren't expecting it. Working as designed - this pack doesn't return a blurred or replaced image on a block, it halts the run entirely. If it's tripping on content you consider fine, that's a block_policy tuning question (wire in a NSFW Filter Policy node and turn off the class you don't want blocked), not a bug in the classifier.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_repo | COMBO | viddexa/nsfw-detection-2-nano | 2 options: viddexa/nsfw-detection-2-nano, viddexa/nsfw-detection-2-mini |
| block_policyopt | NSFW_BLOCK_POLICY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |