nsfw_image_detector

The nsfw_image_detector is a vision‑transformer‑based image‑classification model that identifies potentially unsafe‑for‑work (NSFW) visual content. It is built on the

Freepik 713K downloads mit Image Classification
Frameworkstransformerssafetensorspytorch
Tagstimm_wrapperimage-classificationbase_model:timm/eva02_base_patch14_448.mim_in22k_ft_in22k_in1kbase_model:finetune:timm/eva02_base_patch14_448.mim_in22k_ft_in22k_in1knot-for-all-audiences
Downloads
713K
License
mit
Pipeline
Image Classification
Author
Freepik

Run nsfw_image_detector locally on a Q4KM hard drive

Accelerate your moderation pipeline with a Q4KM hard drive pre‑loaded with the Freepik/nsfw_image_detector . Get instant, out‑of‑the‑box performance on your on‑premise servers. Shop now – Q4KM Hard...

Shop Q4KM Drives

Technical Overview

The nsfw_image_detector is a vision‑transformer‑based image‑classification model that identifies potentially unsafe‑for‑work (NSFW) visual content. It is built on the EVA architecture (a high‑capacity, efficient transformer) and fine‑tuned on a synthetic dataset of 100 k images that are labeled into four granularity levels: neutral, low, medium, and high. The model can be used as a binary true/false NSFW detector or to retrieve the full probability distribution across the four levels, giving developers fine‑grained control over content‑moderation policies.

  • Key Features & Capabilities
    • Four‑level NSFW scoring (neutral, low, medium, high).
    • Binary mode for simple true/false decisions.
    • Fast inference thanks to the EVA‑02 base (patch‑14, 448 px input).
    • Compatible with Hugging Face transformers and timm pipelines.
    • MIT‑licensed base model, ready for deployment on Azure and other cloud providers.
  • Architecture Highlights
    • Backbone: timm/eva02_base_patch14_448.mim_in22k_ft_in22k_in1k – a 384‑dimensional transformer with 24 layers, pre‑trained on ImageNet‑22K and fine‑tuned on the NSFW dataset.
    • Classification head: a lightweight linear layer that maps the transformer output to four logits.
    • Mixed‑precision support (bfloat16) for reduced GPU memory usage.
  • Intended Use Cases
    • Social‑media platforms that need to filter user‑generated images.
    • Enterprise content‑moderation pipelines that require nuanced NSFW levels.
    • AI‑generated image services that must enforce policy compliance.
    • Browser‑based moderation tools (via Hugging Face Spaces).

Benchmark Performance

For NSFW detection, two benchmark dimensions matter most: overall accuracy across severity levels and robustness to AI‑generated imagery. The README provides a head‑to‑head comparison with two popular public models (Falconsai/nsfw_image_detection and AdamCodd/vit-base-nsfw-detector).

Category Freepik Falconsai AdamCodd
High99.54 %97.92 %98.62 %
Medium97.02 %78.54 %91.65 %
Low98.31 %31.25 %89.66 %
Neutral99.87 %99.27 %98.37 %

When evaluating AI‑generated content, the Freepik model achieves 100 % detection for “high” and “low” categories and outperforms the competitors on “medium” and “neutral” as well. These benchmarks demonstrate that the model not only excels on natural images but also maintains high fidelity on synthetic media—a critical factor for modern moderation systems.


Hardware Requirements

  • VRAM for Inference – The EVA‑02 base (384‑dim, 24 layers) comfortably runs in torch.float16 or torch.bfloat16 on a GPU with at least 8 GB of VRAM. For batch‑size = 1, 6‑8 GB is sufficient; larger batches benefit from 12 GB+.
  • Recommended GPU – NVIDIA RTX 3060 (12 GB) or better; RTX A6000, A100, or any GPU supporting bfloat16 will provide sub‑10 ms latency per image.
  • CPU Requirements – A modern multi‑core CPU (e.g., Intel i7‑12700K or AMD Ryzen 7 5800X) can handle preprocessing and data loading; inference on CPU is possible but will be > 100 ms per image.
  • Storage – Model checkpoint size is ~1 GB (safetensors). A fast SSD (NVMe) is recommended for quick loading.
  • Performance Characteristics – With batch = 1 on an RTX 3080, the model processes ~120 images/sec (≈ 8 ms latency). Memory footprint stays under 5 GB when using mixed‑precision.

Use Cases

The nsfw_image_detector is designed for scenarios where nuanced content moderation is essential.

  • Social Media & Community Platforms: Automatically flag images that exceed a configurable NSFW threshold (e.g., “medium” or higher) before they appear in user feeds.
  • Enterprise Document Management: Scan corporate image repositories to prevent accidental exposure of adult or graphic material.
  • AI‑Generated Image Services: Ensure that diffusion‑model outputs comply with policy by checking the “high” and “low” NSFW scores.
  • Browser‑Based Moderation Tools: Integrated via Hugging Face Spaces for quick, no‑install testing.
  • Ad‑Tech & Brand Safety: Filter ad creatives in real time, allowing only “neutral” or low‑risk images to be served.

Training Details

While the README does not disclose the full training pipeline, the following information is available:

  • Dataset: 100 000 synthetically labeled images covering four NSFW severity levels. The synthetic nature helps avoid real‑world bias (gender, ethnicity, etc.).
  • Base Model: timm/eva02_base_patch14_448.mim_in22k_ft_in22k_in1k – pre‑trained on ImageNet‑22K and fine‑tuned on the NSFW set.
  • Fine‑tuning Procedure: Likely uses a cross‑entropy loss over the four classes, with class‑balanced sampling to handle the skewed distribution of “neutral” vs. NSFW images.
  • Compute: Given the size of the base model (≈ 400 M parameters) and the dataset, a single GPU with 16 GB VRAM (e.g., RTX 3090) for for 10‑12 hours at a batch size of 64 using mixed precision.
  • Fine‑tuning Capability: The model can be re‑trained on custom datasets via the Hugging Face transformers or timm APIs, allowing domain‑specific NSFW thresholds.

Licensing Information

The model’s base checkpoint is released under the MIT license, which permits commercial and non‑commercial use, modification, and redistribution without royalties. However, the overall model card lists the license as “unknown” because the synthetic dataset used for fine‑tuning is not explicitly licensed. In practice:

  • You may use the model commercially as long as you respect the MIT terms of the underlying EVA‑02 weights.
  • No explicit attribution is required by the MIT license, but a courteous citation of the original EVA paper (arXiv:2303.11331) and the Freepik repository is recommended.
  • Because the dataset provenance is not documented, you should avoid redistributing the fine‑tuned checkpoint as a standalone dataset.
  • Any deployment that involves “not‑for‑all‑audiences” content (e.g., adult platforms) must comply with local regulations and the “not-for-all-audiences” tag.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives