Anime NSFW Detection / ADetailer All-in-One

Details

Model description

!日本語の説明は下部にあります!

This model detects NSFW areas (segments) in anime images. One model supports multiple types of detection.

Detectable Regions: nipples, pussy, anus, penis, testicles, x-ray, cross-section
Recommended Threshold: 0.5 ~ 0.8
Base Model: yolov11s-seg.pt

🗂️Install Location

  • Stable Diffusion WebUI/reForge -> models/adetailer

  • ComfyUI -> models/ultralytics/segm

❓FAQ

How to Deal with the Issue of Detected Areas Being Replaced by Another Object

  • If the detailer prompt is empty, enter the target prompt.

    • For example, if a nipples is being replaced with pussy, enter "nipples" in the prompt.
  • Lower the denoise value.

  • Expand the inpainting region.

    • WebUI (ADetailer): Increase "Mask erosion (-) / dilation (+)"

      • If "Inpaint only masked" is enabled, increase "Inpaint only masked padding, pixels"
    • ComfyUI (SEGS): Increase "crop_factor"

Troubleshooting “UltralyticsDetectorProvider Weights only load failed…” in ComfyUI

⚠️This workaround is required for v4 and earlier

  1. Install the latest ComfyUI-Impact-Subpack and restart ComfyUI.

  2. Open the file <COMFYUI_INSTALL_PATH>\user\default\ComfyUI-Impact-Subpack\model-whitelist.txt in a text editor (e.g. Notepad).

  3. Add the following line to the end of the file, then save:
    ntd11_anime_nsfw_segm_v4_all.pt
    ntd11_anime_nsfw_segm_v4_anus.pt
    ntd11_anime_nsfw_segm_v4_cross-section.pt
    ntd11_anime_nsfw_segm_v4_nipples.pt
    ntd11_anime_nsfw_segm_v4_penis.pt
    ntd11_anime_nsfw_segm_v4_pussy.pt
    ntd11_anime_nsfw_segm_v4_testicles.pt
    ntd11_anime_nsfw_segm_v4_x-ray.pt

  4. Restart ComfyUI.

References

📄Note

⚙Training Settings (v5)

task="segment"
epochs=200
lr0=0.02
lrf=0.05
seed=0
imgsz=1024
batch=-1
close_mosaic=0
mosaic=0.0
erasing=0.0
scale=0.0

For description of each setting, see: https://docs.ultralytics.com/modes/train/#train-settings

📢Past Announcements

Announcement for Stable Diffusion WebUI / reForge Users (2025/06/27)

I have an announcement for those using Stable Diffusion WebUI or reForge.
If you’re interested, please check out the details below—and I’d really appreciate any feedback or bug reports you may have!

When using my detection model with Stable Diffusion WebUI or reForge, the typical approach is to use it with the ADetailer extension.

While ADetailer offers many features, a few key functions were missing for making full use of my model.
To address that, I forked the original ADetailer and added the following features:

  • Class name filter: You can now filter detection results by specific class names

  • Class-specific prompts support: You can assign different prompts for each detected class using the [CLASS=name] syntax

  • Bounding box mask option: You can choose to use the bounding box as the mask for segmentation models, instead of the segmentation mask itself

You can find the repository here: https://github.com/newtextdoc1111/adetailer
Please see the README for installation instructions and more details on the new features.

My hope is that with class filtering, there will be no need to use anything other than the “ALL” model, and that the [CLASS=name] syntax will help reduce cases where unintended objects are drawn during inpainting.
Honestly, not having to train individual models for each release in the future would be a huge relief—this is one of the main reasons I implemented these changes 😂

If you’re someone who would still prefer to have individual models in future releases, feel free to share your specific use case. I may be able to offer an alternative solution (ComfyUI users are welcome too!).


アニメ画像のNSFW領域(セグメント)を検出するモデルです。一つのモデルで複数種類の検出に対応しています。

検出可能な領域: nipples, pussy, anus, penis, testicles, x-ray, cross-section
推奨閾値: 0.5 ~ 0.8
ベースモデル: yolov11s-seg.pt

🗂️インストール場所

  • Stable Diffusion WebUI/reForge -> models/adetailer

  • ComfyUI -> models/ultralytics/segm

❓FAQ

検出された領域が別のオブジェクトに描き換えられてしまう問題の対処法について

  • Detailer用プロンプトが空の場合、対象のプロンプトを入力する

    • nipplesがpussyに描き変わる場合、プロンプトに"nipples"と入力する
  • Denoseを下げる

  • インペイント領域を拡張する

    • WebUI (ADetailer): "Mask erosion (-) / dilation (+)" を増やす

    • ComfyUI (SEGS): "crop_factor" を増やす

ComfyUIで生成実行時に「UltralyticsDetectorProvider Weights only load failed. ...」と表示される問題の対処法について

⚠️v4以前のモデルで必要な対処法です

  1. 最新の ComfyUI-Impact-Subpack をインストールし、ComfyUIを再起動

  2. <COMFYUIインストールパス>\user\default\ComfyUI-Impact-Subpack\model-whitelist.txt が作成されているので、メモ帳などで開く

  3. 以下のテキストを追記して保存する
    ntd11_anime_nsfw_segm_v4_all.pt
    ntd11_anime_nsfw_segm_v4_anus.pt
    ntd11_anime_nsfw_segm_v4_cross-section.pt
    ntd11_anime_nsfw_segm_v4_nipples.pt
    ntd11_anime_nsfw_segm_v4_penis.pt
    ntd11_anime_nsfw_segm_v4_pussy.pt
    ntd11_anime_nsfw_segm_v4_testicles.pt
    ntd11_anime_nsfw_segm_v4_x-ray.pt

  4. ComfyUIを再起動する

参考資料

📄メモ

  • ComfyUIの場合、"All" モデルを使いつつ検出したい種類をフィルタリング可能です

  • WAI-NSFW-illustrious-SDXL, Hassaku XL (Illustrious), Raehoshi illust XL, paruparu等のIllustrious/noob派生モデルで生成した画像で学習しています

  • モノクロ画像やコミックでは検出できません

  • リアル調の画像では検出できません

⚙学習設定 (v5)

task="segment"
epochs=200
lr0=0.02
lrf=0.05
seed=0
imgsz=1024
batch=-1
close_mosaic=0
mosaic=0.0
erasing=0.0
scale=0.0

各設定の説明についてはこちら: https://docs.ultralytics.com/modes/train/#train-settings

📢過去のお知らせ

Stable Diffusion WebUI / reForge をお使いの方へのお知らせ(2025/06/27)

Stable Diffusion WebUI / reForge をお使いの方にお知らせがあります。
気になった方は以下の内容を確認し、感想や不具合の報告を頂けると嬉しいです!

Stable Diffusion WebUI / reForge (以下WebUIに統一)で私の検出モデルを利用する場合、ADetailerの拡張機能を使う方法が一般的です。

ADetailerは多くの機能がありますが、私の検出モデルを便利に活用するための機能がいくつか不足していました。
そこで、元のADetailerをフォークし以下の機能を追加しました。

  • クラスフィルター:検出したい対象をクラス名でフィルタリングする機能

  • クラス毎のプロンプト指定[CLASS=name] の構文で検出したクラス毎に個別のプロンプトを指定する機能

  • バウンディングマスクオプション:セグメント検出モデルでもバウディングボックス形状でマスクを生成するためのオプション

リポジトリは https://github.com/newtextdoc1111/adetailer にあります。追加機能の詳細とインストール方法はREADMEを確認してください。

私の想定では、クラスフィルターがあれば「ALL」モデル以外不要になり、 [CLASS=name] 構文で適切なプロンプトを与えればインペイント後に別のオブジェクトが描画される事故も減るはずです。
特に、今後のリリースで複数のモデルファイルを学習しなくて済むと本当に助かります。このために実装したと言っても過言ではありません😂

今後のリリースでも個別モデルを残してもらいたい、と考えている方は具体的なユースケースを教えてもらえれば別の解決策を提案できるかもしれません。(ComfyUIユーザーの方からでも大丈夫です)。

Images made by this model

No Images Found.