Learning a Discriminative Model for the Perception of Realism in Composite Images

Jun-Yan Zhu, Philipp Krähenbühl, Eli Shechtman, Alexei A. Efros

Introduction

Humans possess an innate ability to detect subtle inconsistencies in images, often instantly identifying a "photoshopped" or unrealistic composite. This sensitivity makes high-quality photo editing and computer graphics challenging. Quantifying "realism" computationally is difficult because the space of unrealistic images is vast compared to the narrow manifold of natural, real-world photographs. Traditional methods for assessing realism have relied on hand-crafted heuristics, such as color histograms, which often fail to capture the complex, high-level properties of visual compatibility.

This paper introduces a data-driven approach to quantify visual realism by training a Convolutional Neural Network (CNN) to distinguish between natural photographs and automatically generated image composites. By learning this "pretext" task, the model captures essential cues like color, lighting, and texture compatibility without requiring expensive human annotations.

The spectrum of realism: from natural images to various types of composite images.

Methodology: Learning Realism via Self-Supervision

To bypass the need for massive amounts of subjective human labeling, the authors employ a self-supervised learning strategy. The core idea is to train a discriminative model on a task where labels can be generated automatically.

The Pretext Task

A VGG-16 CNN is trained on a binary classification task: distinguishing real natural photos from automatically generated composites. This forces the network to learn the underlying features that characterize "realness."

Automatic Composite Generation

Training data is created by swapping objects between images. To ensure the network focuses on lighting and texture rather than obvious geometric mismatches, the authors match object shapes using masks or automatic object proposals. This process generates a massive training set where the semantics remain largely correct, but the visual integration of the foreground object into the background is often flawed.

The process of generating training composites by matching target object shapes with similar masks from other images.

Optimization and Hard Negative Mining

Once trained, the CNN serves as a loss function to improve composite quality. By freezing the network weights and backpropagating the realism score to the image layer, the model can optimize the brightness and contrast of a pasted object to maximize its perceived realism. To prevent the model from being fooled by extreme, unnatural colors (the "uncanny valley" of machine perception), the authors use hard negative mining, feeding the network's own optimized mistakes back into the training set.

Datasets and Evaluation

The model was initially trained using the LabelMe dataset, utilizing approximately 11,000 natural images and 25,000 object instances, later expanded to include indoor scenes. Evaluation was conducted on two primary datasets: the standard Lalonde and Efros (2007) dataset and a new Indoor Dataset of 720 photos with human ratings from Amazon Mechanical Turk (MTurk).

Key Results

The unsupervised RealismCNN achieved an Area Under the ROC Curve (AUC) of 0.84 on the Lalonde dataset, significantly outperforming previous hand-crafted methods (0.61–0.81). When fine-tuned with a small amount of human-labeled data, the performance reached 0.88 AUC, nearing the human agreement level of 0.91.

In practical applications, the model showed strong performance:

  • Color Adjustment: Composites color-corrected using the CNN's gradients were rated significantly higher by humans than simple cut-and-paste results.
  • Object Selection: When selecting the best object for a specific background, the CNN's top choices were rated as much more realistic (score: 0.285) compared to selections based solely on shape similarity (-0.033).

Discussion and Future Work

A key insight of this work is that a purely discriminative classifier can be used generatively to improve image quality. By optimizing inputs to maximize a "realism" score, the model effectively performs automated color correction without explicit rules.

However, the current model primarily focuses on low-to-mid-level visual cues like color and texture. It remains largely "blind" to high-level scene semantics, perspective, and layout. Future research will focus on integrating these higher-level geometric and semantic cues to achieve a more holistic perception of visual realism.

Summary updated

BibTeX
@inproceedings{zhu2015learning,
  author = {Jun-Yan Zhu and Philipp Krähenbühl and Eli Shechtman and Alexei A. Efros},
  title = {{Learning a Discriminative Model for the Perception of Realism in Composite Images}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2015},
  doi = {10.1109/iccv.2015.449},
}
Figure