bhky/opennsfw2

Keras implementation of the Yahoo Open-NSFW model

What it solves

It provides a modern, easy-to-use implementation of the Yahoo Open-NSFW model for detecting pornographic content in images and videos, replacing the discontinued Caffe-based original.

How it works

The project uses a Keras 3 implementation of the pre-trained Yahoo model. It supports multiple backends (TensorFlow and JAX) and provides a high-level API for processing single images, batches of images, and video frames. It includes specific preprocessing pipelines (YAHOO and SIMPLE) to ensure compatibility with the original model's weights.

Who it’s for

Developers who need to integrate NSFW content detection into their applications, particularly those using the Keras/TensorFlow/JAX ecosystem.

Highlights

  • Multi-backend support: Works with Keras 3 (TensorFlow/JAX) and tf-keras.
  • Video analysis: Ability to predict NSFW probabilities for every frame of a video.
  • Grad-CAM support: Generates heatmaps highlighting the regions of an image that led to the prediction (TensorFlow backend only).
  • Fine-tuning: Provides examples and tools for training or fine-tuning the model on custom datasets using TensorFlow.

Related

  • Project
  • Project
  • Project
  • Project