The NSFW (Not Safe For Work) Filter detects the likelihood that an image contains explicit or unsafe content. It outputs a probability score from 0 (safe) to 1 (NSFW), helping you filter or flag images in your datasets.
nsfw_scoreThe filter takes pre-computed normalized image embeddings from a previous pipeline stage and predicts the probability of NSFW content. The lightweight model processes batches of embeddings efficiently on the GPU.
Before using the ImageNSFWFilterStage, ensure you have:
The NSFW detector model weights are automatically downloaded from the LAION repository on first use. The stage will:
model_dirFirst-time setup: The initial model download is quick (under 1 minute on most connections). Subsequent runs will use the cached model.
ImageEmbeddingStageImageObject.embeddingImageEmbeddingStage for best results.model_inference_batch_size based on available GPU memory.