Object Detection
English
yolo
yolo11
nsfw
Edit model card

Logo

🔞 WARNING: SENSITIVE CONTENT 🔞

THIS MEDIA CONTAINS SENSITIVE CONTENT (I.E. NUDITY, VIOLENCE, PROFANITY, PORN) THAT SOME PEOPLE MAY FIND OFFENSIVE. YOU MUST BE 18 OR OLDER TO VIEW THIS CONTENT.


EraX-NSFW-V1.0

A Highly Efficient Model for NSFW Detection. Very effective for pre-publication image and video control, or for limiting children's access to harmful publications. You can either just predict the classes and their boundingboxes or even mask the predicted harmful object(s) or mask the entire image. Please see the deployment codes below.

Model Details / Overview

  • Model Architecture: YOLO11 (nano, small, medium)
  • Task: Object Detection (NSFW Detection)
  • Dataset: Private datasets (from Internet).
  • Training set: 31890 images.
  • Validation set: 11538 images.
  • Classes: anus, make_love, nipple, penis, vagina.

Labels

Labels

Training Configuration

Evaluation Metrics

Below are the key metrics from the model evaluation on the validation set: comming soon

Training Validation Results

Training and Validation Losses

Training and Validation Losses

Confusion Matrix

Confusion Matrix

Inference

To use the trained model, follow these steps:

  1. Install the necessary packages:
pip install ultralytics supervision huggingface-hub
  1. Download Pretrained model:
from huggingface_hub import snapshot_download
snapshot_download(repo_id="erax-ai/EraX-NSFW-V1.0", local_dir="./", force_download=True)
  1. Simple Use Case:
from ultralytics import YOLO
from PIL import Image
import supervision as sv
import numpy as np

IOU_THRESHOLD        = 0.3
CONFIDENCE_THRESHOLD = 0.2

# pretrained_path = "erax_nsfw_yolo11n.pt"
# pretrained_path = "erax_nsfw_yolo11s.pt"
pretrained_path = "erax_nsfw_yolo11m.pt"

image_path_list = ["test_images/img_1.jpg", "test_images/img_2.jpg"]

model = YOLO(pretrained_path)
results = model(image_path_list,
                  conf=CONFIDENCE_THRESHOLD,
                  iou=IOU_THRESHOLD
                )


for result in results:
    annotated_image = result.orig_img.copy()
    h, w = annotated_image.shape[:2]
    anchor = h if h > w else w

    detections = sv.Detections.from_ultralytics(result)
    label_annotator = sv.LabelAnnotator(text_color=sv.Color.BLACK,
                                        text_position=sv.Position.CENTER,
                                        text_scale=anchor/1700)
    
    pixelate_annotator = sv.PixelateAnnotator(pixel_size=anchor/50)
    
    annotated_image = pixelate_annotator.annotate(
        scene=annotated_image.copy(),
        detections=detections
    )


    annotated_image = label_annotator.annotate(
        annotated_image,
        detections=detections
    )

    
    sv.plot_image(annotated_image, size=(10, 10))

Training

Scripts for training: https://github.com/EraX-JS-Company/EraX-NSFW-V1.0

More examples

  1. Example 01: Example 03

  2. Example 02: Example 06

  3. Example 03: SAFEEST for using make_love class as it will cover entire context.

    Without make_love class With make_love class

Citation

If you find our project useful, we would appreciate it if you could star our repository and cite our work as follows:

@article{EraX-NSFW-V1.0,
  author    = {Phạm Đình Thục and
              Mr. Nguyễn Anh Nguyên and
              Đoàn Thành Khang and
              Mr. Trần Hải Khương and
              Mr. Trương Công Đức and 
              Phan Nguyễn Tuấn Kha and 
              Phạm Huỳnh Nhật},
  title     = {EraX-NSFW-V1.0: A Highly Efficient Model for NSFW Detection},
  organization={EraX JS Company},
  year={2024},
  url={https://huggingface.co/erax-ai/EraX-NSFW-V1.0}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Examples
Unable to determine this model's library. Check the docs .

Model tree for erax-ai/EraX-NSFW-V1.0

Base model

Ultralytics/YOLO11
Finetuned
(7)
this model

Collection including erax-ai/EraX-NSFW-V1.0