SafeScan Banner

SafeScan

Overview

SafeScan is a multi-class image classifier designed to detect and categorize NSFW (Not Safe For Work) content in images. Built on top of the google/vit-base-patch16-224 vision transformer backbone, SafeScan classifies visual media across five distinct categories to aid in automated content moderation and platform safety.

The model maps visual inputs to the following labels:

  • 0: safe – General, non-explicit content
  • 1: drawing – Non-explicit artistic illustrations and drawings
  • 2: sexy – Suggestive, provocative, or borderline content
  • 3: hentai – Explicit anime/manga or illustrated adult content
  • 4: porn – Explicit adult photographic media

Key Features

  1. Multi-Class Granularity: Differentiates between both real/photographic media and illustrated content across safe, suggestive, and explicit tiers.
  2. Social Media Compression Robustness: Trained with almost all common social media compression artifacts, ensuring performance stays consistent when analyzing images uploaded across different platforms and formats.
  3. Vision Transformer Backbone: Leverages google/vit-base-patch16-224 for high-capacity visual representation learning.
  4. Fast and Scalable: Standard patch-based transformer architecture suitable for batch processing and automated moderation pipelines.

Training Details

  • Base Model: google/vit-base-patch16-224
  • Dataset Size: 34,000 images (34k)
  • Data Augmentation: Comprehensive social media compression augmentations applied during training to guarantee robust real-world inference.

Label Mapping

{
  "0": "safe",
  "1": "drawing",
  "2": "sexy",
  "3": "hentai",
  "4": "porn"
}

How It Works

  1. Images are preprocessed and resized according to the ViT input resolution (224Γ—224).
  2. Patch embeddings and contextual features are extracted via the google/vit-base-patch16-224 backbone.
  3. A classification head outputs probabilities across the 5 target classes.

Demo and Usage

1. Installation

pip install -U transformers torch pillow

2. Loading and Running Inference

from transformers import pipeline

# Load pipeline from Hugging Face
pipe = pipeline("image-classification", model="Parveshiiii/SafeScan")

# Run inference on an image
results = pipe("path/to/image.jpg")
print(results)

Intended Use

  • Automated Content Moderation: Filtering or flagging inappropriate imagery on platforms, forums, and communities.
  • Safety Pipelines: Pre-screening images before public display or downstream generative processing.
  • Assistance Tool: Assisting human moderators by categorizing borderline (sexy), illustrated (hentai, drawing), and explicit (porn) materials.

Ethical Considerations

  • Human-in-the-Loop: Automated moderation should ideally be paired with human review workflows to mitigate false positives and false negatives.
  • Context Awareness: The model evaluates image features only; it does not infer contextual intent, regional cultural norms, or artistic context beyond visual classification.

Citation

@misc{SafeScan_Parveshiiii,
    title={SafeScan: A Vision Transformer for NSFW Image Classification},
    author={Parveshiiii},
    publisher={Hugging Face},
    year={2025},
    url={https://huggingface.co/Parveshiiii/SafeScan}
}

References

Downloads last month
73
Safetensors
Model size
85.8M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Parveshiiii/SafeScan

Finetuned
(2,111)
this model