Views
No views yet
| 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 |
| nsfw-detection-2-mini | 96.09% | 98.59% | 98.05% | 96.06% | 96.83% | 90.92% | 17M |
| 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 |
pip install moderators then run:1from moderators import AutoModerator
2
3model = AutoModerator.from_pretrained("viddexa/nsfw-detection-2-mini")
4results = model("<path-to-image-file>")
5
6probs = {k: v for r in results for k, v in r.classifications.items()}
7predicted_label = max(probs, key=probs.get) pip install transformers then run:1from transformers import (
2 AutoImageProcessor,
3 AutoModelForImageClassification)
4from PIL import Image
5import torch
6
7img = Image.open("<path-to-image-file>")
8
9processor = AutoImageProcessor.from_pretrained("viddexa/nsfw-detection-2-mini", use_fast = False)
10model = AutoModelForImageClassification.from_pretrained("viddexa/nsfw-detection-2-mini")
11
12with torch.no_grad():
13 inputs = processor(images=img, return_tensors="pt")
14 outputs = model(**inputs)
15 logits = outputs.logits
16 probs = torch.softmax(logits, dim=-1)
17 pred_id = int(probs.argmax())
18 print(model.config.id2label[pred_id])1@article{akyon2023nudity,
2 title={State-of-the-art in nudity classification: A comparative analysis},
3 author={Akyon, Fatih Cagatay and Temizel, Alptekin},
4 booktitle={2023 IEEE International Conference on Acoustics, Speech, and Signal Processing Workshops (ICASSPW)},
5 pages={1--5},
6 year={2023},
7 organization={IEEE}
8}