ViT Fetish NSFW Detector
A Vision Transformer (ViT) for binary NSFW/SFW image classification, specifically trained to handle fetish content and a wide variety of image styles including artwork, illustrations, and AI-generated imagery.
Model Description
This model is a fine-tuned version of
AdamCodd/vit-base-nsfw-detector, further trained on a curated dataset to improve detection of fetish-specific NSFW content and to generalize across diverse image types.
What's Different From the Base Model
The base model (AdamCodd/vit-base-nsfw-detector) was primarily trained on photographic content. This fine-tune extends its capabilities to better handle:
- Fetish-specific content — BDSM, latex, leather, and related imagery
- Photographs — Real-world photos of various styles
- AI-generated images — Content from Stable Diffusion, Midjourney, DALL-E, etc.
- Digital illustrations — Anime, manga, cartoon styles
- Traditional artwork — Drawings, paintings, sketches
- 3D renders — CGI and rendered artwork
This makes the model more robust for content moderation systems that need to handle mixed media sources.
Model Details
- Architecture: Vision Transformer (ViT-base, patch size 16)
- Input resolution: 384×384 RGB images
- Output: Binary classification (
sfw, nsfw)
- Base model: AdamCodd/vit-base-nsfw-detector
Performance
| Metric | Validation | Test (Held-Out) |
|---|
| Accuracy | 93.95% | 92.44% |
| F1 Score | 93.95% | 92.44% |
| Precision | 93.97% | 92.45% |
| Recall | 93.95% | 92.44% |
Training Details
- Training samples: 1,862
- Validation samples: 397
- Test samples: 397 (held-out)
- Epochs: 10
- Final training loss: 0.031
Dataset Composition
| Label | Total | Train | Val | Test |
|---|
| NSFW | 1,351 | 947 | 202 | 202 |
| SFW | 1,305 | 915 | 195 | 195 |
The dataset includes a balanced mix of photographic content, AI-generated images, digital illustrations, drawings, and 3D renders across both classes.
Usage
1from transformers import AutoImageProcessor, AutoModelForImageClassification
2from PIL import Image
3import torch
4
5# Load model and processor
6model_name = "electrohead/vit-fetish-nsfw-detector"
7processor = AutoImageProcessor.from_pretrained(model_name)
8model = AutoModelForImageClassification.from_pretrained(model_name)
9
10# Load and process image
11image = Image.open("your_image.jpg")
12inputs = processor(images=image, return_tensors="pt")
13
14# Get prediction
15with torch.no_grad():
16 outputs = model(**inputs)
17 predicted_class = outputs.logits.argmax(-1).item()
18
19label = model.config.id2label[predicted_class]
20print(f"Prediction: {label}")
21
22# Get probabilities
23probs = torch.nn.functional.softmax(outputs.logits, dim=-1)
24print(f"SFW: {probs[0][0]:.2%}, NSFW: {probs[0][1]:.2%}")
Or using the pipeline API:
1from transformers import pipeline
2
3classifier = pipeline("image-classification", model="electrohead/vit-fetish-nsfw-detector")
4result = classifier("your_image.jpg")
5print(result)
Intended Use
This model is designed for:
- Content moderation systems handling diverse media types
- Automated content filtering for platforms with user-generated content
- Pre-screening uploads that may include art, AI images, or photographs
- Research on NSFW content detection across image modalities
Limitations
- Fetish focus: While the model handles general NSFW content, it was specifically tuned for fetish-related imagery. Performance on other NSFW categories may differ from the base model.
- Binary classification: No severity levels or subcategories — images are classified only as
sfw or nsfw.
- Edge cases: Artistic nudity, medical imagery, and ambiguous content may produce inconsistent results.
- Style bias: Despite training on diverse styles, novel artistic techniques may not be well-represented.
Ethical Considerations
This model is intended for legitimate content moderation purposes. Please use responsibly.
Not intended for:
- Surveillance or privacy-invasive applications
- Discriminatory filtering based on body types or identities
- Circumventing platform policies
- Any illegal purposes
Acknowledgments
- Built on AdamCodd/vit-base-nsfw-detector
- Fine-tuned using HuggingFace Transformers
- Training managed with Label Studio ML Backend