🚀 EraX-NSFW-V1.0
A Highly Efficient Model for NSFW Detection, effective for pre - publication image and video control, and limiting children's access to harmful publications.
⚠️ Important Note
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.
🚀 Quick Start
EraX-NSFW-V1.0 is a powerful model for NSFW detection. You can either just predict the classes and their bounding boxes or even mask the predicted harmful object(s) or mask the entire image. Please see the deployment codes below.
Installation
pip install ultralytics supervision huggingface-hub
Download Pretrained model
from huggingface_hub import snapshot_download
snapshot_download(repo_id="erax-ai/EraX-NSFW-V1.0", local_dir="./", force_download=True)
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_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))
✨ Features
- High Efficiency: Effectively used for pre - publication image and video control, and limiting children's access to harmful publications.
- Flexible Usage: You can predict classes and bounding boxes, or mask harmful objects or the entire image.
📦 Installation
To use the trained model, follow these steps:
- Install the necessary packages:
pip install ultralytics supervision huggingface-hub
- Download Pretrained model:
from huggingface_hub import snapshot_download
snapshot_download(repo_id="erax-ai/EraX-NSFW-V1.0", local_dir="./", force_download=True)
💻 Usage Examples
Basic Usage
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_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))
📚 Documentation
Model Details / Overview
Property |
Details |
Model Type |
YOLO11 (nano, small, medium) |
Task |
Object Detection (NSFW Detection) |
Training Data |
Private datasets (from Internet). Training set: 31890 images; Validation set: 11538 images. |
Classes |
anus, make_love, nipple, penis, vagina. |
Labels

Training Configuration
- Model Weights Files:
- Number of Epochs: 100
- Learning Rate: 0.01
- Batch Size: 208
- Image Size: 640x640
- Training server: 8 x NVIDIA RTX A4000 (16GB GDDR6)
- Training time: ~10 hours
Training Validation Results
Training and Validation Losses

Confusion Matrix

More examples
- Example 01:

- Example 02:

- Example 03: SAFEEST for using make_love class as it will cover entire context.
Without make_love class | With make_love class
:-------------------------:|:-------------------------:
|
|
| 
🔧 Technical Details
Inference
To use the trained model, follow these steps:
- Install the necessary packages.
- Download the pretrained model.
- Use the simple use case code to perform inference.
Training
Scripts for training: https://github.com/EraX-JS-Company/EraX-NSFW-V1.0
📄 License
This project is licensed under the Apache 2.0 License.
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}
}