Downloads · 30 days
1.1K
10% of all-time downloads
viddexa/nsfw-detection-2-mini
nsfw-detection-2-mini is a image classification model from viddexa. Use it when you need a label for an image. It is set up for transformers. The card lists the license as apache-2.0.
A mobile-friendly visual content moderation model, based on the work of F. C. Akyon obtained by fine-tuning EfficientNet-b4 on nsfw images to detect nudity and sexual content in images or video frames with high accuracy.
Downloads · 30 days
1.1K
10% of all-time downloads
All-time downloads
11.2K
Public
Parameters
17.7M
70.8 MB on disk
Likes
10
Public
Click a slice to open those files.
.safetensors70.8 MB · 100%
From the Hugging Face model README
A mobile-friendly visual content moderation model, based on the work of F. C. Akyon obtained by fine-tuning EfficientNet-b4 on nsfw images to detect nudity and sexual content in images or video frames with high accuracy.
For a Demo, see: [viddexa/moderators]
Image detection performance of this model on 5 classes described above compared with other models trained by our team provided below with average and per-class F-scores.
| Model | F_macro | F_safe | F_porn | F_hentai | F_drawing | F_sexy | Params |
|---|---|---|---|---|---|---|---|
| nsfw-detection-2-nano | 93.00% | 96.82% | 96.34% | 93.43% | 93.24% | 85.15% | 4M |
| <b><span style="color:turquoise">nsfw-detection-2-mini</span></b> | <b><span style="color:turquoise">96.09%</span></b> | <b><span style="color:turquoise">98.59%</span></b> | <b><span style="color:turquoise">98.05%</span></b> | <b><span style="color:turquoise">96.06%</span></b> | <b><span style="color:turquoise">96.83%</span></b> | <b><span style="color:turquoise">90.92%</span></b> | <b><span style="color:turquoise">17M</span></b> |
| nsfw-detection-1-mini | N/A | 97.90% | N/A | N/A | N/A | N/A | 17M |
| Azure AI | N/A | 96.79% | N/A | N/A | N/A | N/A | N/A |
| Falconsai | N/A | 89.52% | N/A | N/A | N/A | N/A | 85M |
<b><span style="color:turquoise">nsfw-detection-2-mini</span></b> and nsfw-detection-2-nano supports 5 classes: Normal, Hentai, Porn, Sexy, Drawing
Install with pip install moderators then run:
from moderators import AutoModerator
model = AutoModerator.from_pretrained("viddexa/nsfw-detection-2-mini")
results = model("<path-to-image-file>")
probs = {k: v for r in results for k, v in r.classifications.items()}
predicted_label = max(probs, key=probs.get)
Install with pip install transformers then run:
from transformers import (
AutoImageProcessor,
AutoModelForImageClassification)
from PIL import Image
import torch
img = Image.open("<path-to-image-file>")
processor = AutoImageProcessor.from_pretrained("viddexa/nsfw-detection-2-mini", use_fast = False)
model = AutoModelForImageClassification.from_pretrained("viddexa/nsfw-detection-2-mini")
with torch.no_grad():
inputs = processor(images=img, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
probs = torch.softmax(logits, dim=-1)
pred_id = int(probs.argmax())
print(model.config.id2label[pred_id])
5-class nudity and sexual content classification model that classifies images as Normal, Porn, Hentai, Drawing or Sexy. Model is obtained by fine-tuning google's Efficientnet-b4.
This model is designed to detect explicit nudity alone. For instance, an image containing suggestive nudity or risqué clothing is labeled as safe if there is no explicit nudity in the image.
Appropriate Use Cases:
In these settings, the model acts as an initial screening tool to help reduce moderator workload. A human review step is recommended for final decisions.
This model is not intended for:
@article{akyon2023nudity,
title={State-of-the-art in nudity classification: A comparative analysis},
author={Akyon, Fatih Cagatay and Temizel, Alptekin},
booktitle={2023 IEEE International Conference on Acoustics, Speech, and Signal Processing Workshops (ICASSPW)},
pages={1--5},
year={2023},
organization={IEEE}
}