Skip to main content
QUICK REVIEW

[Paper Review] UnsafeBench: Benchmarking Image Safety Classifiers on Real-World and AI-Generated Images

Yiting Qu, Xinyue Shen|arXiv (Cornell University)|May 6, 2024
Adversarial Robustness in Machine LearningComputer Science3 citations
TL;DR

This paper introduces UnsafeBench, a benchmarking framework that evaluates image safety classifiers on both real-world and AI-generated images across 11 unsafe categories. It proposes a 10K-image dataset with manual annotations and introduces PerspectiveVision, a VLM-powered moderation tool achieving an F1-score of 0.810—comparable to closed-source models like GPT-4V—highlighting performance degradation in real-world classifiers on AI-generated content.

ABSTRACT

With the advent of text-to-image models and concerns about their misuse, developers are increasingly relying on image safety classifiers to moderate their generated unsafe images. Yet, the performance of current image safety classifiers remains unknown for both real-world and AI-generated images. In this work, we propose UnsafeBench, a benchmarking framework that evaluates the effectiveness and robustness of image safety classifiers, with a particular focus on the impact of AI-generated images on their performance. First, we curate a large dataset of 10K real-world and AI-generated images that are annotated as safe or unsafe based on a set of 11 unsafe categories of images (sexual, violent, hateful, etc.). Then, we evaluate the effectiveness and robustness of five popular image safety classifiers, as well as three classifiers that are powered by general-purpose visual language models. Our assessment indicates that existing image safety classifiers are not comprehensive and effective enough to mitigate the multifaceted problem of unsafe images. Also, there exists a distribution shift between real-world and AI-generated images in image qualities, styles, and layouts, leading to degraded effectiveness and robustness. Motivated by these findings, we build a comprehensive image moderation tool called PerspectiveVision, which improves the effectiveness and robustness of existing classifiers, especially on AI-generated images. UnsafeBench and PerspectiveVision can aid the research community in better understanding the landscape of image safety classification in the era of generative AI.

Motivation & Objective

  • To address the lack of comprehensive evaluation of image safety classifiers on both real-world and AI-generated unsafe images.
  • To investigate whether existing classifiers generalize effectively to AI-generated content, given their training on real-world data.
  • To develop a robust, open-source image moderation tool capable of detecting diverse unsafe content across image sources.
  • To provide a standardized benchmark for future research on image safety in the era of generative AI.
  • To analyze distribution shifts between real-world and AI-generated unsafe images that affect classifier performance.

Proposed method

  • Curated a 10K-image dataset from LAION-5B (real-world) and Lexica (AI-generated), manually annotated for safety and 11 unsafe categories.
  • Collected five conventional image safety classifiers (Q16, NSFW_Detector, NudeNet, SD_Filter, MultiHeaded) and three VLM-based classifiers (LLaVA, InstructBLIP, GPT-4V) with RoBERTa for response classification.
  • Aligned classifier coverage with unsafe categories through manual inspection and category-specific evaluation.
  • Evaluated effectiveness and robustness across six external datasets, measuring F1-scores and performance consistency across categories and image sources.
  • Designed PerspectiveVision as an end-to-end image moderation tool using ensemble VLMs and fine-tuned classification head for multi-category detection.
  • Conducted ablation studies to assess the impact of training data composition and distribution shifts on classifier generalization.
Figure 1 : Overview of UnsafeBench.
Figure 1 : Overview of UnsafeBench.

Experimental results

Research questions

  • RQ1How well do existing image safety classifiers generalize from real-world images to AI-generated unsafe images?
  • RQ2Which unsafe content categories are most and least effectively detected by current classifiers?
  • RQ3Can general-purpose visual language models (VLMs) outperform conventional image safety classifiers in detecting multifaceted unsafe content?
  • RQ4How does distribution shift between real-world and AI-generated images affect classifier performance?
  • RQ5Can an open-source, multi-category image moderation tool achieve performance comparable to proprietary state-of-the-art models?

Key findings

  • Existing image safety classifiers exhibit imbalanced performance across unsafe categories, with significant underperformance on categories like hate and political content.
  • Classifiers trained exclusively on real-world images show substantial performance degradation—up to 30% drop in F1-score—when applied to AI-generated images due to distribution shift.
  • The VLM-based classifier GPT-4V achieved the highest F1-score of 0.810 on the benchmark, outperforming conventional models and matching closed-source state-of-the-art systems.
  • PerspectiveVision, the proposed open-source tool, achieved an overall F1-score of 0.810 across six evaluation datasets, demonstrating strong generalization and multi-category detection capability.
  • AI-generated images exhibit distinct visual patterns—such as artistic representations and grid layouts—that current classifiers fail to generalize to, indicating a need for domain-adaptive training.
  • The UnsafeBench dataset reveals a bias toward unsafe content and limited diversity in AI-generated sources, primarily from Stable Diffusion, suggesting the need for broader data collection.
Figure 2 : Average F1-Score and number of classifiers for each unsafe category.
Figure 2 : Average F1-Score and number of classifiers for each unsafe category.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.