ComfyUI-NSFW-Detection

ComfyUI-NSFW-Detection
★ 51

NSFW检测图像分类安全过滤ComfyUI节点
在ComfyUI中基于机器学习模型对生成图像进行NSFW检测,按阈值判定并在不安全时返回替代图像,便于自动化安全过滤。
💡 在ComfyUI流水线中自动替换被判定为NSFW的生成图像。
🍴 18 Forks💻 Python🔄 2025-04-21
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/79aaff81621b
📦 requirements.txt
transformers==4.45.0
pillow==10.3.0
📄 README

This is an implementation of NSFW Detection for ComfyUI

Project Overview

This project is designed to detect whether images generated by ComfyUI are Not Safe For Work (NSFW). It uses a machine learning model to classify images as either safe or not safe for work. If an image is classified as NSFW, an alternative image is returned.

Install

  • Clone this repo into custom_nodes directory of ComfyUI location
  • Run pip install -r requirements.txt
  • Usage

    The main functionality of the project is encapsulated in the NSFWDetection class in the node.py file. This class has a run method that takes three parameters:

  • image: The image to be classified.
  • score: The threshold score for classifying an image as NSFW.
  • alternative_image: The image to be returned if the input image is classified as NSFW.
  • Example

    https://github.com/trumanwong/ComfyUI-NSFW-Detection/blob/main/workflow.json

    Contributing

    Contributions are welcome. Please submit a pull request if you have any improvements or bug fixes.

    License

    This project is licensed under the terms of the MIT license.