Downloads · 30 days
19
16% of all-time downloads
Ali7880/multihead-content-moderator
multihead-content-moderator is a image classification model from Ali7880. Use it when you need a label for an image. The card lists the license as apache-2.0.
A multi-task image moderation model with two classification heads: - NSFW Detection: Detects explicit/adult content (preserved from Falconsai) - Violence Detection: Detects violent content (newly trained)
Downloads · 30 days
19
16% of all-time downloads
All-time downloads
121
Public
Repo size
343 MB
Likes
0
Public
Click a slice to open those files.
.pt343 MB · 100%
From the Hugging Face model README
A multi-task image moderation model with two classification heads:
import torch
from transformers import AutoImageProcessor
# Load
checkpoint = torch.load('multihead_model.pt')
processor = AutoImageProcessor.from_pretrained('path/to/model')
# Create model class (see notebook for full class definition)
# model = MultiHeadContentModerator(...)
# model.load_state_dict(checkpoint['model_state_dict'])
# Inference
inputs = processor(images=image, return_tensors='pt')
with torch.no_grad():
# Get both predictions
outputs = model(inputs['pixel_values'], task='both')
nsfw_pred = outputs['nsfw'].argmax(-1)
violence_pred = outputs['violence'].argmax(-1)